/agent-md-gen:claude-md-genfrom agent-md-gen
Generate project-specific CLAUDE.md with domain instructions, workflows, templates. Analyzes codebase, asks clarifying questions, produces tailored instructions.
Ships in agent-md-gen. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Generate project-specific CLAUDE.md files through codebase analysis, targeted questions, and pattern selection.
Read them from the user's request: an optional project path (default: the current directory) and an optional --type cli-tool|web-app|python-cli|research|api-service|library|mixed (default: auto-detect).
Where this skill says AskUserQuestion and the agent has no such tool, ask the same questions in chat and wait for the answers.
Five-phase generation process:
Analyze codebase to determine project type:
DETECTION RULES:
research-knowledge:
IF content/ OR findings/ exists
IF PARA folders detected (0_Inbox, 1_Projects, 2_Areas, 3_Resources, 4_Archives)
IF .md files > 10 in root/subdirs
→ research-knowledge
python-cli:
IF pyproject.toml exists
IF click OR typer imports in main file
IF [tool.poetry] OR [tool.pdm] section
IF tests/ with pytest
→ python-cli
web-app:
IF package.json + astro.config.* exists
IF package.json + src/components/ + public/
IF package.json + vite.config OR webpack.config
→ web-app
cli-tool:
IF go.mod + cmd/ + main.go
IF Cargo.toml + src/main.rs + clap dependency
IF package.json + #!/usr/bin/env node in files
→ cli-tool
api-service:
IF go.mod + cmd/ + internal/ + (gin|echo|chi imports)
IF package.json + express|fastify|nest imports
IF pyproject.toml + (fastapi|flask) dependency
→ api-service
library:
IF lib/ exists AND no cmd/ or bin/
IF package.json + "main" field but no bin/
IF Cargo.toml with [lib] section
→ library
mixed:
IF multiple indicators (api + frontend, cli + lib)
→ mixed
FALLBACK:
IF ambiguous → ask user to select
Gather for template customization:
From package files:
From directory structure:
From existing files:
Analysis steps:
package.json, pyproject.toml, go.mod, Cargo.tomlls -la + glob for key directoriesStore context:
project_context = {
"name": from directory or package file,
"type": detected type,
"languages": {lang: version},
"frameworks": {framework: version},
"testing": framework name,
"linting": [linter names],
"dependency_mgmt": tool name,
"directories": {path: purpose},
"commands": {task: command},
"hooks": [hook names],
"existing_claude_md": sections to preserve
}
Load question framework from questions/{detected-type}-questions.md.
Ask 5-7 questions via AskUserQuestion tool based on project type.
Question categories:
For mixed projects: Combine questions from component types (max 7 total).
Store answers:
user_answers = {
"workflows": [workflow descriptions],
"output_formats": [format descriptions],
"tools": [tool integrations],
"quality_gates": [requirements],
"pitfalls": [common mistakes]
}
Based on user answers, select 2-4 relevant patterns from patterns/.
| User Need | Pattern File |
|---|---|
| "Quick filtering before deep work" | triage-workflows.md |
| "Two-tier verification", "double-check", "validate" | cove-verification.md |
| "Hard requirements", "must have", "criteria" | decision-matrices.md |
| "Source attribution", "citations", "references" | citation-systems.md |
| "Structured outputs", "JSON", "templates", "reports" | output-templates.md |
| "Examples", "test cases", "worked examples" | few-shot-examples.md |
research-knowledge:
python-cli:
web-app:
cli-tool:
api-service:
library:
mixed:
selected_patterns = []
# Check user answers for keywords
if any(keyword in answers for keyword in ["filter", "quick", "triage", "screening"]):
selected_patterns.append("triage-workflows.md")
if any(keyword in answers for keyword in ["verify", "double-check", "validate", "two-phase"]):
selected_patterns.append("cove-verification.md")
if any(keyword in answers for keyword in ["requirements", "criteria", "must-have", "scoring"]):
selected_patterns.append("decision-matrices.md")
if any(keyword in answers for keyword in ["sources", "citations", "references", "attribution"]):
selected_patterns.append("citation-systems.md")
if any(keyword in answers for keyword in ["template", "format", "structure", "JSON", "report"]):
selected_patterns.append("output-templates.md")
if any(keyword in answers for keyword in ["examples", "test cases", "fixtures", "samples"]):
selected_patterns.append("few-shot-examples.md")
# Apply type-based priorities if < 2 patterns selected
if len(selected_patterns) < 2:
selected_patterns.extend(type_priorities[project_type])
# Limit to 4 patterns
selected_patterns = selected_patterns[:4]
From templates/{type}.md:
1. Replace placeholders:
[Project Name] → project_context["name"]
[Tech Stack] → project_context["languages"] + project_context["frameworks"]
[Directory Structure] → project_context["directories"]
[Commands] → project_context["commands"]
[Linter Name] → project_context["linting"]
[Test Framework] → project_context["testing"]
2. Add domain-specific sections based on answers:
IF web-app + design system mentioned:
Add "Design System" section with breakpoints, components
IF python-cli + shared utils mentioned:
Add "Shared Utilities" section with location, conventions
IF research + note templates mentioned:
Add "Note Templates" section with actual templates
IF api-service + auth mentioned:
Add "Authentication" section with method, middleware
3. Include selected patterns (2-4 from Phase 3):
For each pattern file:
patterns/{name}.md4. Generate output templates if applicable:
IF output_templates.md selected OR type requires it:
5. Add quality gate checklist:
## Quality Gates
Before committing:
- [ ] {linter_name} passes
- [ ] {test_framework} tests pass
- [ ] {hook_name} hooks pass (if hooks detected)
- [ ] {additional_gates from user answers}
Commands:
```bash
{actual commands from project_context["commands"]}
**6. Add common commands:**
```markdown
## Common Commands
```bash
# {purpose from package.json script or Taskfile}
{actual command}
# {purpose}
{actual command}
**7. Add anti-patterns:**
Combine:
- Type-default anti-patterns from template
- User-mentioned pitfalls from answers
- Project-specific detected issues
Format:
```markdown
## Anti-Patterns
**AVOID:**
- ❌ {specific pitfall 1}
- ❌ {specific pitfall 2}
- ❌ {specific pitfall 3}
**REASON:** {why each is problematic}
All generated CLAUDE.md files follow this structure:
# {Project Name}
{1-2 sentence description from README or inferred}
## Project Structure
{auto-generated from directory analysis} src/ - {purpose} tests/ - {purpose} docs/ - {purpose}
## Tech Stack
**Language:** {language + version}
**Framework:** {framework + version}
**Testing:** {test framework}
**Linting:** {linters}
**Dependency Mgmt:** {tool}
## Development Workflow
{Type-specific workflows - 2-3 most common tasks}
### {Workflow 1: e.g., "Adding New Feature"}
1. {Concrete step}
2. {Concrete step}
3. {Concrete step}
### {Workflow 2: e.g., "Running Tests"}
1. {Concrete step}
2. {Concrete step}
## {Domain-Specific Section 1}
{Based on project type and user answers}
## {Domain-Specific Section 2}
{Based on project type and user answers}
## Quality Gates
{Generated from customization step 5}
## Common Commands
{Generated from customization step 6}
## Output Templates
{If applicable - generated from customization step 4}
### {Template 1 Name}
```markdown
{Template structure with placeholders}
{Generated from customization step 7}
{Adapted from patterns/{name}.md}
{Adapted from patterns/{name}.md}
To add sections as project evolves:
See .claude/skills/claude-md-gen/customization-guide.md for:
---
## Phase 5: Verification & Output
### Pre-Generation Checks
**During analysis:**
- [ ] At least 3 files read to understand structure
- [ ] Package file(s) parsed correctly
- [ ] Directory structure mapped
- [ ] Existing conventions identified
**During questions:**
- [ ] Max 7 questions asked
- [ ] Questions relevant to detected type
- [ ] No generic questions
- [ ] Answers captured for customization
**During pattern selection:**
- [ ] 2-4 patterns selected
- [ ] Selection based on user needs
- [ ] Patterns will be adapted (not copy-pasted)
### Post-Generation Verification
Load checklist from `checklist.md` and verify:
**Technical accuracy:**
- [ ] Language versions match package files
- [ ] Framework versions correct
- [ ] Directory paths accurate
- [ ] Commands executable
**Actionability:**
- [ ] Workflows have concrete steps
- [ ] Commands include actual syntax
- [ ] Quality gates list actual tools
- [ ] Output templates show structure
**Specificity:**
- [ ] No "TODO" or "Fill this in"
- [ ] No placeholder text remaining
- [ ] Anti-patterns specific to project
- [ ] Examples use project context
**Extensibility:**
- [ ] Customization guide referenced
- [ ] Clear how to add sections
- [ ] Pattern library location noted
**Completeness:**
- [ ] All major project areas covered
- [ ] Selected patterns included and adapted
- [ ] Quality gates comprehensive
- [ ] Common commands from actual project
### Write CLAUDE.md
**Location decision:**
- Default: `CLAUDE.md` at project root
- If `.claude/` exists: ask user if they want `.claude/CLAUDE.md` instead
**Write file** with fully customized content.
### Show Summary
```markdown
# Generated CLAUDE.md
**Location:** {path}
**Type:** {detected-type or mixed}
**Patterns Included:** {list 2-4 patterns}
## Sections Generated
1. Project Structure (auto-generated from {source})
2. Tech Stack ({languages/frameworks})
3. {Domain Section 1}
4. {Domain Section 2}
5. Quality Gates ({linter names})
6. Common Commands ({X commands from mise/make/npm})
7. Output Templates ({Y templates} or "N/A")
8. Anti-Patterns ({Z specific pitfalls})
9. {Pattern 1 name}
10. {Pattern 2 name}
{11-12 if 3-4 patterns}
## Next Steps
- Review {Section X} for accuracy
- Customize {Section Y} with additional details
- Update anti-patterns as you discover new ones
## Extensibility
Add sections as project evolves. See .claude/skills/claude-md-gen/customization-guide.md for:
- Adding new project type templates
- Creating custom patterns
- Adapting generated output as requirements change
Templates: .claude/skills/claude-md-gen/templates/{type}.md
Patterns: .claude/skills/claude-md-gen/patterns/{name}.md
Questions: .claude/skills/claude-md-gen/questions/{type}-questions.md
Support: .claude/skills/claude-md-gen/
When multiple type indicators detected:
If existing CLAUDE.md detected:
For quality gates and common commands:
--help or --version (non-destructive)When including patterns:
If auto-detection fails:
If package files missing:
If commands untestable:
If no patterns match:
If template file missing:
Users can extend skill by:
templates/patterns/questions/See customization-guide.md for details.
Concrete over generic:
Actionable over descriptive:
Self-contained over referential:
Extensible over rigid:
Project-specific over universal:
checklist.md (opens in a new tab)customization-guide.md (opens in a new tab)patterns/citation-systems.md (opens in a new tab)patterns/cove-verification.md (opens in a new tab)patterns/decision-matrices.md (opens in a new tab)patterns/few-shot-examples.md (opens in a new tab)patterns/output-templates.md (opens in a new tab)patterns/triage-workflows.md (opens in a new tab)questions/api-service-questions.md (opens in a new tab)questions/cli-tool-questions.md (opens in a new tab)questions/library-questions.md (opens in a new tab)questions/mixed-questions.md (opens in a new tab)questions/python-cli-questions.md (opens in a new tab)questions/research-questions.md (opens in a new tab)questions/web-app-questions.md (opens in a new tab)templates/api-service.md (opens in a new tab)templates/cli-tool.md (opens in a new tab)templates/library.md (opens in a new tab)templates/mixed.md (opens in a new tab)templates/python-cli.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub automaat/environment-as-code --plugin agent-md-gen