generate
Refines CLAUDE.md through iterative agent-led stress testing.
Install
mkdir -p .claude/skills/generate-gonzaloetjo && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/11553" && unzip -o skill.zip -d .claude/skills/generate-gonzaloetjo && rm skill.zipInstalls to .claude/skills/generate-gonzaloetjo
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Iteratively refines an existing CLAUDE.md file using stress-test refinement with sequential agents. Spawns a fresh agent for each iteration — each gets a clean context window. Requires an existing CLAUDE.md (run /init first). Run /setup-claude-md:configure to set options.Key capabilities
- →Orchestrate iterative refinement of an existing CLAUDE.md file
- →Spawn fresh agents for each refinement iteration
- →Manage setup, agent spawning, and interaction gates
- →Synthesize a one-sentence repository summary
- →Generate a final summary of the CLAUDE.md generation process
How it works
The skill orchestrates a series of agents, each inventing a development task, planning against the current CLAUDE.md, discovering missing information, and feeding learnings back for iterative refinement.
Inputs & outputs
When to use generate
- →Refining documentation
- →Stress-testing project rules
- →Updating agent guidelines
About this skill
Generate CLAUDE.md — Iterative Stress-Test Refinement
You are the orchestrator for CLAUDE.md generation. You coordinate iterative refinement by spawning a fresh agent for each iteration. Each agent invents a realistic development task, plans it against the current CLAUDE.md, discovers what information is missing, and feeds those learnings back in.
You never do iteration work yourself. You handle setup, agent spawning, interaction gates, and the final summary. The agents do the analytical work.
Prerequisite: A CLAUDE.md must already exist in the project root (e.g., from /init or manual creation). This skill refines an existing CLAUDE.md — it does not generate one from scratch.
Phase 0: Setup
-
Parse arguments. Check
$ARGUMENTSfor an iteration count override (e.g.,/setup-claude-md:generate 3). If not provided, fall back to config, then default to 5. -
Load config. Use
Globto check for.claude-md-config.jsonin the project root. If found,Readit and extract settings:iterations(default: 5)interaction_mode(default:confirm-base)focus_areas(default:all)max_lines(default: 150)generate_rules(default: false)
-
Check for resume state. Use
Globto check for.claude-md-generator-state.jsonin the project root. If found:Readit and extract the state (phase, completed_iterations, config, repo_summary, archetypes_used)- Use
AskUserQuestionto ask: "Found state from a previous run ({completed_iterations}/{total_iterations} iterations completed). Resume from where it left off, or start fresh?" Options: "Resume", "Start fresh" - If "Resume": skip to Phase 1–N, starting from iteration
completed_iterations + 1, using the saved config and repo_summary - If "Start fresh": delete the state file and logs directory, continue from step 5
-
Load quality standards.
Readthe filereferences/claude-md-standards.md(relative to this skill file). Keep these criteria in mind throughout. -
Require CLAUDE.md. Use
Globto findCLAUDE.mdin the project root. If it does NOT exist: tell the user "No CLAUDE.md found. Run/initfirst to create a base, then re-run/setup-claude-md:generate." and STOP. -
Read & synthesize repo summary.
Readthe existing CLAUDE.md. Synthesize a one-sentencerepo_summaryfrom its content (tech stack, project type, key directories). Example: "TypeScript/React app using Vite, pnpm, Vitest. Dirs: src/, tests/, docs/." -
Write state file. Write the initial state:
{
"phase": "iterating",
"total_iterations": <iterations>,
"completed_iterations": 0,
"archetypes_used": [],
"config": {
"interaction_mode": "<interaction_mode>",
"focus_areas": "<focus_areas>",
"max_lines": <max_lines>,
"generate_rules": <generate_rules>
},
"repo_summary": "<repo_summary>"
}
Write this to .claude-md-generator-state.json in the project root. Also create the .claude-md-generator-logs/ directory using Bash with mkdir -p.
- Interaction gate. Check the
interaction_modesetting:- If
confirm-baseorconfirm-each: Present the existing CLAUDE.md to the user usingAskUserQuestion. Ask: "I'll refine this CLAUDE.md through {N} iterations of stress-testing. Proceed?" Provide options: "Looks good, proceed", "I have feedback" (let them type). - If
autonomous: Continue without stopping.
- If
Phase 1–N: The Iteration Loop
For each iteration i from 1 to iterations (or from completed_iterations + 1 if resuming):
Announce: "Iteration {i}/{total} — {archetype_name}"
Step 1.1 — Determine Archetype
Select archetype number ((i - 1) % 10) + 1 from the archetypes list. If the repo has fewer than 5 source files, skip archetypes 8, 9, 10 and use ((i - 1) % 7) + 1.
Look up the archetype name and template text from references/task-archetypes.md.
Step 1.2 — Determine Complexity Guidance
- Iterations 1–2: "Single-module scope. Task touches 1–2 files."
- Iterations 3–4 (or 3–5): "Multi-file scope. Task spans 3–5 files across 2+ directories."
- Iterations 5+ (or 6+): "Cross-cutting scope. Task affects a subsystem or requires coordinated changes."
Step 1.3 — Construct Agent Prompt
Read the file references/iteration-prompt.md (relative to this skill file). Fill in all {placeholder} values:
{iteration}— current iteration number{total}— total iterations{archetype_name}— name from Step 1.1 (e.g., "Bug Fix (Low Complexity)"){archetype_template}— template and example text from the archetypes file for this archetype{complexity_guidance}— from Step 1.2{claude_md_path}— absolute path to the project's CLAUDE.md{standards_path}— absolute path toreferences/claude-md-standards.md{archetypes_path}— absolute path toreferences/task-archetypes.md{log_path}— absolute path to.claude-md-generator-logs/iteration-{i}.md{focus_areas}— from config{max_lines}— from config{generate_rules}— from config{repo_summary}— from state file
Step 1.4 — Spawn Iteration Agent
Spawn the agent using the Task tool:
Task(
subagent_type: "general-purpose",
description: "Refinement iteration {i}",
prompt: <the constructed prompt from Step 1.3>
)
Step 1.5 — Post-Iteration Bookkeeping
After the agent completes:
Readthe iteration log at.claude-md-generator-logs/iteration-{i}.md- Update the state file: increment
completed_iterations, append the archetype name toarchetypes_used - Write the updated state file
Step 1.6 — Interaction Gate
If interaction_mode is confirm-each:
- Show the user the iteration log (invented task, frustration log, learnings, changes made)
- Use
AskUserQuestion: "Here are the changes from iteration {i}. Accept, modify, or skip?" Options: "Accept changes", "Skip these changes", "I have feedback" - If "Skip these changes": revert CLAUDE.md to the version before this iteration (re-read the previous version from iteration
i-1's log or the original ifi == 1)
Phase 2: Review Agent
Spawn a final review agent using the Task tool:
Task(
subagent_type: "general-purpose",
description: "Final CLAUDE.md review",
prompt: <final review prompt below>
)
The final review prompt (construct inline):
You are a CLAUDE.md reviewer. Read the CLAUDE.md at {claude_md_path} and perform a final quality pass.
Read the quality standards at {standards_path}.
1. Apply the removal test to every line: "If I deleted this line, would Claude make a concrete mistake on a real development task?" Remove anything that fails.
2. Verify formatting: ## headers for sections, bullet lists, fenced code blocks for commands, no trailing whitespace or double blank lines.
3. Spot-check 1–2 documented commands by running them via Bash. If a command fails, fix or annotate it.
4. Write the final CLAUDE.md to {claude_md_path}.
Phase 3: Cleanup
- Delete
.claude-md-generator-state.jsonusingBashwithrm. - Delete
.claude-md-generator-logs/directory usingBashwithrm -rf. - Present the summary:
CLAUDE.md generation complete.
Iterations run: {count}
Archetypes used: {list of archetype names}
Sections: {list of section names from final CLAUDE.md}
Final line count: {count}
If generate_rules was enabled, also list:
Generated rule files:
- .claude/rules/{topic1}.md
- .claude/rules/{topic2}.md
- Show the final CLAUDE.md content —
Readthe final CLAUDE.md and display it to the user so they can see exactly what was generated without having to open the file themselves.
Important Reminders
- NEVER execute invented tasks. Agents only plan them to find gaps.
- NEVER include information Claude can get from reading code. The CLAUDE.md is for things that AREN'T in the code.
- Be ruthless about pruning. A short, dense CLAUDE.md is far more valuable than a long, padded one.
- Each iteration should discover NEW information. If an agent finds nothing new, that's a signal you may have enough iterations.
- Reference real files. Every task agents invent must reference actual files and modules in the repository.
When not to use it
- →When generating a CLAUDE.md file from scratch
- →When the task is to execute invented development tasks
- →When the task is to include information Claude can get from reading code
Prerequisites
Limitations
- →Requires an existing CLAUDE.md file; it does not generate one from scratch.
- →The orchestrator agent never performs iteration work itself.
- →Agents only plan invented tasks to find gaps, they never execute them.
How it compares
This skill uses a sequential agent approach for stress-test refinement of CLAUDE.md, iteratively improving it based on simulated development tasks, unlike manual review or single-pass generation.
Compared to similar skills
generate side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| generate (this skill) | 0 | 5mo | No flags | Advanced |
| notion-knowledge-capture | 10 | 9mo | No flags | Intermediate |
| feishu-doc | 14 | 5mo | No flags | Intermediate |
| openspec-continue-change | 4 | 6mo | Review | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
You might also like
notion-knowledge-capture
makenotion
Transforms conversations and discussions into structured documentation pages in Notion. Captures insights, decisions, and knowledge from chat context, formats appropriately, and saves to wikis or databases with proper organization and linking for easy discovery.
feishu-doc
openclaw
Feishu document read/write operations. Activate when user mentions Feishu docs, cloud docs, or docx links.
openspec-continue-change
studyzy
通过创建下一个产出物继续处理 OpenSpec 变更。当用户想要推进其变更、创建下一个产出物或继续其工作流程时使用。
kimi-cli-help
MoonshotAI
Answer Kimi Code CLI usage, configuration, and troubleshooting questions. Use when user asks about Kimi Code CLI installation, setup, configuration, slash commands, keyboard shortcuts, MCP integration, providers, environment variables, how something works internally, or any questions about Kimi Code CLI itself.
openspec-archive-change
studyzy
归档实验性工作流中已完成的变更。当用户想要在实现完成后最终确定并归档变更时使用。
feishu-perm
m1heng
Feishu permission management for documents and files. Activate when user mentions sharing, permissions, collaborators.