|
| 1 | +--- |
| 2 | +name: docs |
| 3 | +description: Generate, audit, or update project documentation to a professional open-source standard. Use this skill whenever the user mentions docs, documentation, README, API reference, guides, migration guides, troubleshooting, llms.txt, doc audit, or wants to improve any written developer-facing content in a repository. Also trigger when the user says things like "document this", "write docs for", "update the docs", "our docs need work", or compares documentation quality to other projects. Covers Ruby (YARD), TypeScript (TSDoc/JSDoc), Markdown guides, configuration references, and doc site structure. |
| 4 | +--- |
| 5 | + |
| 6 | +# Documentation Skill |
| 7 | + |
| 8 | +Generate and maintain documentation that meets or exceeds the standard set by the best open-source Rails/JS projects (Inertia Rails, Vite Ruby, Rails itself). |
| 9 | + |
| 10 | +## Before You Start |
| 11 | + |
| 12 | +Read these reference files (located in the `references/` subdirectory next to this SKILL.md file) before proceeding: |
| 13 | + |
| 14 | +1. **Quality Standard** — `references/quality-standard.md` — tiered audit checklist (Must-Have / Expected / Differentiator) |
| 15 | +2. **Documentation Templates** — `references/templates.md` — structural skeletons for each doc type |
| 16 | +3. **Competitive Landscape** — `references/competitive-landscape.md` — benchmarks against peer projects |
| 17 | + |
| 18 | +## Workflow |
| 19 | + |
| 20 | +### Step 1: Assess the current state |
| 21 | + |
| 22 | +- Scan the repo for existing docs: `docs/`, `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, inline code comments, Wiki, and any hosted doc site config (VitePress, Docusaurus, Jekyll, etc.) |
| 23 | +- Identify what exists, what is outdated, and what is missing |
| 24 | +- Compare against the Quality Standard reference above |
| 25 | + |
| 26 | +### Step 2: Determine scope |
| 27 | + |
| 28 | +If the user gave a specific target (e.g., `/docs $ARGUMENTS`), focus there. Otherwise, present a prioritized gap analysis: |
| 29 | + |
| 30 | +1. **Critical gaps** - Missing README sections, no quick start, no API reference |
| 31 | +2. **High-value improvements** - Outdated guides, missing migration/upgrade docs, no troubleshooting |
| 32 | +3. **Polish** - LLMs.txt, cookbook/recipes, configuration reference, contributor guide improvements |
| 33 | + |
| 34 | +Ask the user which items to tackle (or do all if they say so). |
| 35 | + |
| 36 | +### Step 3: Generate or rewrite documentation |
| 37 | + |
| 38 | +Follow these principles for ALL documentation: |
| 39 | + |
| 40 | +#### Voice and Style |
| 41 | +- **Direct and concise.** Lead with what the reader needs. No filler. |
| 42 | +- **Show, don't tell.** Every concept gets a code example. Prefer real-world examples over contrived ones. |
| 43 | +- **Progressive disclosure.** Quick start first, then deeper guides, then API reference. Layer complexity. |
| 44 | +- **Avoid em dashes** (use commas, parentheses, or separate sentences instead). |
| 45 | +- **Use second person** ("you") for guides and tutorials. Use third person for API references. |
| 46 | +- **Prefer active voice.** "Run `bundle install`" not "The bundle should be installed." |
| 47 | + |
| 48 | +#### Structure by Doc Type |
| 49 | + |
| 50 | +**README.md** (the front door): |
| 51 | +- One-liner description + badges |
| 52 | +- "What is this?" in 2-3 sentences |
| 53 | +- Quick install (copy-paste ready) |
| 54 | +- Minimal "Hello World" example that works |
| 55 | +- Link table to deeper docs |
| 56 | +- Requirements / compatibility matrix |
| 57 | +- Community links (Slack, Discussions, Stack Overflow) |
| 58 | +- Contributing pointer |
| 59 | +- License |
| 60 | + |
| 61 | +**Quick Start Guide** (< 15 minutes): |
| 62 | +- Prerequisites with exact version requirements |
| 63 | +- Step-by-step, numbered instructions |
| 64 | +- Every command is copy-paste ready |
| 65 | +- "You should see..." verification checkpoints after key steps |
| 66 | +- Link to "next steps" at the end |
| 67 | + |
| 68 | +**Conceptual Guides** (explain "why" and "how"): |
| 69 | +- Start with a one-paragraph summary of what the reader will learn |
| 70 | +- Use diagrams (Mermaid or ASCII) for architecture and data flow |
| 71 | +- Break into logical sections with clear headings |
| 72 | +- End each guide with "Related" links |
| 73 | + |
| 74 | +**API / Helper Reference**: |
| 75 | +- One page per module or helper group |
| 76 | +- Signature, parameters table, return value, exceptions |
| 77 | +- At least one usage example per method |
| 78 | +- For Ruby: follow YARD conventions (`@param`, `@return`, `@example`) |
| 79 | +- For TypeScript: follow TSDoc conventions (`@param`, `@returns`, `@example`) |
| 80 | + |
| 81 | +**Configuration Reference**: |
| 82 | +- Table format: option name, type, default, description |
| 83 | +- Group by category |
| 84 | +- Include example config file (annotated with comments) |
| 85 | + |
| 86 | +**Migration / Upgrade Guide**: |
| 87 | +- Version-to-version, with exact steps |
| 88 | +- "Breaking changes" section at top |
| 89 | +- "Deprecations" section |
| 90 | +- Automated migration commands if available |
| 91 | +- Before/after code comparisons |
| 92 | + |
| 93 | +**Troubleshooting / FAQ**: |
| 94 | +- Problem statement as the heading (what the user sees or encounters) |
| 95 | +- Cause explanation (1-2 sentences) |
| 96 | +- Solution with exact commands or code |
| 97 | +- "Still stuck?" pointer to community support |
| 98 | + |
| 99 | +**LLMs.txt** (AI-friendly docs): |
| 100 | +- `/llms.txt` with a structured overview and links to key pages |
| 101 | +- `/llms-full.txt` with complete documentation in a single Markdown file |
| 102 | +- Follow the llms.txt specification: title, description, sections with URLs |
| 103 | +- Include on every docs page: "Are you an LLM? View /llms.txt for optimized documentation" |
| 104 | + |
| 105 | +### Step 4: Cross-reference and link |
| 106 | + |
| 107 | +- Every guide should link to related guides |
| 108 | +- Every API method mentioned in a guide should link to its reference page |
| 109 | +- Add a "See also" or "Related" section at the bottom of each page |
| 110 | +- Verify no dead links (check file paths exist) |
| 111 | + |
| 112 | +### Step 5: Review with the user |
| 113 | + |
| 114 | +Present the generated docs and ask: |
| 115 | +- "Does this match how your project actually works?" |
| 116 | +- "Any terminology or naming I got wrong?" |
| 117 | +- "Anything missing for your users?" |
| 118 | + |
| 119 | +## Targeting Specific Files |
| 120 | + |
| 121 | +When invoked as `/docs <target>`: |
| 122 | +- If `<target>` is a file path: generate/update docs FOR that code file (inline comments, module-level docs, method docs) |
| 123 | +- If `<target>` is a directory: generate/update docs for the entire module |
| 124 | +- If `<target>` is a doc type keyword (e.g., "readme", "api", "quickstart", "migration", "troubleshooting", "llms.txt", "audit"): generate that specific doc type |
| 125 | +- If `<target>` is "audit": run a full gap analysis against the Quality Standard reference above and report findings |
| 126 | + |
| 127 | +## Language-Specific Conventions |
| 128 | + |
| 129 | +### Ruby |
| 130 | +- Use YARD doc format for all public methods and classes |
| 131 | +- `@param name [Type] description` |
| 132 | +- `@return [Type] description` |
| 133 | +- `@raise [ExceptionClass] when condition` |
| 134 | +- `@example` with realistic usage |
| 135 | +- `@see` for cross-references |
| 136 | +- Document `@option` for hash parameters |
| 137 | + |
| 138 | +### TypeScript / JavaScript |
| 139 | +- Use TSDoc for TypeScript, JSDoc for JavaScript |
| 140 | +- `@param name - description` |
| 141 | +- `@returns description` |
| 142 | +- `@throws {ErrorType} description` |
| 143 | +- `@example` blocks with realistic usage |
| 144 | +- Export documentation: what is public API vs. internal |
| 145 | +- Document generic type parameters |
| 146 | + |
| 147 | +### Markdown Docs |
| 148 | +- Use ATX headings (`#`, `##`, `###`) not Setext |
| 149 | +- Fenced code blocks with language identifiers (```ruby, ```typescript, ```bash) |
| 150 | +- Use reference-style links for repeated URLs |
| 151 | +- Tables for configuration options and API parameter lists |
| 152 | +- Admonitions for warnings and tips (use blockquote style: `> **Note:** ...` or `> **Warning:** ...`) |
0 commit comments