retrieve-lessons
Skill0 starsChanged 5 months agoMITView on GitHub
Adopt the shared working rules from the agentic-ai-rules-and-skills repo into a repo that does not have them yet — detect what kind of work the repo actually does, select only the rule categories with evidence behind them, and link them from its CLAUDE.md pinned to a commit so drift is detectable. Use when starting work in a new or unfamiliar repo, when a repo's CLAUDE.md has no shared-rules section, when asked to "retrieve/adopt/apply the shared lessons or rules", or to re-check whether an adopted pin has gone stale.
In this repository57 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- ask-mattSkill
- cast-memberSkill
- check-feedbackSkill
- codebase-designSkill
- content-pipeline-initSkill
- content-pipelineSkill
- data-analystSkill
- decision-mappingSkill
- diagnosing-bugsSkill
- domain-modelingSkill
- draft-asset-promptsSkill
- edit-articleSkill
- fableSkill
- game-concept-interviewSkill
- git-guardrails-claude-codeSkill
- global-guidelinesSkill
- grillingSkill
- grill-meSkill
- grill-with-docsSkill
- handoffSkill
- implementSkill
- improve-codebase-architectureSkill
- karpathy-guidelinesSkill
- launch-sessionSkill
- lesson-reviewSkill
- link-claude-skillsSkill
- loop-meSkill
- migrate-to-shoehornSkill
- obsidian-vaultSkill
- opusSkill
- prototypeSkill
- publish-metadataSkill
- resolving-merge-conflictsSkill
- reviewSkill
- rotate-sessionSkill
- run-buildSkill
- run-clipsSkill
- scaffold-exercisesSkill
- session-sandboxSkill
- setup-matt-pocock-skillsSkill
- setup-pre-commitSkill
- setup-status-lineSkill
- showrunner-shortSkill
- sonnetSkill
- tddSkill
- teachSkill
- to-issuesSkill
- to-prdSkill
- triageSkill
- verify-outputsSkill
- wrap-allSkill
- wrapSkill
- writing-beatsSkill
- writing-fragmentsSkill
- writing-great-skillsSkill
- writing-shapeSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 66
If the shared repo has been reorganised such that a selected category no longer exists, the script errors out rather than quietly adopting …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Retrieve Lessons
The consuming half of the cycle. lesson-review publishes what a
project learned; this pulls it into the next repo so the lesson is paid for once.
Shared repo: https://github.com/surasakcho/agentic-ai-rules-and-skills
python -X utf8 retrieve.py --repo <target-repo> # detect + show what it would adopt
python -X utf8 retrieve.py --repo <target-repo> --write # write the block into CLAUDE.md
python -X utf8 retrieve.py --repo <target-repo> --check # exit 1 if the pin is stalePaths are arguments, never literals — a machine path in a shared skill publishes a username and a directory layout.
The two decisions this encodes
Link, don't copy. A copied rule drifts out of agreement with its source and nobody
notices, because a copy looks exactly as authoritative as the original. The block written into
CLAUDE.md contains links, not text.
Pin the commit. A bare link silently becomes a link to something else. The block records
the shared repo's commit, so --check can tell you the rules moved and you can go read what
changed. An unpinned reference cannot distinguish "still true" from "nobody looked".
Select on evidence, never adopt wholesale
retrieve.py matches each rule category against real signals — declared dependencies,
directory names, file globs — and adopts only the categories that hit. A repo with no tests/
and no test runner does not get the testing rule.
This restraint is the whole point. A CLAUDE.md carrying nine rules where two apply teaches
the reader that most of it is skippable, and then the two that mattered get skipped too.
Adopting nothing is a valid outcome and the script says so rather than inventing a match.
The pass, in order
- Run it without
--writeand read what it proposes. The evidence for each category is printed next to it — if the evidence looks wrong, the detection is wrong, and adopting on top of a bad match is worse than not adopting. - Read the rules it selected. They are short and each names a real incident. This is the step that cannot be automated and the one that makes the adoption real; a linked rule nobody has read is a citation, not a practice.
--write. Idempotent — re-running refreshes the block in place and preserves everything else inCLAUDE.md.- Install the skills the rules mechanise, where they apply:
verify-outputsfor any repo that produces figures, tables or reported numbers.prose < checklist < test < gate— a rule that can run should be running. - Re-check periodically.
--checkin a pre-commit hook turns a stale pin into a failing commit instead of a rule nobody re-read.
When the shared repo has moved
--check failing is not noise — it means a rule you are relying on may have changed or been
deleted. A rule contradicted by later experience gets deleted, not hedged, so a moved pin
can mean something you are currently doing is now known to be wrong. Read the diff, then
--write to re-pin.
If the shared repo has been reorganised such that a selected category no longer exists, the script errors out rather than quietly adopting fewer rules. A silent skip is how a repo ends up believing it has coverage it does not have.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

