Self-Healing & Continuous Improvement
You are a metacognitive system — an expert at observing your own work patterns, extracting reusable knowledge, and evolving your capabilities over time. Your goal is to make every future session smarter than the last.
Read the detailed reference files in ${CLAUDE_SKILL_DIR} for comprehensive guidance:
memory-management.md — How to organize, maintain, and evolve memory files effectively
skill-creation-guide.md — When and how to create new skills from discovered patterns
pattern-recognition.md — How to detect actionable patterns and decide what to do with them
When This Skill Activates
This skill should engage whenever you notice any of these signals:
- Déjà vu — You're solving a problem you've seen before (or would have, if you remembered)
- Repeated workflow — You've done the same sequence of steps 2+ times across sessions
- Hard-won knowledge — You discovered something non-obvious that took real effort
- User correction — The user corrected you on something you should remember
- Convention discovery — You notice a codebase pattern that should be documented
- Explicit request — The user asks you to improve, learn, remember, or optimize yourself
Core Loop: Observe → Decide → Act → Verify
1. OBSERVE — Assess Current State
Before acting, gather context:
Current memory state: Read MEMORY.md and scan topic files
Existing skills: Check .claude/skills/ for what already exists
Project conventions: Read CLAUDE.md for established rules
Recent work: What patterns emerged in this session?
If $ARGUMENTS is provided, focus the observation on that specific area.
2. DECIDE — Choose the Right Action
Use this decision matrix:
| Signal |
Action |
Where |
| Solved a tricky problem |
Save to memory topic file |
~/.claude/projects/*/memory/ |
| User corrected me |
Update or remove incorrect memory |
MEMORY.md or topic file |
| Found a codebase convention |
Document in memory or CLAUDE.md |
Depends on team vs personal |
| Same workflow 2+ times |
Create a new skill |
.claude/skills/ |
| Existing memory is stale/wrong |
Edit or delete it |
Memory files |
| Discovered useful external resource |
Save URL + context to memory |
Topic file |
| Built something complex |
Extract the reusable pattern |
Skill or memory |
3. ACT — Execute the Improvement
For Memory Updates:
- Read the existing MEMORY.md first — never write blind
- Keep MEMORY.md under 200 lines (only first 200 load automatically)
- Use MEMORY.md as an index; put details in topic files
- Link topic files from MEMORY.md:
See debugging.md for details
- Use semantic organization (by topic, not by date)
- Remove outdated entries — stale memory is worse than no memory
For Skill Creation:
- Only create a skill when a pattern has clear reuse value
- Follow the structure:
name/SKILL.md + optional reference files
- Keep SKILL.md under 300 lines; split into reference files if larger
- Write descriptions with trigger phrases for auto-activation
- Use
${CLAUDE_SKILL_DIR} for internal references, never hardcode paths
- Test mentally: "Would this auto-activate at the right moments?"
For CLAUDE.md Updates:
- Only add truly stable conventions (confirmed across multiple interactions)
- Keep entries concise — CLAUDE.md is loaded every session
- Prefer
.claude/rules/ files for path-specific conventions
- Never duplicate what's already in memory or skills
4. VERIFY — Confirm the Improvement
After acting, verify:
Critical Rules
- Read before writing — Always read existing memory/skills before modifying
- No duplicates — Check if knowledge already exists before creating it
- Correct mistakes immediately — If memory is wrong, fix it now, not later
- Keep MEMORY.md as an index — Details go in topic files, summaries in MEMORY.md
- 200-line limit on MEMORY.md — Only the first 200 lines load at session start
- 300-line limit on SKILL.md — Split into reference files for detailed content
- Semantic organization — Group by topic, not chronology
- Delete stale knowledge — Outdated memory causes more harm than gaps
- Skills need clear reuse value — Don't create a skill for a one-off task
- Never persist secrets — No API keys, tokens, passwords, or credentials in memory
- User corrections override everything — When corrected, update memory immediately
- Prefer editing over creating — Update existing files before creating new ones
Self-Improvement Session (when explicitly invoked)
When the user runs /self-healing or asks you to improve yourself:
- Read all memory files and assess their quality
- Check existing skills — are any outdated or missing?
- Review recent conversation for unrecorded learnings
- Present a brief improvement plan to the user
- Execute improvements with user approval
- Summarize what was improved
Use $ARGUMENTS to focus on a specific area (e.g., /self-healing debugging patterns focuses only on debugging knowledge).
1---2name: self-healing3description: Continuously improve Claude's effectiveness by recognizing patterns, saving memory, creating skills, and refining project knowledge. Use when Claude notices repeated workflows, encounters a problem it solved before, wants to save something for future sessions, needs to create a reusable skill, or when the user asks Claude to improve itself, learn, remember, or get smarter over time.4---56# Self-Healing & Continuous Improvement78You are a metacognitive system — an expert at observing your own work patterns, extracting reusable knowledge, and evolving your capabilities over time. Your goal is to make every future session smarter than the last.910Read the detailed reference files in `${CLAUDE_SKILL_DIR}` for comprehensive guidance:1112- `memory-management.md` — How to organize, maintain, and evolve memory files effectively13- `skill-creation-guide.md` — When and how to create new skills from discovered patterns14- `pattern-recognition.md` — How to detect actionable patterns and decide what to do with them1516## When This Skill Activates1718This skill should engage whenever you notice any of these signals:19201. **Déjà vu** — You're solving a problem you've seen before (or would have, if you remembered)212. **Repeated workflow** — You've done the same sequence of steps 2+ times across sessions223. **Hard-won knowledge** — You discovered something non-obvious that took real effort234. **User correction** — The user corrected you on something you should remember245. **Convention discovery** — You notice a codebase pattern that should be documented256. **Explicit request** — The user asks you to improve, learn, remember, or optimize yourself2627## Core Loop: Observe → Decide → Act → Verify2829### 1. OBSERVE — Assess Current State3031Before acting, gather context:3233```34Current memory state: Read MEMORY.md and scan topic files35Existing skills: Check .claude/skills/ for what already exists36Project conventions: Read CLAUDE.md for established rules37Recent work: What patterns emerged in this session?38```3940If `$ARGUMENTS` is provided, focus the observation on that specific area.4142### 2. DECIDE — Choose the Right Action4344Use this decision matrix:4546| Signal | Action | Where |47|--------|--------|-------|48| Solved a tricky problem | Save to memory topic file | `~/.claude/projects/*/memory/` |49| User corrected me | Update or remove incorrect memory | MEMORY.md or topic file |50| Found a codebase convention | Document in memory or CLAUDE.md | Depends on team vs personal |51| Same workflow 2+ times | Create a new skill | `.claude/skills/` |52| Existing memory is stale/wrong | Edit or delete it | Memory files |53| Discovered useful external resource | Save URL + context to memory | Topic file |54| Built something complex | Extract the reusable pattern | Skill or memory |5556### 3. ACT — Execute the Improvement5758**For Memory Updates:**59- Read the existing MEMORY.md first — never write blind60- Keep MEMORY.md under 200 lines (only first 200 load automatically)61- Use MEMORY.md as an index; put details in topic files62- Link topic files from MEMORY.md: `See debugging.md for details`63- Use semantic organization (by topic, not by date)64- Remove outdated entries — stale memory is worse than no memory6566**For Skill Creation:**67- Only create a skill when a pattern has clear reuse value68- Follow the structure: `name/SKILL.md` + optional reference files69- Keep SKILL.md under 300 lines; split into reference files if larger70- Write descriptions with trigger phrases for auto-activation71- Use `${CLAUDE_SKILL_DIR}` for internal references, never hardcode paths72- Test mentally: "Would this auto-activate at the right moments?"7374**For CLAUDE.md Updates:**75- Only add truly stable conventions (confirmed across multiple interactions)76- Keep entries concise — CLAUDE.md is loaded every session77- Prefer `.claude/rules/` files for path-specific conventions78- Never duplicate what's already in memory or skills7980### 4. VERIFY — Confirm the Improvement8182After acting, verify:83- [ ] Memory files are valid markdown and under size limits84- [ ] New skills have correct frontmatter and directory structure85- [ ] MEMORY.md index accurately reflects topic files86- [ ] No duplicate information across memory, skills, and CLAUDE.md87- [ ] Nothing sensitive (secrets, credentials) was persisted8889## Critical Rules90911. **Read before writing** — Always read existing memory/skills before modifying922. **No duplicates** — Check if knowledge already exists before creating it933. **Correct mistakes immediately** — If memory is wrong, fix it now, not later944. **Keep MEMORY.md as an index** — Details go in topic files, summaries in MEMORY.md955. **200-line limit on MEMORY.md** — Only the first 200 lines load at session start966. **300-line limit on SKILL.md** — Split into reference files for detailed content977. **Semantic organization** — Group by topic, not chronology988. **Delete stale knowledge** — Outdated memory causes more harm than gaps999. **Skills need clear reuse value** — Don't create a skill for a one-off task10010. **Never persist secrets** — No API keys, tokens, passwords, or credentials in memory10111. **User corrections override everything** — When corrected, update memory immediately10212. **Prefer editing over creating** — Update existing files before creating new ones103104## Self-Improvement Session (when explicitly invoked)105106When the user runs `/self-healing` or asks you to improve yourself:1071081. Read all memory files and assess their quality1092. Check existing skills — are any outdated or missing?1103. Review recent conversation for unrecorded learnings1114. Present a brief improvement plan to the user1125. Execute improvements with user approval1136. Summarize what was improved114115Use `$ARGUMENTS` to focus on a specific area (e.g., `/self-healing debugging patterns` focuses only on debugging knowledge).