Skip to content
Skills Library
Programming · Writing

docgen

/docgen

Use when user invokes /docgen to generate or update documentation. Also triggers on "generate docs", "update the README", "write the changelog". Accepts a doc type (readme, api, architecture, changelog) and optional scope. Always outputs to conversation first and asks before writing to disk. Do NOT use for explaining code behavior — use /explain instead.

Repository
harness-kit ↗
Licence
Apache-2.0
Last repository change
26.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
2
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 26.10.2026, without references to retired models or APIs.

Licence

Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.

What it does and when to use it

Use when user invokes /docgen to generate or update documentation. Also triggers on "generate docs", "update the README", "write the changelog". Accepts a doc type (readme, api, architecture, changelog) and optional scope. Always outputs to conversation first and asks before writing to disk. Do NOT use for explaining code behavior — use /explain instead.

Triggers from the description

generate docsupdate the READMEwrite the changelog
Original author description

Use when user invokes /docgen to generate or update documentation. Also triggers on "generate docs", "update the README", "write the changelog". Accepts a doc type (readme, api, architecture, changelog) and optional scope. Always outputs to conversation first and asks before writing to disk. Do NOT use for explaining code behavior — use /explain instead.

How it works

  1. Overview
  2. Invocation Examples
  3. Workflow Order (MANDATORY)
  4. Scope Controls
  5. Common Mistakes
Original SKILL.md headings · 212 lines, 1,088 words
SKILL.md preview
---
name: docgen
description: Use when user invokes /docgen to generate or update documentation. Also triggers on "generate docs", "update the README", "write the changelog". Accepts a doc type (readme, api, architecture, changelog) and optional scope. Always outputs to conversation first and asks before writing to disk. Do NOT use for explaining code behavior — use /explain instead.
---

# Documentation Generator

## Overview

Generate or update project documentation from the codebase — READMEs, API references, architecture overviews, and changelogs. Designed to produce accurate, non-padded docs that match the project's existing style.

**Core principles:**
1. **Generate to conversation first.** Never write a file without asking. Always: "Want me to write this to [path]?"
2. **Preserve manual content.** If a doc already exists, identify what's outdated vs. what to keep. Don't blow away prose that was written by hand.
3. **Detect existing style.** Match the formatting, heading levels, and tone of existing docs in the project.
4. **No filler.** Omit empty or generic sections rather than padding them with boilerplate.

## Invocation Examples

```
/docgen readme                          # generate or update project README
/docgen readme src/auth/                # README for a subdirectory or package
/docgen api src/routes/                 # API endpoint documentation
/docgen architecture                    # architecture overview from codebase structure
/docgen changelog v0.2.0..v0.3.0       # changelog from git history for a version range
```

## Workflow Order (MANDATORY)

**You MUST follow this order. No skipping steps.**

---

### Step 1: Parse Input

Determine doc type and scope:

| Doc Type | Detection | Scope Default |
|----------|-----------|---------------|
| `readme` | First arg is "readme" | Project root or specified path |
| `api` | First arg is "api" | Specified path (required); error if missing |
| `architecture` | First arg is "architecture" | Project root |
| `changelog` | First arg is "changelog" | Optional git range (e.g. `v0.2.0..v0.3.0`); defaults to recent history |

If no argument or unrecognized type: say "Usage: `/docgen readme`, `/docgen api src/routes/`, `/docgen architecture`, `/docgen changelog [range]`." Then stop.

If `api` is invoked without a path: say "Please provide a path. Example: `/docgen api src/routes/`." Then stop.

---

### Step 2: Gather Context

Context to gather varies by doc type:

**readme:**
- List the project root (or specified subdirectory) to understand structure
- Read `package.json`, `go.mod`, `pyproject.toml`, or equivalent (for name, version, description, dependencies)
- Read entry point files (main, index, cmd/) — top 3-5 most important
- If a CLAUDE.md exists at the project root, read it (especially Architecture and Commands sections)
- Read any existing README to understand what's already there

**api:**
- List and read the specified directory (routers, handlers, controllers)
- Identify route definitions: look for patterns like `router.GET`, `app.post`, `@app.route`, `r.HandleFunc`
- Read the top 5-10 route-defining files
- Note authentication patterns, request/response shapes (from types, schemas, or inline validation)

**architecture:**
- Get the directory tree (2-3 levels deep)
- Read CLAUDE.md if it exists (Architecture section)
- Read the primary entry point(s)
- Identify key packages/modules and their roles from structure + names

**changelog:**
- Run `git log --oneline [range]` to get commits
- If no range given, use recent commits since last tag: `git log $(git describe --tags --abbrev=0)..HEAD --oneline`
- Group commits by conventional commit type (feat, fix, docs, refactor, chore, perf, test)
- Deduplicate: merge commit messages, fixup commits, and WIP commits are filtered out

---

### Step 3: Check Existing Docs

Before generating, check whether the target doc already exists:

- If **no existing doc**: generate from scratch
- If **existing doc found**: read it fully, then identify:
  - Sections that are outdated (version numbers, stale API descriptions, removed commands)
  - Sections that look manually written (custom prose, examples, migration notes) — **preserve these**
  - Sections that can be regenerated cleanly (install commands, dependency lists, endpoint tables)
  - State your preservation plan: "I'll keep the Deployment section as-is and regenerate Install and API sections."

---

### Step 4: Generate Document

Produce the document in the conversation. Structure by type:

**readme:**
```
# <project name>

<1-2 sentence description — what it does and who it's for>

## Install
<install command(s)>

## Usage
<primary usage pattern with example>

## Architecture  (omit if trivial)
<brief description of key components>

## Configuration  (omit if none)
<key config options>

## License
<license name>
```

**api:**
```
# API Reference

## Endpoints

| Method | Path | Auth | Description |
|--------|------|------|-------------|
| GET | /api/users | JWT | List users |
...

## <Endpoint Group Name>

### GET /api/users/:id
<description>

**Request**
- Path params: `id` (string) — user UUID

**Response**
- 200: `{ id, name, email, createdAt }`
- 404: `{ error: "not found" }`
```

**architecture:**
```
# Architecture

## Overview
<2-3 sentences: what the system does, how it's structured>

## Components
<table or list of top-level packages/modules with one-line descriptions>

## Data Flow
<how data moves through the system — input → processing → output>

## Key Files
<table: file/path → purpose>
```

**changelog:**
```
## <version or date range>

### Added
- <feat: commits>

### Fixed
- <fix: commits>

### Changed
- <refactor:, perf: commits>

### Internal
- <docs:, chore:, test: commits — summarized, not listed verbatim>
```

Apply style matching: if the existing project uses `##` for top-level sections, match that. If it uses sentence case headings, use sentence case.

---

### Step 5: Present for Review

After outputting the document to the conversation, ask:

```
Want me to write this to [path]?
```

If the user says yes: write the file using the Write or Edit tool.
- If updating an existing doc: use Edit for targeted changes, Write only for full replacement.
- Prefer Edit when preserving large sections of existing content.

If the user requests changes: make them in the conversation first, then ask again before writing.

---

## Scope Controls

- Output to conversation first — always ask before writing to disk
- Do not modify files that weren't specified in the invocation
- Preserve manually written prose — only regenerate stale or mechanical sections
- No file writes without explicit user confirmation ("Want me to write this to [path]?")

## Common Mistakes

| Mistake | Fix |
|---------|-----|
| Writing files without asking | Always confirm with "Want me to write this to [path]?" before writing. |
| Blowing away manual content | Read existing doc first. Identify what to preserve. State preservation plan before generating. |
| Padding empty sections | If there's no configuration, omit the Configuration section. No filler. |
| Dumping git log verbatim into changelog | Group by type. Deduplicate. Filter noise. The changelog should be readable, not a raw log. |
| Using wrong heading style | Match the project's existing doc style — check for `#` vs `##` top-level, title case vs sentence case. |
| Generating api docs without reading routes | Always read the actual route definition files, not just a description. |
Files in this package (2)
  • README.md 1 KB
  • SKILL.md 7 KB

Versions

RepositoryScoreLicence
This page · harnessprotocol/harness-kit100Apache-2.0
cofin/flow100Apache-2.0
tsaol/awesome-claude100MIT
AsiaOstrich/universal-dev-standards95MIT
AsiaOstrich/universal-dev-standards95MIT

Database snapshot: 13.11.2026 · package version bb360140986c (SHA-256 digest of the entire package)

Downloads in the last 30 days: 1 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100documentation-guide
    Guide documentation structure, content requirements, and project documentation best practices. Use when: creating README, documentation, docs folder, project setup, technical docs. Not for: generating docs mechanically from source — use /docgen; changelog entries — use…
  • 96create-readme
    Use when generating or updating a project README.md or CHANGELOG.md.
  • 100docs-generate
    Generate or update docs from code annotations, docstrings, and git history. Use when wanting API reference, README from code, or CHANGELOG from conventional commits.
  • 84documentation-guide
    引导文档结构、内容需求与项目文档的最佳实践。 Use when: 创建 README、撰写文档、规划 docs 目录、项目初始设置、技术文档。 Not for: 从源代码机械式生成文档——请用 /docgen;变更日志条目——请用 /changelog。 Keywords: README, docs, documentation, CONTRIBUTING, CHANGELOG, ARCHITECTURE, API docs, 文档, 说明文档, 技术文档.
  • 100code-documentation
    Use this skill when the user requests to generate, create, or improve documentation for code, APIs, libraries, repositories, or software projects. Supports README generation, API reference documentation, inline code comments, architecture documentation, changelog generation, and…
  • 100update-docs
    Use when a ticket requires documentation to reflect a change — a README, API reference, changelog, or runbook — or when an acceptance criterion says "document X". Invoke for "update the docs for the new endpoint", "add a changelog entry", or "the README is now wrong".

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.