Agent skill
add-lesson
Add a new lesson learned to shared rules and sync to context files.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/add-lesson
SKILL.md
Add Lesson Skill
Add a new lesson learned to the shared rules.
Overview
When you discover a bug, mistake, or useful pattern, use this skill to document it so all agents learn from it.
Usage
/add-lesson
Prerequisites
- Access to
shared-rules/and permission to runscripts/sync-rules.py.
Lesson Template
### YYYY-MM-DD - Brief Title
- **Issue**: What went wrong or was discovered
- **Root Cause**: Why it happened
- **Fix**: How it was fixed
- **Prevention**: Rule or check to prevent recurrence
- **Applies To**: all | claude | cursor | gemini
- **Files Changed**: List of affected files
Process
-
Gather information:
- What was the issue?
- What caused it?
- How was it fixed?
- How can we prevent it?
-
Add to lessons file:
- Open
shared-rules/lessons-learned.md - Add new entry at TOP of "Recent Lessons" section
- Use the template format
- Open
-
Run sync:
bashpython scripts/sync-rules.py -
Verify propagation:
- Check CLAUDE.md updated
- Check timestamp
Example
### 2026-01-22 - Task Tool Token Efficiency
- **Issue**: Spawning Claude workers via subprocess was expensive (~13k tokens overhead)
- **Root Cause**: Full context duplication to each subprocess
- **Fix**: Use native Task tool with context filtering
- **Prevention**: Always prefer Task tool over subprocess for Claude workers
- **Applies To**: claude
- **Files Changed**:
- `.claude/skills/implement-task/SKILL.md`
- `CLAUDE.md`
Categories
Lessons should be categorized by:
all- Applies to all agentsclaude- Claude-specificcursor- Cursor-specificgemini- Gemini-specific
Archiving
After 30 days or when list gets long:
- Move old lessons to "Archived Lessons" section
- Keep for historical reference
Outputs
- Updated
shared-rules/content and synced context files (e.g.CLAUDE.md).
Error Handling
- If sync fails, do not proceed; resolve and rerun
scripts/sync-rules.py. - If lesson template is incomplete, request the missing fields before adding.
Related Skills
/sync-rules- Sync shared rules into context files
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?