agentleFS
ArangoGutierrezArangoGutierrez/claude-toolkit/.claude/skills/reflection/SKILL.md

reflection

Skill4 starsChanged 3 months agoMITView on GitHub

Analyze session patterns, capture mistakes, curate rules. Unified learning loop. Triggered by "analyze session", "what did I learn", "improve CLAUDE.md", or /reflection

We split this skill into the rules it gives an agent

13 rules. 0 are common, 6 are distinctive, and 7 are very specific to this project.

  • 0

    Common

    Most of the 6 edited versions we read keep these.

  • 6

    Distinctive

    This author's own choices. Worth a look.

  • 7

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Run scripts/analyze-sessions.sh to aggregate recent activity

    line 21
  2. Distinctive:

    When user says "I keep making this mistake" or describes a recurring error:

    line 27
  3. Very specific:

    Check rules/learned-anti-patterns.md for duplicates

    line 30
  4. Very specific:

    Check audit/.anti-patterns.lock before writing

    line 33
  5. Distinctive:

    Check rules/ for staleness (specific versions, untriggered in 90 days)

    line 40
  6. Very specific:

    Update audit/.last-reflection with today's date when complete

    line 41
  7. Very specific:

    Run scripts/promotion-candidates.sh to list entries with Count >= 3 not yet marked | Promoted:.

    line 44
  8. Very specific:

    Before writing to rules/learned-anti-patterns.md:

    line 69
  9. Very specific:

    If audit/.anti-patterns.lock exists → blocked (team-execute QA is writing)

    line 70
  10. Distinctive:

    Don't remove rules that haven't been tested

    line 75
  11. Distinctive:

    Don't add rules already covered by hooks

    line 76
  12. Distinctive:

    Don't treat one-off errors as patterns (require Count >= 2)

    line 77
  13. Distinctive:

    Don't propose rules that are generic software engineering

    line 78

“Common” is measured: kept by at least 6 in 10 of the 6 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Reflection — Unified Learning Loop

Three modes based on context:

Mode 1: Session Analysis

Reads audit/bash-commands-*.log for patterns and recent git log.

  1. Run scripts/analyze-sessions.sh to aggregate recent activity
  2. Identify: repeated errors, permission blocks, hook violations, time sinks
  3. Summarize: files touched, patterns observed, recurring issues
  4. Propose: specific improvements to CLAUDE.md or rules/

Mode 2: Mistake Capture

When user says "I keep making this mistake" or describes a recurring error:

  1. Prompt for: context, mistake, correction, severity (critical/warning/info), tags
  2. Check rules/learned-anti-patterns.md for duplicates
  3. Duplicate → increment Count, update Since date
  4. New → append: - **Pattern**: <desc> | **Fix**: <fix> | **Severity**: <level> | **Tags**: <tags> | **Count**: 1 | **Since**: YYYY-MM-DD
  5. Check audit/.anti-patterns.lock before writing

Mode 3: Rules Curation

  1. Prune learned-anti-patterns.md per severity rules:
    • critical: never auto-pruned
    • warning: prune when Count < 2 AND Since > 90 days
    • info: prune by lowest count when over 50-line cap
  2. Check rules/ for staleness (specific versions, untriggered in 90 days)
  3. Update audit/.last-reflection with today's date when complete

Pattern Promotion

Run scripts/promotion-candidates.sh to list entries with Count >= 3 not yet marked | **Promoted**:. For each candidate:

Mechanical branch — pattern is expressible as regex / AST grep / exit-code (no model reasoning needed):

  • Propose a regex in hooks/test-quality-lint.sh (test patterns), or
  • A check in an existing hook (code patterns), or
  • A new line in rules/ (convention patterns).

Behavioral branch — pattern needs judgment (not mechanically detectable). Propose promotion using this taxonomy:

  • Repeatable, user-invoked sequence → command (commands/<name>.md)
  • Auto-triggered behavior / style enforcement → skill (skills/<name>/SKILL.md)
  • Complex, multi-step process needing isolation → agent (agents/<name>.md)

Propose only. After user approval, create the artifact and append | **Promoted**: <artifact> to the anti-pattern entry.

Scoping

  • Project-specific pattern → repo .claude/rules/learned-anti-patterns.md.
  • Universal pattern → global ~/.claude/rules/learned-anti-patterns.md.
  • On duplicate pattern text, project overrides global (dedup is by pattern text, not ID). Global edits reach ~/.claude via scripts/deploy.sh (repo root).

Write Safety

Before writing to rules/learned-anti-patterns.md:

  • If audit/.anti-patterns.lock exists → blocked (team-execute QA is writing)

All changes require user approval before writing.

Gotchas

  • Don't remove rules that haven't been tested
  • Don't add rules already covered by hooks
  • Don't treat one-off errors as patterns (require Count >= 2)
  • Don't propose rules that are generic software engineering

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.