About learning-from-mistakes
A skill that turns a recent mistake or correction into a specific rule in an agent's persistent instructions. It checks for overlap and requires approval before changing the chosen project or global file.
Key features
- 01Codify a recent correction
- 02Choose project or global scope
- 03Check for duplicate rules
- 04Require approval before writing
Use cases
- 01Preserve a codebase-specific lesson
- 02Carry a general behavior rule across sessions
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ bostonaholic/ skills --skill learning-from-mistakesAfter installing, type/learning-from-mistakesin Claude Code to confirm it loaded.
Bundled filesagents/openai.yamlscripts/resolve-instructions-file.sh
Details
From the project READMELearn From Mistake
Turn the most recent mistake or correction in the conversation into a rule in the instructions file the agent reads, so the lesson persists across sessions. If no correction is clear, ask which one to codify.
- The rule: one or two imperative sentences ("Do X", "Never Y"), specific enough to change behavior. A platitude ("be careful with tests") fails.
- Target file: choose the scope,
projectfor a lesson about this codebase, its conventions or tooling, orglobalfor one that applies across projects, then runscripts/resolve-instructions-file.sh <claude|codex> <project|global>withclaudein Claude Code andcodexin Codex. Exit 0 prints the file to edit. On exit 2 (no repository) or 69 (no git), ask where to write. In another host, or on exit 3, ask which file it reads. On exit 4, report the loop. Exit 1 is a usage error: fix the arguments and rerun. - Overlap: if the rule already exists, stop and say where. If a related rule exists, refine it instead of adding a duplicate.
- Approval: show the rule (or the old and new text of a refined rule), the
file path, and the section: an existing section that fits, or else a new
## Learned Rulessection. Never propose any other new heading. Write nothing until the user approves.
Comments
Markdown supported