Learn
A Claude setup that stops making the same mistake twice. Every correction the user gives goes into the project's rulebook (LESSONS.md, imported by …
By alexyc9381/learn-skill, MIT licence. Shared here with credit.
learn
A rulebook that grows by itself. Every correction becomes one short rule in LESSONS.md. CLAUDE.md imports it
with @LESSONS.md, so every new session starts with every rule. Once a night the investigator goes over the day's
corrections and writes what it learned back into the rulebook.
What the user typed after /learn: $ARGUMENTS
The tool
All bookkeeping goes through learn.py. Use the project's copy if it exists, otherwise the one in this skill:
python3 .claude/hooks/learn.py <command> # after /learn setup
python3 "${CLAUDE_SKILL_DIR}/learn.py" <command> # before setup
Below, LEARN means whichever of those exists. Run it from the project root. If ${CLAUDE_SKILL_DIR} looks
unexpanded, use the "Base directory for this skill" Claude Code printed above. setup always runs from the skill's
folder, because it copies the script into the project.
You only ever change LESSONS.md and files inside .learn/. Never edit code, settings or any other file while
running this skill (setup is the one exception, and it goes through the script). Add or change rules only through
LEARN add, LEARN merge and LEARN drop, so the rulebook stays deduplicated and under its cap.