AgentSkillsCN

document-creator

利用 LSP 为项目生成 DEVGUIDE.md 架构文档。

SKILL.md
--- frontmatter
name: document-creator
allowed-tools: Task, Glob, Read
argument-hint: "<dir1> [dir2] ... [dirN]"
description: Generate DEVGUIDE.md architectural documentation using LSP (project)
context: fork
agent: document-creator-default
model: opus

Document Creator

Generate hierarchical architectural documentation (DEVGUIDE.md) using Claude Code's built-in LSP tools. Supports multiple directories with parallel agent execution.

Built-in LSP Operations

  • documentSymbol — Extract symbols from files
  • findReferences — Map dependencies
  • goToDefinition — Detailed symbol analysis

Arguments

Directory paths to document (one agent per directory):

  • Single directory: /document-creator src/services/
  • Multiple directories: /document-creator src/services src/components src/lib
  • No argument: analyzes current directory (.)

Instructions

Step 1: Parse Input

The user invoked this skill with arguments: $ARGUMENTS

Extract directory list:

  • Split arguments by spaces
  • If empty → use current directory (.)
  • Validate each path exists as a directory

Step 2: Check for Rules

Check if .claude/rules directory exists at project root:

code
Use Glob(".claude/rules/*.md") to find rules files.

If rules exist:
- Read each rules file to understand frontmatter paths
- Pass relevant rules info to agents

If no rules exist:
- Note this for agents to create rules files when missing

Step 3: Determine Output Paths

For each directory:

  • If no DEVGUIDE.md exists → <target-dir>/DEVGUIDE.md
  • If exists → <target-dir>/DEVGUIDE_2.md (increment until unused)

Step 4: Launch Agents

For EACH directory, launch background agent:

code
Generate DEVGUIDE: <directory-path>
Output: <determined path>
Rules: <exists/not found>

REQUIRED Task tool parameters:

code
subagent_type: "document-creator-default"
run_in_background: true
prompt: "Generate DEVGUIDE: <dir>\nOutput: <path>\nRules: <status>"

Launch ALL agents in a single message for parallel execution. Output a status message like "Generating N DEVGUIDE files..." and end your turn. The system wakes you when agents finish.

Step 5: Report Results

code
## DEVGUIDE Documentation Created (LSP)

| Directory | Output | Status |
|-----------|--------|--------|
| [dir1] | [output path] | CREATED |
| [dir2] | [output path] | CREATED |

Rules Status: [Found N rules / No rules folder found]

Next Steps:
1. Review generated documentation
2. Commit the DEVGUIDE files
3. [If no rules] Agent created .claude/rules/ file automatically

Error Handling

ScenarioAction
Path not foundReport error, continue with other paths
Path is file not directoryReport error, continue with other paths
Empty directoryGenerate minimal guide
Agent failsReport error, suggest retry

Example Usage

bash
/document-creator
/document-creator src/services/
/document-creator src/services src/components src/lib
/document-creator backend/src frontend/src