with one click
codeguide-generate
// Generate _codeguide/ documentation for source files that have no docs yet. Works for new and existing projects.
// Generate _codeguide/ documentation for source files that have no docs yet. Works for new and existing projects.
[HINT] Download the complete skill directory including SKILL.md and all related files
| name | codeguide-generate |
| description | Generate _codeguide/ documentation for source files that have no docs yet. Works for new and existing projects. |
| argument-hint | [project] [module-path] |
Generate _codeguide/ documentation for source files that don't have corresponding docs. Works both for projects with no docs at all and for existing projects with new source files. Does not commit.
Before doing anything else, run python ${CLAUDE_PLUGIN_ROOT}/scripts/resolve.py --json to find the codeguide root for this repo. The script prints a JSON object: {mode, cg_root, sibling_anchor, found}. If found == false, halt and tell the user to run /codeguide-setup first.
$ARGUMENTS controls what gets scanned:
MyProject → only that projectMyProject/Storage → only that subfolderResolve codeguide root. See ## Resolution above. Bind git_toplevel separately via git rev-parse --show-toplevel for the placement-rule logic in Step 9.
Read the Documentation Guide: Read _codeguide/modules/DocumentationGuide.md in full. All docs must follow its structure.
Read local rules: Read _codeguide/local-rules.md if it exists.
Read config and filters:
_codeguide/config.yaml for recognized source extensions._codeguide/cgignore.md — skip these paths entirely._codeguide/cgexclude.md — skip these modules (but ensure they appear in Overview.md with a brief description).Scan source structure: List all folders and source files matching recognized extensions in scope, skipping paths that match cgignore patterns.
Identify undocumented source: For each source file or source folder, check if a corresponding doc exists using the naming rules from the guide:
parser.py → _codeguide/modules/Parser.mdutils/ (folder) → _codeguide/modules/Utils.mdRead undocumented source files: Read only the source files that need new docs. Use parallel agent reads for large sets.
Decide doc granularity: Following the guide's rules:
_codeguide/modules/<Module>/Overview.md + per-file docs_codeguide/modules/<Name>.mdCreate docs for new project (if no Overview exists):
Placement rule — determine <placement_root> using mode and git_toplevel from Step 1:
mode == "inline" → <placement_root> = <project_path> (current behavior, unchanged).mode == "sibling" → <placement_root> = <sibling_anchor> / <project_path>.relative_to(<git_toplevel>). This mirrors the layout that resolve.py's _sibling_walk traverses. Do not collapse all projects under a flat <sibling_anchor>/_codeguide/modules/.Multi-project monorepo example (sibling mode):
Repo: c:/Code/acme/wts/acme/ (git toplevel)
src/csharp/Api/ (project A)
src/csharp/Worker/ (project B)
Sibling anchor: c:/Code/acme/codeguide/
Docs land at:
c:/Code/acme/codeguide/src/csharp/Api/_codeguide/
c:/Code/acme/codeguide/src/csharp/Worker/_codeguide/
NOT at:
c:/Code/acme/codeguide/_codeguide/modules/ ← wrong flat structure
<placement_root>/_codeguide/ and <placement_root>/_codeguide/modules/<placement_root>/_codeguide/Overview.md with: scope, negative boundaries, dependencies, module table with routing hints, cross-cutting patterns_codeguide/Overview.md project tableWrite module docs: For each undocumented module, create the doc following the guide structure:
Update the project Overview: Add rows to the module table for each new doc. For excluded modules (from cgexclude.md), add a row with the description from cgexclude and excluded in the Doc column. Never add "not yet documented" placeholder rows — a module either has docs, is excluded, or is not listed.
Update IDE visibility (language-specific): For .NET projects with a .csproj, ensure <None Include="_codeguide\**\*.md" /> is in an ItemGroup. Skip for other languages.
Report: List what was created and what was skipped (already documented or excluded).
For large scopes, use parallel subagents — one per project. Each subagent receives the Documentation Guide, local rules, and its project's scope, then creates docs independently. Subagents can further parallelize per module if the project has many undocumented files.
Include the relevant _codeguide/Overview.md in every subagent prompt.
local-rules.md on top of the guide./codeguide-maintain's job.