agents-md-generator
npx skills add https://github.com/realroc/skills --skill agents-md-generator
Agent 安装分布
Skill 文档
AGENTS.MD Generator
Generate comprehensive AGENTS.md documentation for backend projects following the AGENTS.md/CLAUDE.md symlink pattern.
Core Workflow
1. Understand the Scope
Ask the user to clarify:
- Target module: Root directory, specific module (mcp, teamo_code, etc.), or multiple modules
- Source materials: Existing CLAUDE.md, API route files, technical design docs
- API count: How many interfaces need documentation (affects detail level)
- Content to preserve: Existing business rules, specs, or guidelines to keep
- Content to remove: Deprecated features, unused patterns (e.g., Ralph Loop)
2. Read Source Materials
Read all relevant source files:
- Existing CLAUDE.md or AGENTS.md (if exists)
- API route files (e.g.,
clawdbot.py,router.py) - Related business spec documents
- Data model definitions
Use Read tool to load files into context. For large codebases, use Grep to find specific patterns first.
3. Generate AGENTS.md Content
Follow the template structure in references/agents_template.md:
Required Sections:
- Module Overview – Responsibilities, main features, core collections
- Business Specifications – Domain-specific rules, workflows, special mechanisms
- API Interface Documentation – Complete interface specs (see
references/api_doc_template.md) - Data Models – MongoDB collections, PostgreSQL tables, Redis keys
- External Integrations – Third-party APIs, external services
- Complete Data Flows – End-to-end process diagrams (see
references/data_flow_template.md)
Content Priorities:
- Completeness over brevity: Include all interfaces, all fields, all business rules
- Accuracy over idealism: Document actual behavior, not desired behavior
- Concrete examples: Provide JSON request/response samples for every interface
- Chinese + English: Chinese labels (æ¥å£ãåè½ã请æ±ä½) with English technical terms
4. Create Symlink Structure
After creating AGENTS.md:
- Backup:
cp CLAUDE.md CLAUDE.md.backup - Delete:
rm CLAUDE.md - Symlink:
ln -s AGENTS.md CLAUDE.md - Verify:
ls -la CLAUDE.mdshould showCLAUDE.md -> AGENTS.md
Use the Bash tool for these operations.
5. Validate and Test
Structure Validation:
- â YAML frontmatter removed (AGENTS.md uses standard Markdown)
- â All code blocks properly fenced with language tags
- â All tables properly formatted
- â
All internal links work (e.g.,
[Section](#section))
Content Validation:
- â Every API interface has request/response models
- â Every data model has field descriptions and indexes
- â Every external integration has API endpoints and auth
- â Every data flow has clear start and end points
Symlink Validation:
# Verify symlink
ls -la CLAUDE.md
# Verify content match
diff CLAUDE.md AGENTS.md
# Expected: No output (files are identical via symlink)
6. Git Commit
Follow the project’s Git commit standards:
git add AGENTS.md CLAUDE.md CLAUDE.md.backup
git commit -m "docs: å建 <模ååç§°> AGENTS.md 并设置 CLAUDE.md è½¯é¾æ¥
- å建 AGENTS.md (宿´ç模åè§èææ¡£)
- å
å« <X> 个æ¥å£ç宿´ææ¡£
- å
å«ä¸å¡è§è (<ä¸å¡è§èåç§°>)
- å
嫿°æ®æ¨¡ååå¤é¨éæè¯´æ
- åå»ºè½¯é¾æ¥ CLAUDE.md -> AGENTS.md
- å¤ä»½å CLAUDE.md 为 CLAUDE.md.backup
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>"
API Documentation Standards
Interface Template
For each API interface, document:
Basic Info:
- HTTP method and path
- Functionality description (Chinese)
- Authentication requirements
Request:
- Request model name and fields
- Field types, constraints, required/optional
- Request example (JSON)
Response:
- Response model name and fields
- Field types and descriptions
- Success response example (JSON)
- Error response examples (JSON)
Business Logic (if complex):
- Step-by-step flow
- Validation rules
- Side effects
See references/api_doc_template.md for detailed examples.
Data Flow Documentation
Use ASCII diagrams with clear stages:
ç¨æ·æä½
â
API è°ç¨ (æ¥å£åç§°)
ââ Step 1: éªè¯ (æè¿°)
ââ Step 2: æ°æ®åºæä½ (æè¿°)
â ââ æ¥è¯¢ xxx
â ââ æ´æ° yyy
ââ Step 3: å¤é¨æå¡è°ç¨ (æè¿°)
ââ Step 4: è¿åååº
For complex flows, break into multiple sub-diagrams. See references/data_flow_template.md for examples.
Best Practices
Progressive Disclosure
Root AGENTS.md: Global specs, cross-module patterns, project overview Module AGENTS.md: Module-specific specs, API docs, detailed flows
Reference module docs from root:
请åèå¯¹åºæ¨¡åçææ¡£è·å详ç»çå¼åæå:
- **MCP 模å**: `wowchat/mcp/AGENTS.md`
- **Teamo Code 模å**: `wowchat/teamo_code/AGENTS.md`
Spec Auto-Deposition
Update Spec auto-deposition mechanism to use AGENTS.md:
æ¯æ¬¡ä¿®æ¹ AGENTS.md å,å¿
é¡»å¨åå¤å°¾é¨åç¬ä¸è¡è¾åº(åå空è¡):
\`\`\`
åµ à¸
Õâ¢ï»â¢Õà¸
已宿xxxç¸å
³çspec,æ´æ°/å é¤AGENTS.mdæä»¶ä¸ç¸å
³å
容ã
\`\`\`
For module-level updates:
åµ à¸
Õâ¢ï»â¢Õà¸
已宿xxxç¸å
³çspec,æ´æ°/å é¤<模åè·¯å¾>/AGENTS.mdæä»¶ä¸ç¸å
³å
容ã
Content Removal
When migrating from CLAUDE.md to AGENTS.md, remove:
- â Deprecated features (e.g., Ralph Loop if not used)
- â Experiment-only code patterns
- â Duplicate specifications across files
Preserve:
- â All core business rules
- â All active API specifications
- â All data model definitions
- â All integration patterns
Common Patterns
Multi-Module Documentation
For projects with multiple modules, create hierarchy:
/AGENTS.md (root - global specs)
/CLAUDE.md -> AGENTS.md (symlink)
/wowchat/mcp/AGENTS.md (module specs)
/wowchat/mcp/CLAUDE.md -> AGENTS.md (symlink)
/wowchat/teamo_code/AGENTS.md (module specs)
/wowchat/teamo_code/CLAUDE.md -> AGENTS.md (symlink)
API Count Guidelines
- < 10 interfaces: Include all details in main AGENTS.md
- 10-30 interfaces: Group by function, use interface overview table
- > 30 interfaces: Consider splitting into multiple module AGENTS.md files
External Integration Documentation
For each external service, document:
- Base URL and API endpoints table
- Authentication method (API Key, OAuth, etc.)
- Request/response format examples
- Timeout settings
- Error handling patterns
See MCP module example for Lighthouse, Feishu, Alipay integrations.
Error Prevention
Common Mistakes:
- â Forgetting to backup CLAUDE.md before creating symlink
- â Including YAML frontmatter (only needed in SKILL.md, not AGENTS.md)
- â Incomplete API documentation (missing request/response models)
- â Missing data flow diagrams for complex processes
- â Not testing symlinks with
ls -la
Validation Checklist:
- AGENTS.md created with all required sections
- CLAUDE.md.backup exists
- CLAUDE.md symlink verified (
ls -la CLAUDE.mdshows-> AGENTS.md) -
cat CLAUDE.mdshows AGENTS.md content - All API interfaces documented
- All data models documented
- All data flows documented
- Git committed with proper message
References
- Template Structure: See
references/agents_template.md - API Documentation: See
references/api_doc_template.md - Data Flow Diagrams: See
references/data_flow_template.md - Complete Example: See
assets/example_mcp_agents.md