agentleFS
dafaalzdafaalz/agent-skills/skills/reflect-to-skill/SKILL.md

reflect-to-skill

Skill2 starsChanged 53 days agoMITView on GitHub

Use when reflecting on conversation sessions, analyzing failure modes, bugs, or user corrections, and grafting preventive rules into agent skills to prevent recurrence. Don't use for generic session summaries without skill updates (use summarize), application code debugging (use systematic-debugging), or writing end-user documentation (use technical-writing).

  • Deletes or force-pushes

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 4 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    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
  1. Very specific:

    Before writing to any skill file, write .agents/state/reflect-to-skill/<target>-before.md containing the original content verbatim for full …

    line 17
  2. Distinctive:

    Follow these four steps in sequence.

    line 28
  3. Distinctive:

    Verify anti-slop compliance.

    line 67
  4. Very specific:

    Write .agents/state/reflect-to-skill/<target>-before.md with original file content.

    line 78
  5. Very specific:

    Write .agents/state/reflect-to-skill/<target>-proposed.md with updated content.

    line 79
  6. Distinctive:

    Keep code fences, backticked tokens, and syntax samples exact.

    line 106
  7. Distinctive:

    Run this check before finishing any reflection task:

    line 110

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “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

Reflect to skill

Distill failures, regressions, and user corrections from completed agent sessions into sharp, permanent rules across relevant agent skills.

Overview

When an agent stumbles on a bug, generates an unintended UI defect, or receives course corrections from the user, the incident provides the exact failure envelope needed to harden instructions. This skill extracts those mechanics and grafts concrete invariants into existing or new skills so subsequent sessions never repeat the error.

<HARD-GATE> Write-Target Boundary. Modify only `skills/<target>/SKILL.md` and `skills/<target>/references/*.md` in Author mode, and only after the user has reviewed the exact diff in `.agents/state/reflect-to-skill/<target>-diff.txt` and confirmed the graft. Writes under `.agents/state/reflect-to-skill/` are always permitted. Do not modify application source code, test suites, database schemas, or package lockfiles. Never graft a rule whose target skill was selected by heuristic alone without user confirmation.

Before writing to any skill file, write .agents/state/reflect-to-skill/<target>-before.md containing the original content verbatim for full reversibility via git restore --worktree --staged -- skills/<target>/SKILL.md plus git clean -fd skills/<target>/references/. </HARD-GATE>

Modes

Declare the active operating mode before executing any steps:

  • Author mode (default): Analyze session failures, propose diffs, obtain explicit user confirmation, and apply verified patches to target skills. Run Steps 1 through 4 sequentially.
  • Audit mode: Analyze session failures and output proposed skill patches to .agents/state/reflect-to-skill/proposed-patches.md without mutating skill files. Run Steps 1 through 3 only and halt.

Workflow

Follow these four steps in sequence.

Step 1. Session failure extraction and evidence logging

Inspect conversation logs, user interventions, error logs, and git diffs to isolate concrete defects:

  1. Locate user interventions and course corrections. Identify where the user flagged broken output or sent visual evidence of distorted UI.
  2. If the user or an auditor reports a defect in text attributed to disk (skill file, plan, documentation), run git log -S "<exact string>" -- <path> before accepting or rejecting the report. If git log -S returns empty, the string never existed on disk and the report is paste-fidelity divergence, not a disk defect. Record the result in .agents/state/reflect-to-skill/disambiguation.json with finding_id, string_searched, git_log_exit_code, commit_hits, and verdict: disk-defect | paste-divergence | no-match.
  3. Cross-reference with git history and terminal output to capture the exact broken code snippet, failing test, or visual artifact.
  4. Categorize the defect into one structural failure class: syntax or runtime bug, styling or rendering artifact, execution or motion defect, or verification gap.

Completion criterion. .agents/state/reflect-to-skill/incident-log.json exists on disk recording each defect with its user trigger, broken snippet, and operational failure category.

Step 2. Root cause mapping and skill routing

Trace each defect to the governing skill using deterministic lookup.

DomainGoverning skill
CSS rendering, typography, tokens, layoutfrontend-design
Transitions, keyframes, physics, reduced motionui-motion
Heuristics, accessibility, forms, tap targetsui-ux-review
Backend Eloquent, controllers, artisan commandslaravel
Verification procedures and test patternsverification-before-completion or testing-patterns
Agent instructions, prompts, skill documentationwriting-for-agents
User-facing prose and anti-slop reviewunslop
Human documentation, README, RFCtechnical-writing
  1. Identify the governing skill domain from the table.
  2. Inspect the governing skill using view_file. Audit why the failure occurred: missing invariant, vague completion criterion, or missing anti-pattern entry.
  3. Record target resolution. Require user confirmation if domain routing is ambiguous.

Completion criterion. .agents/state/reflect-to-skill/target-resolution.json exists on disk with target_skill, target_section, and resolution_source.

Step 3. Sharp rule synthesis

Draft rules using the standards from writing-for-agents and unslop:

  1. Apply positive framing and leading words. Pair every negative prohibition with an immediate required action on the same line.
  2. Structure anti-pattern additions using the standard schema: ID, Title, Pattern description, Why it fails, Concrete fix. Consult references/grafting-recipes.md for copy-paste templates when adding invariants and anti-pattern entries.
  3. Enforce mechanical grounding. Specify exact CSS classes, attribute names, thresholds, or API patterns rather than general advice.
  4. Verify anti-slop compliance. Require zero em dashes, zero en dashes, sentence case headings, active verbs, and zero conversational filler.

Completion criterion. Written candidate patch snippets drafted for every diagnosed failure, saved to .agents/state/reflect-to-skill/proposed-patches.md.

Step 4. Budget check, two-phase grafting, and verification

Graft candidate rules into target skills using a two-phase write protocol.

Phase 1. Propose

  1. Confirm main SKILL.md remains strictly under 250 lines. Move extended catalogues into references/ if budget requires.
  2. Write .agents/state/reflect-to-skill/<target>-before.md with original file content.
  3. Write .agents/state/reflect-to-skill/<target>-proposed.md with updated content.
  4. Generate the diff: diff -u .agents/state/reflect-to-skill/<target>-before.md .agents/state/reflect-to-skill/<target>-proposed.md > .agents/state/reflect-to-skill/<target>-diff.txt.

Phase 2. Apply and verify

  1. On explicit user confirmation, apply the diff to skills/<target>/SKILL.md.
  2. Run python3 skills/review-a-skill/scripts/lint_skill.py skills/<target>.
  3. Record the outcome in .agents/state/reflect-to-skill/<target>-verification.json with lint_exit_code and the rollback command.

Completion criterion. Target skill updated, lint_skill.py exits with status code 0, line count verified under 250 lines, and .agents/state/reflect-to-skill/<target>-verification.json exists on disk.

Anti-patterns

IDTitlePattern descriptionWhy it failsConcrete fix
RTS-1Vague rule graftAdds "Be more careful" or "Always check layout" without triggerAgent cannot act on instruction and failure recursSpecify exact prohibited action and concrete permitted alternative
RTS-2Unbounded growthGrafts rules without pruning until skill exceeds 250 linesContext budget blowout degrades model complianceMove extended catalogues and recipes into references/
RTS-3Redundant skill creationCreates a new skill instead of patching existing governing skillFragments discovery and duplicates rules across repoGraft into the existing domain skill
RTS-4Unpaired prohibitionAdds "Never do X" without specifying permitted alternativeParalyzes agent when edge case demands actionPair every prohibition with an immediate required alternative
RTS-5Heuristic routingSelects target skill by keyword match without verificationRules land in wrong skills and remain undiscoveredConfirm target path via explicit lookup or user decision
RTS-6Unsandboxed mutationOverwrites skill files directly without backup or diff previewCorrupts governing skills for subsequent sessionsEnforce two-phase propose/diff/confirm protocol with rollback
RTS-7Validator conflict of interestEdits skills/review-a-skill/scripts/lint_skill.py or test harness during reflection to make newly grafted rules passRule passes linter validation because validator was weakened, not because rule is correctValidator changes require a separate commit with [validator] subject suffix and self-test fixtures as specified in verification-before-completion

Boundary isolation

Execute skill grafting exclusively on skill directories (such as skills/ or .agents/skills/). Never alter application project files, database migrations, or test files during a skill reflection run.

Keep code fences, backticked tokens, and syntax samples exact. Apply prose rules only to explanatory instructions.

Quick audit checklist

Run this check before finishing any reflection task:

CheckPassing condition
Evidence groundedEvery drafted rule links directly to a concrete bug or user correction from session
Routing verifiedCorrect governing skill identified via explicit lookup and recorded in JSON
Budget maintainedMain SKILL.md of target skills remains strictly under 250 lines
Sharp framingEvery prohibition paired with an explicit positive action on the same line
Anti-slop cleanZero em dashes, zero en dashes, sentence case headings, and active voice
Anti-patternsAnti-pattern table adheres to 5-column schema with stable IDs
Two-phase protocolBackup taken, diff generated, user confirmed, and linter verified

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.