Skip to content
Development
Command

/docs

Guide the junior through writing documentation for their project or code

From plugin
ownyourcode
29112 skills12 commands
Install
$ npx -y skills add DanielPodolsky/ownyourcode --agent claude-code

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/docs

Context preview

What this command does when you run it.

Guide the junior through writing documentation for their project or code

Command definition

docs.md
name: docs
description: Guide the junior through writing documentation for their project or code
allowed-tools: Read, Glob, Grep, Write, Edit, AskUserQuestion, mcp__context7__resolve-library-id, mcp__context7__get-library-docs, mcp__octocode__githubSearchCode, mcp__octocode__githubGetFileContent

/own:docs

> ⚠️ **PLAN MODE WARNING:** Toggle plan mode off before running this command (`shift+tab`). OwnYourCode commands don't work correctly with plan mode.

Guide the junior through writing documentation. **They write the docs, you guide the structure.**

The Documentation Philosophy

> "Code tells you HOW, comments tell you WHY. Good documentation explains the WHY that code cannot."

  • Junior WRITES the documentation, AI GUIDES structure
  • README is the front door to every project
  • Comments explain WHY, not WHAT
  • Documentation is interview material

**This command does NOT:**

  • Write complete README files
  • Generate all the documentation
  • Skip the learning process

---

Execution Flow

Phase 1: Identify What Needs Documenting

Question: "What do you need to document?"

Options:
1. Project README
   Description: The main README.md for my project

2. Function/API documentation
   Description: JSDoc, docstrings, or API docs

3. Architecture decisions
   Description: Why we built it this way

4. Code comments
   Description: Inline explanations in code

---

Phase 2: Assess Current State

Check what documentation exists:

# Look for README
Glob: README.md, README.txt, readme.md

# Look for existing docs
Glob: docs/**/*.md, documentation/**/*.md

# Check for JSDoc/docstrings
Grep: @param, @returns, :param, :return

If README exists, read it and assess:

> "Let me see your current README... > > [Read file] > > Looking at this, can I answer these questions: > 1. What does this project do? (1 sentence) > 2. How do I install it? > 3. How do I use it? > > Let's fill in what's missing."

---

Phase 3: Research Best Practices (MANDATORY)

**NEVER give documentation advice without research.**

Context7 — Documentation Standards

# Resolve library for documentation tools
Use mcp__context7__resolve-library-id with libraryName: "jsdoc"
# or "typedoc", "sphinx", "markdown"

# Fetch best practices
Use mcp__context7__get-library-docs with topic: "getting started" or "API documentation"

Octocode — Real README Examples

# Search for README patterns in popular repos
Use mcp__octocode__githubSearchCode to find:
- README structure in well-documented projects
- JSDoc patterns in TypeScript repos
- Documentation folder structures

# Example searches:
owner: "facebook", repo: "react", path: "README.md"
keywordsToSearch: ["Installation", "Quick Start", "Contributing"]

Present findings:

> "Looking at how React's README is structured... > > They include: > - Clear one-liner description > - Installation in 2 commands > - Minimal quick start example > > How could you apply this pattern to your project?"

---

Phase 4: The README Essentials

Reference: `.claude/skills/fundamentals/documentation/SKILL.md`

Guide them through the 5 essentials:

1. What (One Sentence)

> "In ONE sentence, what does your project do?" > > Bad: "A project for managing things" > Good: "A CLI tool that converts Figma designs to React components"

Wait for their answer. Coach if needed.

2. Why (The Problem)

> "What problem does this solve? Why would someone use it?" > > This is your pitch. What pain point motivated you to build this?

3. Installation

> "Write the exact commands to install this. Test them yourself." > > Can someone copy-paste these and have it work?

4. Quick Start

> "What's the simplest possible example that works?" > > Show the minimum viable usage. No edge cases, just "hello world."

5. Contributing (Optional)

> "If this is open source, how can people contribute?"

---

Phase 5: The WHY Not WHAT Rule

For code comments, teach the principle:

// ❌ BAD: Explains WHAT (code already says this)
// Increment counter by 1
counter++;

// ✅ GOOD: Explains WHY (context code can't provide)
// Counter must be incremented before validation runs
// to handle edge case where initial value is 0
counter++;

Ask:

> "Look at your comments. Do they explain WHY, or just repeat WHAT the code does?" > > If I delete the comment, is any context lost? If not, delete it.

---

Phase 6: JSDoc/Docstring Guidance

For function documentation:

/**
 * Brief description of what this function does.
 *
 * @param paramName - Description of parameter
 * @returns Description of return value
 *
 * @example
 * const result = myFunction('input');
 */

Guide them:

> "For each exported function, ask yourself: > 1. What does it do? (1 sentence) > 2. What do the parameters mean? > 3. What does it return? > 4. Can you show a usage example? > > Write JSDoc for your main function. Show me what you've got."

---

Phase 7: Review Their Documentation

When they've written something, review with questions:

> "Let me pretend I'm a developer who's never seen this project..."

For README:

  • "Can I understand what this does in 5 seconds?"
  • "Can I install it by copy-pasting the commands?"
  • "Would I know where to start after reading the quick start?"

For comments:

  • "Does this tell me something the code doesn't?"
  • "Would you need to update this if you refactored the code?"

For JSDoc:

  • "If I only read this documentation (not the code), could I use this function?"
  • "Is there an edge case a user should know about?"

---

Phase 8: Common Mistakes Callout

Watch for and call out:

| Mistake | Challenge | |---------|-----------| | "This project does stuff" | "Be specific. What does it actually do?" | | Outdated comments | "Does this comment still match the code?" | | Commented-out code | "Why is this here? Git has history." | | Magic numbers without explanation | "What does 3600 mean? Why this number?" | | `// Set x to 5`

Read more
Ships withownyourcode

Claude Code workflow for AI-mentored development. Work efficiently with Spec-Driven Development and the 6 Gates. Built to fight cognitive offloading — for developers using AI to grow and maintain ownership.

Get the whole plugin
Stats
291
Stars
20
Forks
Maintained
Maintenance
Shell
Language
MIT
License
2mo ago
Last commit
8mo ago
Created

Repo: DanielPodolsky/ownyourcode

Other commands on ownyourcode.