Skip to content
Back to skills

Docs

ASecurity

Writes per-feature technical docs for a directory of the project — one Markdown page per macro feature, an architecture page, an index and a single-file HTML site under <target>/docs/ — for a newcomer who doesn't know the framework. Also updates docs it generated before.

  • 4 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 5, 2026
developmentpythongobashsqlnodeexpressrailsgitapidatabase

Works with

  • cli
  • api

Security analysis

A100/100

Scanned December 5, 2026

npx -y skills add gorec96/sdd-skills --skill docs --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Docs?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Docs
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/gorec96-docs/badge)](https://www.skillsdirectory.com/skills/gorec96-docs)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: docs
description: Writes per-feature technical docs for a directory of the project — one Markdown page per macro feature, an architecture page, an index and a single-file HTML site under <target>/docs/ — for a newcomer who doesn't know the framework. Also updates docs it generated before.
argument-hint: "[target directory] [instructions]"
disable-model-invocation: true
allowed-tools: AskUserQuestion Read Write Edit Bash Grep Glob
metadata:
  author: Salvatore Greco
---

# Docs — per-feature technical documentation

`{plugin}` is `${CLAUDE_PLUGIN_ROOT}`, `{root}` the current directory. A reference under `{plugin}/references/docs/` that points to `../../skills/docs/SKILL.md` §N means the section §N of this file. Every question to the user goes through `AskUserQuestion`; without it (a headless session) print the question with its numbered options and end the turn.

Mission: produce a documentation set that lets a newcomer who **doesn't know the framework** understand **how the codebase is organized** and **who does what** — not the business logic. Output is a folder of numbered Markdown files (one per macro feature) plus a single-file navigable HTML site. Done right, a developer who has never seen the project opens `docs/README.md` and within two minutes can name every macro feature, recognise the layering convention, and find the file owning a specific responsibility.

## Principles

- **Codebase first, interview second.** Read the code before writing; the only mandatory question is the §3 feature-list confirmation, everything else comes from files.
- **Framework-agnostic prose.** Describe roles in generic terms — *route handler*, *business layer*, *data access*, *request guard*, *configuration loader*. Do **not** say "this is like Laravel's X" or "in Rails terms…": the reader's background is unknown.
- **Show structure, not logic.** A feature page lists endpoints, files, data shape, dependencies. It does **not** explain *why* a certain business rule exists or walk through the algorithm of `calculateScore()`, and it describes *what is*, never *what should be*.
- **Dense tables over walls of prose**, below the separator: endpoints with permission columns, file roles, status transitions.
- **No invention.** Every statement traces to code you read; unsure between two interpretations, read more code or omit.
- **Project vocabulary wins.** The memory terms (`### ` headings in `{root}/.ai/memory/*.md`) name things in every page, over any synonym their `_Avoid_` lines rule out. None, no constraint.
- **Cross-link liberally.** When feature A's data references feature B, link `[B](NN-b.md)`.
- **Write only under `<target>/docs/`.** Bash is for reading, the lint script and building the site; never run the app, its tests or anything with side effects. Commit nothing.

## Target

The arguments, or the user's request, name the target — the directory whose code is documented, under `{root}` (`{root}` itself for the whole project); output always goes under `<target>/docs/`. No target named → list `{root}` and ask which, the candidates as options — typically `{root}` itself, or one of `apps/*`, `services/*`, `packages/*` in a monorepo. Other instructions in the request (a feature to leave out, a grouping) win over your recon.

`<target>/docs/` already exists → run § Update mode before §1.

## Language

The docs prose, and every message to the user, follow `.ai/.language` when the project has one, otherwise the language of the user's request. Doc-page filenames and section headings follow the docs language too — humans read them, no script parses them. The canonical filenames (`00-architettura-generale.md`, `NN-infrastruttura-comune.md`) and section headings ("Dettaglio tecnico", "File e responsabilità", …) are localized to the docs language at *generation* time; in update mode, match whatever filenames and headings the existing docs already use. The Italian names used throughout this file and its references are the worked example for `it`.

## Conventions

- Every generated `.md` page starts with `<!-- @generated: YYYY-MM-DD -->` on its first line — update mode dates the page with it.
- Headings: `#` for the page title, `##` for top-level sections inside a page, `###` for subsections.
- Code blocks: triple backticks with a language identifier whenever syntax matters.
- Tables for any structured list (endpoints, files, transitions). Plain bullets only for cross-references and 1-line lists.
- No emoji unless the user explicitly asks.
- Always relative links between docs (`[B](NN-b.md)`); links to source files use `../path/to/file` from the docs folder.
- Cross-page links target pages only (`NN-x.md`), never `NN-x.md#section` anchors: the HTML site can't resolve them.

### Writing rules

These five rules hold for every generated page.

1. **Sentence length** — every sentence stays within 25 words: 25 exactly passes, 26 gets rewritten. A sentence long only because it carries an inline list becomes a bullet list, never a compressed sentence.
2. **Bold** — bold marks status names and enum values only, and only where the word denotes the state: `open` the status is bold, "open" the adjective is not. Never bold for emphasis.
3. **Domain terms** — every domain or stack term gets half a line of explanation at its first occurrence in the page, and only there. A term defined in the memory reuses that entry shortened, never a new definition. A page with no domain terms adds nothing: no forced glossary. The half-line repeats on each page that uses the term.
4. **No nested bullets** — no generated page contains a nested bullet list. Genuinely hierarchical content (a folder tree) becomes a code block instead.
5. **Page length** — every page stays within 120 lines. A page at 121 splits into `NN-{slug}-1.md` and `NN-{slug}-2.md`: same `NN` so no cross-link breaks and no other page renumbers, no content cut, both listed in the §7 index and the §9 sidebar.

## 1. Recon — build a mental map

Goal: the architectural shape, before the feature list. Read `{plugin}/references/docs/recon-guide.md` now (per-stack conventions, cross-cutting checklist, anti-patterns), then in order:

1. **Orientation** — `<target>/README.md`, `<target>/CLAUDE.md`, repo-root `README.md` and `CLAUDE.md`; the stack manifest (`package.json`, `pyproject.toml`, `go.mod`, …); the entry points; the top-level layout of `<target>` and of its `src/` (or equivalent).
2. **Feature container** — the folder where each subfolder is one macro feature (conventions per stack in the guide). None obvious → each top-level directory under `src/` (or equivalent) is a candidate.
3. **Shared folder** (`src/common/`, `src/shared/`, `pkg/`, `lib/`, `src/core/`) → the candidate for the "infrastruttura comune" page (§6).
4. **Cross-cutting layer** — global middleware, guards, validation, auth, error filters, logging setup, request context → feeds `00-architettura-generale.md`.
5. **Sample endpoints** — one or two controllers / route files, for the routing convention (path prefix, versioning, auth pattern) §5 needs.

## 2. Decide the documentation set

Always: `README.md`, the index (§7); `00-architettura-generale.md` (§5); one `NN-{feature}.md` per macro feature confirmed in §3; `index.html`, the site (§9). When §6 applies: `NN-infrastruttura-comune.md`.

**Numbering convention** — a 2-digit prefix (`01`, `02`, …) in reading order: `00` for architecture, then foundational features (auth/users/tenants/orgs), then domain features; cross-cutting infrastructure takes the first number after the last feature, so it sits at the end as a reference.

**Filename slugs** — kebab-case, max 3 words, matching the source folder when possible (`auth.md`, `node-assignments.md`, `email-templates.md`).

## 3. Confirm the macro-feature list

Wrong groupings ruin the entire output, so this question is never skipped. Show the proposal in chat, in the shape of `recon-guide.md` § Come presentare la lista all'utente:

- The candidate list with proposed numbering, slug, and one-line description per feature (from your recon).
- Which folder/path each candidate maps to.
- Whether a `NN-infrastruttura-comune.md` will be produced.
- In update mode, the delta (`update-mode.md`).

Then ask:

1. `Proceed with this list (Recommended)`.
2. `Change the list` — the user replies in free text with edits (rename, merge, split, drop, add). Apply them, then ask again with the corrected list.
3. `Cancel` — end with nothing written.

A request that already fixes the list, or says to skip this confirmation, waives the question — except an update that would regenerate a page carrying manual edits (`update-mode.md` step 3): that destroys work you did not create, so it is still asked.

## 4. Generate the feature pages

For each confirmed feature, write `NN-{slug}.md`. The canonical section order is below and fixed, a section that doesn't apply skipped — consult `{plugin}/references/docs/feature-page-structure.md` only when a section's good/bad shape is unclear from this list, `{plugin}/references/docs/example-feature.md` for a whole page:

1. **Generation marker + title**: the marker (§ Conventions), then `# NN — {Feature name}`.
2. **Opening sentence** — one sentence saying what the feature does, straight under the title. No heading above it, no bold, no term left unexplained.
3. **Numbered steps** — what happens when the feature runs, in at most 7 steps, straight after the opening sentence. A longer flow gets grouped into 7 blocks and the rest goes below the separator. A feature with no flow (constants, utilities) omits the steps rather than inventing them.
4. **`## Dettaglio tecnico`** — the separator. Its first line is the folder link: `> Cartella: [\`path/to/folder/\`](../path/to/folder/)`. Omit the whole separator when the feature has no technical detail to list.
5. **File e responsabilità** — table: file → role (one line each), **at most 7 rows**. More relevant files than that: keep the 7 that make the feature understandable and add one last row linking the folder for the rest. A single-file feature still gets the table. A feature with no folder of its own lists the files where it lives, wherever they are. Skip generated/spec files unless they expose intent.
6. **Endpoint** (when the feature exposes HTTP/RPC/CLI or jobs) — table: method, path, who-can-call, what-it-does. If there are admin-only endpoints, split into a second table.
7. **Modello dati** — bullet list of the entity's fields with one-line meaning. Omit Mongo/SQL specifics unless they shape behavior. Mention immutable/server-managed fields explicitly.
8. **State transitions / business rules at the boundary** (only if present in code) — tables for status transitions, validation rules expressed as code (not your invention).
9. **Sicurezza / scope / permissions** — how the feature enforces tenant/role/scope access. Reference the guards by name from the architecture page.
10. **Interazioni con altri moduli** — bullet list: "feature B → has FK on X", "feature C → fires events on Y". An extra section the feature needs (list filters, constraints) sits between Modello dati and this one.

**The readable part** runs from the title to the separator and is written for someone who has never opened the code: no path, no class name, no HTTP method, no field name. Links to other doc pages (`[B](NN-b.md)`) are navigation and stay allowed. Every product or technology named there carries two plain words saying what it is, at its first occurrence only, unless the name already says it (`database`, `email`).

**Write features in batches** using parallel Write calls when independent. Read related controllers/services/schemas first.

## 5. Generate `00-architettura-generale.md`

The canonical sections are below and are complete — consult `{plugin}/references/docs/architecture-page-structure.md` only when a section's shape or don'ts are unclear from this list, `{plugin}/references/docs/example-architecture.md` for a whole page:

1. **Opening sentence** — one sentence saying what this codebase does, straight under the title, in the same readable shape as a feature page (§4): no heading, no path, no class name. A short plain-language paragraph may follow it.
2. **`## Dettaglio tecnico`** — the separator, then the elevator pitch (what stack, what data store, what protocol, what tenant model).
3. **Cartelle che contano** — annotated tree of the top-level layout, one line per folder.
4. **Cosa succede quando arriva una richiesta** — step-by-step ASCII flow from inbound request → response, including every global middleware/guard/pipe in execution order, with what each one checks and the error if it rejects.
5. **I tre strati (or "I N strati")** — table: Layer → does → does not. The split the code actually uses (Controller/Service/Repository, handler/usecase/gateway, route/action/model, …), never an imposed one.
6. **Ruoli e permessi** — the user roles the code defines (e.g. `platformRole`, `tenantRole`, RBAC roles in middleware), one line each.
7. **Convenzioni di errore** — the error envelope shape (JSON schema), the most common status codes and what they mean in *this* project.
8. **Versioning** — only if the project versions its API.
9. **Stack riassuntivo** — table: piece → technology. No analogies.
10. **File da non perdere** — 4–6 links to the absolute most important files (entry point, root module, bootstrap, env schema).

## 6. Generate `NN-infrastruttura-comune.md` (if applicable)

Skip when the shared folder contains only `utils.ts` or one-liner helpers. Generate when it owns guards, middleware, base repositories, error catalogues, validation pipes, request-context machinery — then read `{plugin}/references/docs/infra-page.md` now: page shape and sections.

## 7. Generate `README.md` (the index)

Sections:
1. **Title** + the opening sentence ("Documentazione 'umana' del {progetto}, pensata per chi …"). The README carries no `## Dettaglio tecnico`: it is readable from top to bottom.
2. **Versione navigabile (HTML)** — short paragraph: open `index.html` in a browser, no server and no network needed.
3. **Come è organizzato il backend/codice** — 4–6 line intro paragraph explaining the layering, naming, and how to read what comes next, in the project's own terms.
4. **Struttura della documentazione** — grouped list of links to all pages, ordered by reading order. Pick the grouping that fits the project (e.g. "Fondamentali", "Auth e utenti", "Trasversali", "Riferimenti").
5. **Riassunto delle feature** — table: # | Feature | One-line description.

## 8. Quality pass

Runs after every Markdown page is written and **before** `index.html` — the site embeds the text, so a page corrected later ships wrong.

1. `python3 {plugin}/scripts/lint-docs.py <target>/docs/` — it counts what is countable, each violation labelled with its rule.
2. Reread every page for what no script catches: the opening sentence and the numbered steps (§4, items 2–3), the two plain words on each product name (§4, the readable part), bold used for emphasis (rule 2), an unexplained domain term (rule 3).
3. Fix what both passes found, then re-run the script. **Two passes per page, no more**: a page still red after the second is reported and left alone, so a sentence-length / opening-sentence conflict cannot loop.
4. A correction that would require asserting something you cannot verify in the code is not made. The violation stays and gets reported.
5. Keep one line per page for the report, then move on to §9:

   ```
   11-positions.md: 3 corrections (2 script, 1 reread)
   00-architettura-generale.md: 0 corrections
   04-billing.md: 1 correction · left as is: sentence-length line 62 (shortening it would invent a claim)
   ```

## 9. Generate `index.html` (the HTML site)

The site is **self-contained**: every page's text and both libraries live inside the file, so it opens on a double click with no local server and no network.

**Never read `{plugin}/references/docs/templates/index.html`** — tuned CSS/JS, ready as is: its styling, JS routing and marked.js config stay untouched. Copy it and fill its 21 placeholders following `{plugin}/references/docs/html-site-guide.md` § Procedura — read that guide now: steps, placeholder inventory, working snippet. A site that would exceed ~2 MB is not written: ask which pages to leave out of the site, or whether to write it anyway.

## 10. Report

In chat: `Docs written: {N} pages + index.html in <target>/docs/`, then one line per generated file with its line count and a short descriptor, and how to read it — open `<target>/docs/index.html` in a browser. Then §8's per-page lines, the pages left red and why, and the confirmed feature list with any change the user made to it.

The user's feedback after the report (a page to change, a feature to add or remove, a different grouping): apply it, then rerun §8 on the pages touched and §9.

## Update mode

When `<target>/docs/` already exists, check the **fingerprint** first: a `README.md` whose feature table matches `# | Feature | …` **and** at least one `NN-*.md` page.

- **Both present** → these docs were generated by this skill: proceed in update mode.
- **Fingerprint absent** (hand-written docs, Docusaurus/MkDocs output, anything else) → overwriting someone else's docs is destructive: ask first. Options: overwrite / write elsewhere (the user names the new target) / cancel, with `Cancel (Recommended)`.

Update mode steps — delta, what to regenerate, what to preserve: `{plugin}/references/docs/update-mode.md`. Only in update mode, read it now, before §1.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.