From mcp-doc
Generates structured AI-written READMEs for a specific directory or all undocumented directories. Optimizes for human and AI consumption, analyzes files, and updates the MCP manifest.
How this skill is triggered — by the user, by Claude, or both
Slash command
/mcp-doc:mcp-doc-generateThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Generate structured README documentation for a target directory (or all undocumented directories in bulk mode). Each generated README is optimized for both human developers and AI assistants. After writing, the manifest and tool action scripts are updated automatically.
Generate structured README documentation for a target directory (or all undocumented directories in bulk mode). Each generated README is optimized for both human developers and AI assistants. After writing, the manifest and tool action scripts are updated automatically.
Check $ARGUMENTS to determine the mode.
If $ARGUMENTS is a directory path (e.g., src/api, packages/auth):
{path}/README.md. Overwrite, or skip?"all)If $ARGUMENTS is all, or if $ARGUMENTS is empty/not provided:
Scan the project for all undocumented significant directories (same logic as /mcp-doc-scan Step 2 and Step 3 "Undocumented" category).
Present the list to the user, grouped by priority:
Undocumented directories found:
Critical:
- src/api/routes/
- src/core/
High:
- src/services/
- src/auth/
Medium:
- src/config/
- src/middleware/
Low:
- scripts/
- tests/helpers/
Ask the user via AskUserQuestion: "Generate READMEs for all of these, or select specific ones?"
Process directories sequentially using Step 4 (sequential bulk mode).
Read .mcp/manifest.yml. If the file does not exist, tell the user:
No manifest found at .mcp/manifest.yml.
Run /mcp-doc-init to initialize the documentation manifest first.
Stop here if no manifest exists.
Parse the manifest to get the current resource list and project name.
For the target directory, read and analyze source files to understand what the directory contains.
index.*, main.*, app.*, mod.*, lib.* (entry points)package.json, pyproject.toml, Cargo.toml (module definition files)export or from statements and pick the top files)From each source file, note:
From the directory as a whole, determine:
When processing multiple directories (bulk mode from Step 1), handle each directory one at a time:
Write a structured README.md to the target directory. Use the following template, adapting sections based on what the directory actually contains.
# {Directory Name}
{One-paragraph purpose statement. What this directory is responsible for
and why it exists. Written for both humans and AI assistants.}
## Key Files
| File | Purpose |
|------|---------|
| handler.ts | HTTP request handlers for user endpoints |
| service.ts | Business logic for user CRUD operations |
| types.ts | TypeScript interfaces and type definitions |
## Architecture
{How components in this directory relate to each other and to the rest
of the project. Describe the data flow, layering, or module boundaries.}
## Patterns & Conventions
{Coding patterns specific to this directory. Error handling approach,
naming conventions, module organization rules, etc.}
## Dependencies
**Depends on:** {internal modules this directory imports from}
**Used by:** {other directories/modules that import from here}
**External:** {key third-party packages used}
## Usage
{Example imports, initialization, and common operations. Show how other
parts of the codebase use this module.}
## API — for directories that define HTTP endpoints, list routes with methods## Configuration — for directories with environment variables or config options## Testing — if the directory has specific testing patterns or fixtures## Migration Notes — if there are migration scripts or version-specific logicFor each newly created README:
/ with _, remove extension, lowercase, detect collisions)..mcp/ (prefix with ../)..mcp/manifest.yml: - name: src_api_routes_readme
uri: ../src/api/routes/README.md
description: "HTTP route handlers for user, auth, and admin endpoints"
mimeType: text/markdown
After all manifest changes are complete, regenerate all three default action scripts with the updated index data:
Rebuild the full index — re-read all resources listed in the manifest (including newly added ones). Extract title, sections, scope, tags, description for each.
Regenerate action files:
.mcp/actions/search-docs.js — updated INDEX array with new entries.mcp/actions/get-applicable-docs.js — updated INDEX array.mcp/actions/get-doc-tree.js — updated DIRS array reflecting new documentation coverageRecompute SHA-256 hashes for each action file:
sha256sum .mcp/actions/search-docs.js | awk '{print "sha256:" $1}'
sha256sum .mcp/actions/get-applicable-docs.js | awk '{print "sha256:" $1}'
sha256sum .mcp/actions/get-doc-tree.js | awk '{print "sha256:" $1}'
Update tool entries in .mcp/manifest.yml with the new hashes.
Rewrite default tool metadata — when regenerating, also update the title and description fields on the three default tool entries in the manifest to use the structured USE THIS WHEN / DO NOT USE WHEN pattern (same format as /mcp-doc-init generates). Do not rewrite metadata for custom tools.
Important: Only regenerate the three default tools (search_docs, get_applicable_docs, get_doc_tree). Do not touch any custom tools created by /mcp-doc-add-tool.
Present what was done:
Documentation generated:
Created:
- src/api/routes/README.md (analyzed 12 files)
- src/services/README.md (analyzed 8 files)
Skipped:
- src/config/ (user chose to skip)
Manifest updated:
- Added 2 new resource entries
- Total resources: N
Tools regenerated:
- search_docs (index: N entries, M sections)
- get_applicable_docs (index: N entries)
- get_doc_tree (N directories)
- Hashes updated in manifest
Next steps:
- Review the generated READMEs and edit as needed
- Run /mcp-doc-sync if you modify any documentation files
- Run /mcp-doc-scan to check remaining coverage gaps
npx claudepluginhub z-m-huang/vcp --plugin mcp-docGenerates systematic documentation for code files or modules via file-by-file analysis, progress tracking, and completeness checks using structured templates. Use for API docs, READMEs, or reference guides.
Creates or updates .meridian/docs/ knowledge files for modules or directories. Generates concise reference docs with frontmatter summaries and read_when keywords for agent context routing.