skills/codify/SKILL.md
Consolidate learnings into permanent documentation. Triggers on "codify", "consolidate learnings", or when learnings.md approaches its soft limit. Transforms session learnings into CLAUDE.md fragments, decision files, and skill references.
npx skillsauth add ddaanet/agent-core codifyInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Transform session learnings into persistent, actionable documentation. Updates CLAUDE.md, context files, and related docs to capture rules and patterns.
Prerequisite: Execute in a clean session (fresh start). Runs inline — no delegation to sub-agents.
plugin/bin/learning-ages.py to get the ages reportagents/learnings.md for contextagents/decisions/*.md (relevant domain doc, if exists)For each eligible learning, search candidate target files for related headings:
Grep pattern="<keyword from learning>" path="plugin/fragments/" glob="*.md"
Grep pattern="<keyword from learning>" path="agents/decisions/" glob="*.md"
Use Grep results to ground routing — match the learning to the file that already contains related content.
Behavioral rules → plugin/fragments/*.md: Workflow patterns • Anti-patterns • Directive conflicts • Agent behavior
Technical details → agents/decisions/*.md: Architecture • Implementation patterns • Technology choices (consult agents/decisions/README.md for domain → file routing)
Implementation patterns → agents/decisions/implementation-notes.md: Mock patterns • Python quirks • API details
agents/session.md: Active tasks/decisions • Handoff info • Temporary state • Blockers
Skill references: .claude/skills/*/references/learnings.md • Domain-specific patterns (progressive disclosure)
Agent templates → plugin/agents/*.md: Execution patterns • Tool usage • Error handling • Domain-specific guidance. Route when learning is actionable for a specific agent role (execution pattern, stop condition, tool preference, error handling heuristic). Eligible agents: artisan, brainstorm-name, corrector, design-corrector, hooks-tester, outline-corrector, refactor, runbook-corrector, runbook-outline-corrector, runbook-simplifier, scout, tdd-auditor, test-driver. Exclude plan-specific agents (generated per-runbook by prepare-runbook.py)
Other: Plan files (historical only)
Never: README.md • Test files • Temp files
For detailed routing guidance, see references/consolidation-patterns.md
Principles:
Format:
### [Rule Name]
**[Imperative/declarative statement]**
[Supporting explanation if needed]
**Example:** [Concrete demonstration]
agents/learnings.md, but keep the 3-5 most recent learnings (at bottom of file) for continuitywc -l. If >400 lines, split by H2/H3 boundaries into 100-300 line sections. Run plugin/bin/validate-memory-index.py --fix after splitStep 4a: Update discovery mechanisms
After consolidating a learning:
/when or /how entry in agents/memory-index.md:
## When X Y Z → /when x y z## How to X Y → /how x yplugin/bin/compress-key.py) to verify uniqueness/when for behavioral knowledge (when to do X, when X applies)/how for procedural knowledge (how to do X, technique for X)@-reference to CLAUDE.md OR create .claude/rules/ entry if path-scoped. Heuristic: If the learning applies regardless of which files are being edited → @-ref in CLAUDE.md. If it only applies when working with a specific file type or directory → .claude/rules/ entry with path frontmatter..claude/rules/ entry exists for path triggerPrinciple-level (consolidate): ✅
Incident-specific (reject/revise): ❌
Meta-learnings (use sparingly):
Titles must follow the validation rules enforced by precommit:
When or How to ## When choosing review gate (2 content words — pass). ## When testing (1 content word — fail)Anti-pattern examples:
## transformation table → missing prefix, jargon title## When testing → prefix OK, but only 1 content word## How encode → must be How to, not bare HowCorrect pattern examples:
## When choosing review gate — situation at decision point## How to encode file paths — procedural knowledge## When haiku rationalizes test failures — specific behavioral patternTitles become /when and /how triggers mechanically — name after the activity at the decision point, not the outcome or jargon.
Keep in staging (do not consolidate):
Consolidate:
Drop (remove from staging):
Commit: Update [file]: [what]\n\n- [change 1]\n- [change 2]\n- [rationale]
Handoff (if session.md): Note update, explain significance, reference commit
For guidance on tiering, budgeting, and maintaining rules in CLAUDE.md, see references/rule-management.md.
For detailed usage patterns (error handling, workflow improvement, design decisions, pending learnings), see examples/codify-patterns.md.
tools
Manage git worktrees for parallel task execution. Triggers on "create a worktree", "set up parallel work", "merge a worktree", "branch off a task", or uses the `wt`, `wt merge`, or `wt-rm` shortcuts. Worktree lifecycle: creation, focused sessions, merge ceremony, cleanup, parallel task setup.
testing
Recall behavioral knowledge from project decisions. Triggers on "when to do X", situational patterns, or decision content for recognized situations. Invoke with "/when <trigger>".
tools
Sync edify fragments and portable justfile to match the current plugin version. Detects user-edited files and warns instead of overwriting. Use --force to overwrite conflicts.
testing
Write compact bash scripts using exec tracing pattern. Triggers when writing bash scripts with 3+ sequential commands. The exec 2>&1 + set -xeuo pipefail pattern eliminates echo statements via automatic command tracing, reducing script size by 40-60%.