agentleFS
GAN-ThinkingGAN-Thinking/gan-skill/.claude/skills/evolve/SKILL.md

evolve

Skill15 starsChanged 8 months agoMITView on GitHub

AutoResearch-inspired self-evolution loop for ANY Claude Code skill. Finds flaws, fixes them, benchmarks against a diverse prompt pool (anti-overfitting), and uses blind A/B judging. Fully automated — no human input needed during the loop.

41 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use instinct-export, instinct-import and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • TheKREATORSSkill

    instinct-export

    Export instincts from project/global scope to a file

    Also in 4 projects that use this

  • TheKREATORSSkill

    instinct-import

    Import instincts from file or URL into project/global scope

    Also in 4 projects that use this

  • AWSSkill

    map

    Map verified service capabilities against customer-provided control framework and threat model. Produces mapping-results.json, controls-catalog.md, and framework-mapping.md. Supports pluggable frameworks: CCMv4, NIST 800-53, CIS Benchmarks, ISO 27001, etc. Split into 4 focused sub-skills for better accuracy; this skill orchestrates them.

    Also in 5 projects that use this

  • diego-tobalinaSkill

    build-fix

    Fix build and compilation errors systematically. Run when build fails.

    Also in 3 projects that use this

  • launch52-aiSkill

    skill-create

    Create and validate Claude Code skills with proper structure, checklists, and validation scripts. Use when creating a new skill, auditing existing skills, or ensuring skills meet quality standards. Generates complete skill scaffolds with SKILL.md, check scripts, guides, and templates.

    Also in 3 projects that use this

  • qtzx06Skill

    eval

    Evaluate trained YOLO model accuracy with mAP metrics and per-class error analysis. Identifies failure cases for targeted improvement. Use after training.

    Also in 5 projects that use this

  • +1 more from TheKREATORS

The file

Show its rules and text

We split this skill into the rules it gives an agent

21 rules. 0 are common, 13 are distinctive, and 8 are very specific to this project.

  • 0

    Common

    Most of the 36 edited versions we read keep these.

  • 13

    Distinctive

    This author's own choices. Worth a look.

  • 8

    Very specific

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

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

    No skill specified: Look for SKILL.md in the current working directory.

    line 21
  2. Very specific:

    overnight: Run 20 rounds, then stop and report.

    line 25
  3. Distinctive:

    No number specified: Run 1 round.

    line 26
  4. Distinctive:

    Read its content completely.

    line 41
  5. Very specific:

    If evolve-benchmark.md already exists, read and reuse it (don't regenerate).

    line 76
  6. Very specific:

    Read the current SKILL.md content.

    line 84
  7. Distinctive:

    Read the Critic's output. If SEVERITY >= 2, apply the fix:

    line 117
  8. Very specific:

    Use the Edit tool to make ONE targeted change to SKILL.md

    line 118
  9. Distinctive:

    Do NOT rewrite large sections or add unrelated improvements

    line 120
  10. Distinctive:

    If SEVERITY = 1, skip this round (log as "skipped: too minor") and move to next round.

    line 122
  11. Distinctive:

    Run the selected benchmark prompt through both old and new versions by launching 2 Agent subagents in parallel:

    line 130
  12. Distinctive:

    If a compliance FAIL forced the result, note it.

    line 181
  13. Distinctive:

    If new version wins → KEEP.

    line 182
  14. Very specific:

    If old version wins → REVERT.

    line 183
  15. Distinctive:

    If the file doesn't exist, create it with the header row first.

    line 193
  16. Distinctive:

    After all rounds complete, output a summary:

    line 197
  17. Distinctive:

    ONE change per round: Never batch multiple fixes.

    line 221
  18. Distinctive:

    Rotate benchmarks: Never use the same benchmark prompt twice in a row.

    line 222
  19. Distinctive:

    Judge uses forced choice, not scoring: No points, no scales. Just "A or B."

    line 225
  20. Very specific:

    Never modify this file (evolve SKILL.md): Only modify the target skill's SKILL.md.

    line 227
  21. Very specific:

    Git commit after each KEPT change: if in a git repo. Format: evolve([skill-name]): [description].

    line 228

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

/evolve — Skill Self-Evolution Loop

You are the Evolution Controller. Your job is to run an automated improvement loop on any Claude Code SKILL.md, inspired by Karpathy's AutoResearch framework.

Core principle: One change at a time. Measure before and after. Keep if better, revert if not. Fully automated — no human input during the loop.

Step 0: Parse Arguments

Scan $ARGUMENTS for:

Target Skill

  • A skill name (e.g., gan, discuss, review): Look for ~/.claude/skills/<name>/SKILL.md then .claude/skills/<name>/SKILL.md
  • A file path (e.g., ./SKILL.md, ~/my-skill/SKILL.md): Use directly
  • No skill specified: Look for SKILL.md in the current working directory. If not found, tell the user and stop.

Round Count

  • A number N (e.g., 5, 10): Run N rounds sequentially.
  • overnight: Run 20 rounds, then stop and report.
  • No number specified: Run 1 round.

Examples

/evolve                    → evolve ./SKILL.md, 1 round
/evolve gan                → evolve /gan skill, 1 round
/evolve gan 5              → evolve /gan skill, 5 rounds
/evolve discuss 3          → evolve /discuss skill, 3 rounds
/evolve ./my-skill/SKILL.md 10  → evolve specific file, 10 rounds
/evolve gan overnight      → evolve /gan skill, 20 rounds

Step 1: Locate and Analyze the Target Skill

  1. Find the SKILL.md file based on the parsed target.
  2. Read its content completely.
  3. Understand the skill's purpose by reading its name, description, and instructions.
  4. Locate or create evolve-results.tsv in the working directory for logging.

Step 2: Generate Benchmark Pool (Anti-Overfitting)

CRITICAL: Do NOT use a single benchmark prompt. A single prompt causes overfitting — the skill gets optimized for one scenario while degrading on others.

On the first round, generate a pool of 3 diverse benchmark prompts that cover different use cases of the skill. Save them to evolve-benchmark.md.

Rules for benchmark pool:

  • Each prompt must exercise a DIFFERENT aspect of the skill
  • Prompts should vary in: topic domain, complexity, and specificity
  • Each round, randomly pick 1 prompt from the pool to benchmark against
  • Over N rounds, different prompts get used, preventing overfitting to any single one

Example pool for /gan:

1. "I want to build a SaaS that auto-generates API documentation from source code"
   (tech/SaaS — tests market analysis capability)

2. "Should I quit my stable job to become a full-time indie developer? I have 18 months of savings."
   (life decision — tests non-business, personal advice capability)

3. "Our team is debating whether to rewrite our monolith in microservices"
   (technical architecture — tests code/engineering critique capability)

Example pool for /review:

1. [A Python function with a subtle off-by-one error]
2. [A SQL query with a potential injection vulnerability]
3. [A React component with a performance anti-pattern]

If evolve-benchmark.md already exists, read and reuse it (don't regenerate).

Step 3: The Evolution Loop

For each round:

3a. Read Current State

Read the current SKILL.md content. Save a copy as the "old version" for potential revert.

3b. Find a Flaw (Critic Phase)

Launch 1 Agent subagent as a Skill Critic:

You are a Skill Design Critic. Read this SKILL.md for a Claude Code skill called [SKILL_NAME].

The skill's purpose: [SKILL_DESCRIPTION]

Your job: find ONE specific, actionable flaw in the skill's design. Not vague ("could be better") — specific (e.g., "the parsing section doesn't handle the case where...").

Categories to examine:
- Argument parsing edge cases
- Logic gaps in the skill's workflow
- Output structure issues
- Missing instructions that cause bad output quality
- Prompt engineering weaknesses (vague instructions, missing constraints)
- User experience friction

[IF PREVIOUS FLAWS EXIST]: These flaws have ALREADY been found and fixed. Do NOT report them again:
[LIST OF PREVIOUS FLAWS]

Return EXACTLY this format:
FLAW: [one sentence describing the specific flaw]
CATEGORY: [one of: parsing, logic, structure, quality, prompt, ux]
SEVERITY: [1-5, where 5 = causes wrong behavior, 1 = minor polish]
FIX: [one sentence describing the proposed fix]

3c. Apply the Fix

Read the Critic's output. If SEVERITY >= 2, apply the fix:

  • Use the Edit tool to make ONE targeted change to SKILL.md
  • The change should be minimal — modify only what's needed to address the flaw
  • Do NOT rewrite large sections or add unrelated improvements

If SEVERITY = 1, skip this round (log as "skipped: too minor") and move to next round.

3d. Select Benchmark

Randomly pick 1 prompt from the benchmark pool for this round. Use a different one than the last round if possible (rotate through the pool).

3e. Benchmark — Before & After

Run the selected benchmark prompt through both old and new versions by launching 2 Agent subagents in parallel:

You are testing a Claude Code skill called [SKILL_NAME]. Act as if this skill's instructions are your operating guide.

SKILL INSTRUCTIONS:
[INSERT SKILL.MD CONTENT — version A or version B]

Now execute the following task according to the skill's instructions:
[SELECTED BENCHMARK PROMPT]

Produce your output following the skill's instructions exactly.

CRITICAL for anti-bias: Randomly assign which version is "A" and which is "B". Do NOT always put old first. Record the mapping but do not tell the Judge.

3f. Judge (Blind A/B)

Launch 1 Agent subagent as a Judge:

You are a Judge comparing two outputs from a Claude Code skill called [SKILL_NAME]. Both were given the same task.

The skill's purpose: [SKILL_DESCRIPTION]

Version A output:
[output A]

Version B output:
[output B]

Step 1 — Instruction compliance:
Does each version follow the skill's stated output format and rules?
Version A compliance: PASS / FAIL
Version B compliance: PASS / FAIL
If one FAILS and the other PASSES → the PASS version wins. Skip to verdict.

Step 2 — Forced choice:
You MUST pick one. No ties allowed.
Which version better achieves the skill's purpose? A or B?

Return EXACTLY this format:
A_COMPLIANCE: PASS or FAIL
B_COMPLIANCE: PASS or FAIL
WINNER: A or B
REASON: [one sentence why]

3g. Keep or Revert

  1. Map the Judge's winner (A or B) back to old/new using your recorded mapping.
  2. If a compliance FAIL forced the result, note it.
  3. If new version wins → KEEP. The edit stays.
  4. If old version wins → REVERT. Re-write the old SKILL.md content.

3h. Log Results

Append a line to evolve-results.tsv:

round	skill	benchmark	flaw	category	severity	verdict	reason

If the file doesn't exist, create it with the header row first.

Step 4: Report

After all rounds complete, output a summary:

## 🧬 Evolution Report — [SKILL_NAME]

Rounds: N
Kept: X improvements
Reverted: Y attempts
Skipped: Z (too minor)

Benchmark coverage: [which prompts were used, how many times each]

### Changes
Round 1: ✅ KEEP — [flaw] (benchmark: prompt #2)
Round 2: ❌ REVERT — [flaw] (benchmark: prompt #1)
Round 3: ⏭️ SKIP — severity 1

### Kept Changes
1. [description]
2. [description]

Important Rules

  1. ONE change per round. Never batch multiple fixes.
  2. Rotate benchmarks. Never use the same benchmark prompt twice in a row.
  3. Blind judging. Judge never knows which is old vs new. Random A/B assignment.
  4. No human input during the loop. Fully automated. Report at the end.
  5. Judge uses forced choice, not scoring. No points, no scales. Just "A or B."
  6. Revert is not failure. Log it and move on.
  7. Never modify this file (evolve SKILL.md). Only modify the target skill's SKILL.md.
  8. Git commit after each KEPT change if in a git repo. Format: evolve([skill-name]): [description].
  9. Track previous flaws. Pass the list to Critic to avoid repeats.

Output Language

Match the user's language. Default to the project's CLAUDE.md setting.

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.