Summary
The docs-md-ghpages plugin manages project documentation as markdown/MDX files in a docs/ directory, published to GitHub Pages via static site generators. This is valuable because setting up a docs site involves choosing an SSG, configuring it, writing a GitHub Actions workflow, and keeping docs in sync with code — all boilerplate the plugin handles.
Original Intent
Keep project documentation in docs/ directory under version control as md or mdx, publish to GitHub Pages or a locally run static web site, generating from docs/ content, reference from README, remember to update as codebase changes. Claude Code configured to reference these for context and project awareness.
Commands
/docs:generate
Purpose: Generate or update project documentation in docs/ directory.
Behavior:
-
Check for existing docs setup:
docs/ directory with existing content
- SSG config:
mkdocs.yml, docusaurus.config.js, .vitepress/config.ts
- If exists → enter update mode (analyze what's changed, suggest new docs)
-
If no docs exist, ask user to choose SSG:
| SSG |
Best For |
Language |
Config |
| MkDocs Material (recommended) |
Technical docs, API references |
Python |
mkdocs.yml |
| VitePress |
Vue/JS projects, lightweight |
TypeScript |
.vitepress/config.ts |
| Docusaurus |
Large projects, blog + docs |
TypeScript |
docusaurus.config.js |
-
Initialize chosen SSG:
MkDocs Material:
uvx mkdocs new . # or uv add --dev mkdocs-material
Generate mkdocs.yml:
site_name: <Project Name>
site_url: https://<owner>.github.io/<repo>/
theme:
name: material
features:
- content.code.copy
- navigation.sections
- navigation.expand
- search.suggest
nav:
- Home: index.md
- Getting Started: getting-started.md
- API Reference: api/index.md
- Contributing: contributing.md
markdown_extensions:
- admonition
- pymdownx.highlight
- pymdownx.superfences
- pymdownx.tabbed:
alternate_style: true
VitePress:
Generate .vitepress/config.ts
Docusaurus:
bunx create-docusaurus docs classic --typescript
-
Generate initial doc pages:
docs/index.md — Project overview (from README or manifest)
docs/getting-started.md — Installation + quick start
docs/api/index.md — API reference (from code analysis)
docs/contributing.md — Development setup + guidelines
-
Add scripts to package.json / Makefile:
docs:dev — mkdocs serve / vitepress dev / docusaurus start
docs:build — mkdocs build / vitepress build / docusaurus build
-
Output summary of created files + how to preview locally
Edge cases:
- Docs already exist with different SSG → don't suggest migration, work with existing
- No package.json (non-JS project) → MkDocs is the natural choice
- Existing markdown files in docs/ but no SSG → offer to add SSG config around existing content
/docs:api
Purpose: Generate API reference documentation from source code.
Behavior:
-
Detect project type and API surface:
| Type |
What to document |
Source |
| REST API |
Endpoints, methods, request/response |
Route files, OpenAPI spec |
| Library |
Exported functions, classes, types |
Source files, JSDoc/docstrings |
| CLI |
Commands, flags, options |
Command definitions |
| GraphQL |
Queries, mutations, types |
Schema files |
-
For each API element, generate documentation:
## `createUser(options)`
Create a new user account.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `options.email` | `string` | Yes | User email address |
| `options.name` | `string` | No | Display name |
### Returns
`Promise<User>` — The created user object.
### Example
\`\`\`typescript
const user = await createUser({
email: "alice@example.com",
name: "Alice",
});
\`\`\`
-
Organize API docs:
- Group by module/file/resource
- Create navigation structure
- Add type definitions section if TypeScript
-
If OpenAPI/Swagger spec exists → generate from spec
-
Output: created/updated doc files
Edge cases:
- No public API (internal project) → skip or ask user what to document
- Mixed API types (REST + library) → separate sections
- Undocumented code → generate from function signatures + parameter types
/docs:deploy (new)
Purpose: Set up GitHub Pages deployment via GitHub Actions.
Behavior:
-
Detect SSG from config files
-
Generate .github/workflows/docs.yml:
MkDocs Material:
name: Deploy Docs
on:
push:
branches: [main]
paths: ['docs/**', 'mkdocs.yml']
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
jobs:
deploy:
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- run: pip install mkdocs-material
- run: mkdocs build --strict
- uses: actions/upload-pages-artifact@v3
with:
path: site/
- id: deployment
uses: actions/deploy-pages@v4
VitePress:
# Similar structure with bun install + vitepress build
-
Check GitHub Pages settings:
gh api repos/{owner}/{repo}/pages 2>/dev/null || echo "Pages not enabled"
-
If Pages not enabled → provide instructions:
- Go to Settings → Pages → Source: GitHub Actions
-
Output: workflow file created + next steps
Edge cases:
- Workflow already exists → offer to update or create alongside
- Custom domain → add CNAME file to docs output
- Monorepo → deploy from subdirectory
Hooks
PostToolUse: docs_outdated
Trigger: Edit or Write tool, when modifying files that have corresponding documentation:
- API route changes → suggest updating API docs
- README changes → suggest syncing with docs site
- Config changes → suggest updating configuration docs
Behavior:
- Output:
💡 Code change may affect docs. Run /docs:generate to check for outdated documentation.
- Informational only, do not block
File Manifest
| File |
Est. Lines |
Purpose |
commands/generate.md |
110-130 |
Generate/update documentation |
commands/api.md |
90-110 |
Generate API reference |
commands/deploy.md |
80-100 |
Set up GitHub Pages deployment |
hooks/docs_outdated.md |
25-35 |
Suggest docs updates on code changes |
README.md |
150-180 |
Full plugin documentation |
.claude-plugin/plugin.json |
15-20 |
Plugin manifest |
README Outline
- Overview — Markdown docs in version control, published to GitHub Pages
- Quick Start — Installation +
/docs:generate + local preview
- Commands — Table with all 3 commands
- SSG Comparison — When to use MkDocs vs VitePress vs Docusaurus
- GitHub Actions Workflow — Reference workflow for each SSG
- API Documentation — How API docs are generated per project type
- Keeping Docs Current — How the outdated hook helps
- Customization — Theming, navigation, plugins per SSG
Prerequisites
- One of:
uv/pip (for MkDocs), bun/npm (for VitePress/Docusaurus)
gh CLI (for Pages setup verification)
- GitHub repository with Pages enabled
Quality Checklist
Summary
The
docs-md-ghpagesplugin manages project documentation as markdown/MDX files in adocs/directory, published to GitHub Pages via static site generators. This is valuable because setting up a docs site involves choosing an SSG, configuring it, writing a GitHub Actions workflow, and keeping docs in sync with code — all boilerplate the plugin handles.Original Intent
Commands
/docs:generatePurpose: Generate or update project documentation in
docs/directory.Behavior:
Check for existing docs setup:
docs/directory with existing contentmkdocs.yml,docusaurus.config.js,.vitepress/config.tsIf no docs exist, ask user to choose SSG:
mkdocs.yml.vitepress/config.tsdocusaurus.config.jsInitialize chosen SSG:
MkDocs Material:
Generate
mkdocs.yml:VitePress:
Generate
.vitepress/config.tsDocusaurus:
Generate initial doc pages:
docs/index.md— Project overview (from README or manifest)docs/getting-started.md— Installation + quick startdocs/api/index.md— API reference (from code analysis)docs/contributing.md— Development setup + guidelinesAdd scripts to package.json / Makefile:
docs:dev—mkdocs serve/vitepress dev/docusaurus startdocs:build—mkdocs build/vitepress build/docusaurus buildOutput summary of created files + how to preview locally
Edge cases:
/docs:apiPurpose: Generate API reference documentation from source code.
Behavior:
Detect project type and API surface:
For each API element, generate documentation:
Organize API docs:
If OpenAPI/Swagger spec exists → generate from spec
Output: created/updated doc files
Edge cases:
/docs:deploy(new)Purpose: Set up GitHub Pages deployment via GitHub Actions.
Behavior:
Detect SSG from config files
Generate
.github/workflows/docs.yml:MkDocs Material:
VitePress:
# Similar structure with bun install + vitepress buildCheck GitHub Pages settings:
gh api repos/{owner}/{repo}/pages 2>/dev/null || echo "Pages not enabled"If Pages not enabled → provide instructions:
Output: workflow file created + next steps
Edge cases:
Hooks
PostToolUse:
docs_outdatedTrigger:
EditorWritetool, when modifying files that have corresponding documentation:Behavior:
💡 Code change may affect docs. Run /docs:generate to check for outdated documentation.File Manifest
commands/generate.mdcommands/api.mdcommands/deploy.mdhooks/docs_outdated.mdREADME.md.claude-plugin/plugin.jsonREADME Outline
/docs:generate+ local previewPrerequisites
uv/pip(for MkDocs),bun/npm(for VitePress/Docusaurus)ghCLI (for Pages setup verification)Quality Checklist