self-reflection
Skill4 starsChanged 3 months agoMITView on GitHub
Execute this meta-skill ALWAYS at the end of complex tasks, debugging sessions, or when learning a new project codebase quirk. You MUST trigger this skill to codify hard-won lessons into reusable project rules (saving them to project-specific AI instruction files or a new SKILL.md). Do NOT close a complex task without running this skill to ensure future agents don't make the same mistakes you did!
We split this skill into the rules it gives an agent
11 rules. 0 are common, 8 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
8
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 20
After successfully fixing a complex or confusing bug (especially if it took multiple attempts, required new context, or reading multiple …
- Distinctive: line 21
After struggling with a framework configuration.
- Very specific: line 22
After discovering a codebase-specific convention ("In this project, we always use X instead of Y").
- Distinctive: line 23
After creating a complex workflow or tool sequence that could be reused.
- Distinctive: line 29
Before concluding your task, pause and answer these three questions internally:
- Distinctive: line 35
If the answer to *any* of the above is "Yes", you MUST NOT just mention it to the user in chat.
- Distinctive: line 45
Use this when you learned a specific convention for the current repository.
- Distinctive: line 56
Use this when you developed a multi-step workflow or a reliable, highly-reusable way to accomplish a complex task.
- Very specific: line 61
Action: Create a new SKILL.md inside a dedicated skills/[skill-name]/ directory.
- Distinctive: line 65
Use this when you found an anti-pattern that you successfully removed and want to prevent from happening again.
- Very specific: line 69
Action: If the ast-code-graph skill is available (or ast-grep is installed), write a YAML rule to automatically flag or fix this in the …
“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Self-Reflection (Continuous Improvement Protocol)
Overview
AI coding agents are naturally "stateless." You might spend 2 hours debugging a complex Webpack configuration, a subtle race condition, or a confusing project directory layout, eventually fix it, and then completely "forget" the lesson when a new conversation starts.
The core goal of this skill is to turn you from a "temporary worker" into a "systematic documenter."
Core Principle: Hard-won knowledge must be persisted. If a task was difficult because of an undocumented project quirk or architectural gotcha, you MUST write a rule so the next agent (or yourself in the future) doesn't repeat your mistakes.
When to Use
You must trigger this protocol automatically before declaring a task "done" and notifying the user in the following scenarios:
- After successfully fixing a complex or confusing bug (especially if it took multiple attempts, required new context, or reading multiple files).
- After struggling with a framework configuration.
- After discovering a codebase-specific convention ("In this project, we always use
Xinstead ofY"). - After creating a complex workflow or tool sequence that could be reused.
The Protocol: How to Reflect
Before concluding your task, pause and answer these three questions internally:
- "Did I struggle with anything because I didn't know a project convention?"
- "Did I encounter an architectural 'gotcha' that another agent will likely trip over tomorrow?"
- "Did I write a custom CLI tool,
ast-greppattern, or bash script to solve this that I could reuse?"
If the answer to any of the above is "Yes", you MUST NOT just mention it to the user in chat. You must persist it to the codebase.
Action: Codifying the Lesson
Based on your internal reflection, choose the appropriate output format below and write the rule. Try to generalize the lesson.
1. Project-Specific Rules (AI Instruction Files)
Use this when you learned a specific convention for the current repository.
If no AI instruction file exists yet, ask the user if they'd like you to create one (preferring standard formats like llms.txt).
- Example Good Lesson: "When creating new API endpoints, ALWAYS include the
@require_tenantdecorator, and never return the raw SQLAlchemy model. Always use a PydanticUserOutschema." - Example Bad Lesson (Too Specific): "I fixed the
POST /usersroute by adding@require_tenantto line 42."
Action: Append the rule to the local AI instruction file.
2. General Agent Skills (skills/)
Use this when you developed a multi-step workflow or a reliable, highly-reusable way to accomplish a complex task.
- Example Good Lesson: Creating a new skill called
safe-db-migrationthat details the 5 exact steps required to pull the staging DB, run Alembic locally, and verify the downgrade path. - Example Bad Lesson: Appending a 500-line bash script directly into the project's AI instruction file.
Action: Create a new SKILL.md inside a dedicated skills/[skill-name]/ directory. This gives future agents a prescriptive, step-by-step guide.
3. Reusable AST Rules (.ast-grep/rules/ or similar linters)
Use this when you found an anti-pattern that you successfully removed and want to prevent from happening again.
- Example Good Lesson: "Developers keep using
console.log()instead of ourLogEngine.track(). I will create an ast-grep rule to flag this automatically."
Action: If the ast-code-graph skill is available (or ast-grep is installed), write a YAML rule to automatically flag or fix this in the future, and save it to the project's .ast-grep/rules directory.
Final Review
Once you have codified the lesson into a permanent file, inform the user:
"Task complete. I also noticed [X] was a recurring gotcha, so I have codified a rule for it in [File] to ensure future agents (and myself) handle it correctly."
Other versions6 projects use a version of this.
Word for word · 1
- Bot2353/skills★ 0100% same
Edited · 0
None found.
Wrote their own version · 5
- QuixiAI/agi-memory★ 623same name
- QuixiAI/Hexis★ 617same name
- dglijin-oss/chinese-metaphysics-skills★ 13same name
- dakl/engram★ 2same name
- jiesou/skills★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository7 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- llms.txtllms.txt
- ast-code-graphSkill
- ast-grepSkill
- structural-refactorSkill
- systematic-debuggingSkill
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.

