Prompt file imported from Melvynx/MistratonReview (
.claude/commands/nowts/add-documentation.md). Copyright stays with the author.
<documentation_structure>
Front-matter Schema
---
title: "Page Title"
description: "Brief description of what this doc covers"
keywords: ["keyword1", "keyword2", "keyword3"]
tags: ["guide" | "api" | "components" | "reference"]
order: 1 # For ordering in sidebar
subcategory: "Category Name" # For grouping in sidebar
# API docs only:
method: "GET" | "POST" | "PATCH" | "DELETE" | "PUT"
endpoint: "/v1/resource"
examples:
bash: |
curl command here...
javascript: |
fetch example here...
python: |
requests example here...
results:
success: |
{ "response": "example" }
error: |
{ "error": "example" }
---
Content Structure
For guides:
- Introduction paragraph
- Quick Setup / Prerequisites (if applicable)
- Step-by-step sections with ## headings
- Code examples in fenced blocks
- Next Steps / Related docs
For API docs:
- Brief description
- Endpoint section
- Authentication section
- Request Body table
- Response table
- Error Codes table
For component docs:
- Installation (if needed)
- Import statement
- Basic usage example
- Props/Options table
- Advanced patterns
- Best practices
</documentation_structure>
Step 1: Gather Context
Ask the user for ALL necessary information:
-
What to document?
- Feature name / API endpoint / Component name
- Type: Guide, API, Component, or Reference
-
Source files (CRITICAL - read these first!):
- For components: Component source file(s)
- For APIs: Route handler file, types, validation schemas
- For features: All related source files
-
Additional resources:
- Video tutorials (YouTube URL for WebFetch)
- External documentation links
- Design docs or specifications
Step 2: Analyze Sources
- Read ALL provided source files
- Extract:
- Function signatures and types
- Props/Options with their types
- Usage patterns from existing code
- Error handling
- Edge cases
Step 3: Check Existing Documentation
- Glob
content/docs/*.mdxto see existing docs - Check if doc already exists (update vs create)
- Look at similar docs for style consistency
Step 4: Write Documentation
- Create/update the
.mdxfile incontent/docs/ - Follow the front-matter schema
- Match the tone/style of existing docs
- Include practical code examples
- Add cross-references to related docs
Step 5: Validate
- Verify front-matter is valid YAML
- Check all code examples are syntactically correct
- Ensure all referenced docs/links exist
<questions_to_ask>
Ask these questions using AskUserQuestion:
-
Doc Type
- Question: "What type of documentation do you want to create?"
- Options:
- Guide (step-by-step tutorial)
- API (endpoint documentation)
- Component (UI component usage)
- Reference (technical reference)
-
Source Files
- Question: "Which source files should I read to understand this feature?"
- Ask for specific file paths or patterns
-
Target Audience
- Question: "Who is the target audience for this documentation?"
- Options:
- Developers (technical)
- End users (non-technical)
- Both
-
External Resources (optional)
- Question: "Do you have any external resources (videos, docs, links) I should reference?"
- Accept URLs for WebFetch
</questions_to_ask>
<file_naming>
Use kebab-case for file names:
getting-started.mdxapi-testimonials-create.mdxdialog-manager.mdxlayout-components.mdx
Convention: {type}-{subject}.mdx for API docs
Convention: {subject}.mdx for guides/components
</file_naming>
<success_criteria>
- Documentation file created/updated in
content/docs/ - Valid YAML front-matter
- Consistent style with existing docs
- Practical code examples included
- All referenced source files were read
- Cross-references to related docs added </success_criteria>
