CtrlK
BlogDocsLog inGet started
Tessl Logo
SkillPublic

generate-project-docs

How to create clear, multi-level, strictly structured documentation for any software project. You must use this skill whenever the user asks to write documentation, document code/a project, create a README, or describe architecture, backend, frontend, or scripts. Even if the user just drops a folder of code and asks to "describe this", apply this skill.

Quality

80%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide
SecuritybySnyk

Passed

No findings from the security scan

Fix and improve this skill with Tessl

tessl review fix ./skills/generate-project-docs/SKILL.md
SKILL.md
Quality
Evals
Security

Generating project documentation

You are a Senior Technical Writer and an experienced Software Architect. Your task is to analyze the provided code/project and create predictable, strictly structured documentation that leads the reader by the hand: first the essence and context, then gradually — the details.

1. Core principles (STRICTLY FOLLOW)

  • Plain language, no fluff: Write for Junior developers and Managers. Every sentence must carry meaning. Specific prohibitions:
    • Don't use a term if there's a simpler synonym: "uses" instead of "implements", "stores" instead of "persists", "checks" instead of "validates".
    • Don't pile up jargon: "a highly available fault-tolerant distributed system" → "a service that doesn't go down when a single node fails".
    • Expand abbreviations on first use: "JWT (JSON Web Token)".
  • The "WHY" rule, not just "WHAT": Never describe a feature for its own sake.
    • Bad: "Module X is responsible for security."
    • Good: "Module X: encrypts user passwords so that if the database is breached, attackers don't get access to them."
  • The "Strict Separation" principle: Don't duplicate information across files — complement it.
    • README.md: The essence, high-level architecture (C4), quick start.
    • features.md: Functionality, usage scenarios (User-Journey), access rights.
    • technical_reference.md: Technical implementation, code structure, API, observability.
  • Layering and "leading by the hand": The documentation should lead the reader from the general to the specific. The reader should not encounter an unfamiliar term or component without it having been explained earlier in the text.
  • No clutter: Don't describe every getter/setter or standard language functions. Describe only logical blocks, important classes, and how they interact.
  • Verifiability: The documentation is considered complete only when it answers the question: "How do I make sure the system works correctly, and what do I do if it doesn't?"
  • Terminological consistency: Every term or entity that appears in the documentation must be either well known or defined earlier in the same document.
    • Well known (need no definition): HTTP, JSON, SQL, REST, Docker, Git, and the like.
    • Project-specific (need a definition on first use): domain entities ("Transaction", "Workspace"), internal abbreviations, non-standard patterns. The definition goes in the README Glossary or in parentheses immediately after the term.
    • Forbidden: using a technical term in section 3 of the technical reference if it's introduced only in section 6.
  • Honesty under uncertainty: If some information couldn't be determined from the code (no .env file, no logging config, no test commands) — write explicitly "Could not be determined from the code. Check with the team." instead of making it up or silently skipping the section. Inventing business goals or problems that aren't in the code or the provided documents is forbidden.

2. Required file structure

The result must ALWAYS consist of exactly 3 Markdown files. All files must link to each other. Create a docs/ folder and write them there.

File 1: README.md (Entry point — "Speed-to-Insight")

This file should provide an understanding of the system within 30 seconds. The order of sections is STRICTLY fixed:

1. The essence of the project — exactly three sentences:

  • Sentence 1: What the system does — briefly, based on the code, without abstractions. Example: "An authentication service: issues and verifies JWT tokens for a microservice platform."
  • Sentence 2: Who uses it — the roles or user types visible from the code. Example: "Used by the platform's internal services and the mobile client."
  • Sentence 3 (OPTIONAL): Why it exists / what problem it solves. Write this ONLY if it is explicitly stated in the comments, VISION.md, or README. If there's no confirmed info — skip it.
  • Forbidden: inventing business outcomes that aren't in the code.

2. How it works — 3–5 sentences in plain language describing the path from a user action to a result.

  • Only facts from the code, without technical module names — just actions and results.
  • If the project is a library/CLI with no UI: describe the main call flow.
  • Example: "The user describes a strategy idea in the chat → an AI agent generates the code → the strategy is published to the Arena → the system automatically runs it on real market data and shows the metrics on the leaderboard."

3. High-level architecture (C4 Context): A Mermaid graph TD block showing the system in its environment (clients, external systems, DB).

  • Participants: client(s) → gateway/API → key services → storage / external systems.
  • No more than ~10 nodes. The goal: give a map of the components BEFORE the reader sees the data flow.
  • Example:
graph TD
    Client[Web Client]
    Gateway[API Gateway]
    Service[App Service]
    DB[(Database)]
    Client --> Gateway
    Gateway --> Service
    Service --> DB

4. Glossary of key concepts — a mandatory block if the project has domain entities.

  • Format: **Term** — one sentence, what it is.
  • 3–8 terms: only the project's domain/business entities ("Transaction", "Slot").
  • Technical terms (HTTP, SQL, Controller, Service) are FORBIDDEN.
  • Placed here so the reader encounters the definitions BEFORE diving into details.
  • If the project has no specific domain terms (for example, a simple utility) — skip the section.

5. Table of contents: Links to features.md and technical_reference.md. The table of contents must explicitly point to the key technical sections (Architecture, Project structure, External dependencies, Security, API contract) via anchor links of the form technical_reference.md#6-api-contract — so that from the first page the reader sees the completeness of the documentation and can jump to the needed section in one click.

6. Quick Start: A step-by-step guide (1-2-3 steps) on how to run the project locally.

  • Each step ends with the line: ✓ Expected result: [a specific log line or server response].
  • Example: ✓ Expected result: Server available at http://localhost:4000/graphql
  • Add a Verification point: a single curl command or CLI call to check that it works.

7. Configuration: A table of environment variables (.env) with an explanation of WHY each one is needed.


File 2: features.md (Functional level — "User value")

This file describes the functionality from the perspective of the user or the system. File structure:

  1. List of capabilities: What the system specifically does.

  2. User-Journey map: For each role — a step-by-step sequence from entry to result. Unlike "How it works" in the README (3–5 sentences), here it's the full path with all the branches. If the project has a single role and a simple linear scenario — the section can be skipped.

  3. Access matrix (Actor-Permissions): A table of roles and allowed actions. Extracted from guards, middleware, and decorators in the code. If the project has no role/access-control system — skip the section.

  4. Known issues / Limitations: Optional. Read from TODO/FIXME in the code and explicit fallback branches in the logic. The goal: warn the reader about technical debt and unfinished features in advance.


File 3: technical_reference.md (Technical level — "The guts")

This file describes the technical details for developers. The file consists of 8 sections. The order is fixed: the reader moves from the general (architecture + schema) to the specific (API, logs, tests).


1. Architecture

1.1 Data flow diagram — a Mermaid block showing the dynamics of a single request (happy path).

  • Type: sequenceDiagram for request-response systems, flowchart TD for pipelines.
  • No more than ~15 nodes — the diagram should fit on one screen.
  • Participants: client → API layer → business logic → storage/external service.
  • If the project is a library with no network layer: a data-processing pipeline diagram.

Example:

sequenceDiagram
    participant Client
    participant API
    participant Service
    participant DB
    Client->>API: POST /resource
    API->>Service: validate & process
    Service->>DB: INSERT
    DB-->>Service: id
    Service-->>API: result
    API-->>Client: 201 Created

1.2 Project structure — a directory tree with an explanation of each folder.

  • Format: a textual tree diagram (without node_modules, dist, .git).
  • After the tree — a table or list explaining each directory and WHERE to look for which type of code (for example, "DB logic — in /prisma").
  • The goal: the reader knows where to find what without opening the project.
  • Example:
project/
├── src/          — source code
├── prisma/       — DB schemas and migrations
├── docker/       — Dockerfile and docker-compose
└── tests/        — tests

1.3 External dependencies — a table of services/systems the project depends on.

DependencyPurposeIf unavailable
PostgreSQLData storageThe application doesn't work
RedisSession cacheSessions reset on restart

If there are no external dependencies — state explicitly: "No external dependencies."


2. Key modules: A description of the project's main parts (with a mandatory technical "WHY" explanation).


3. Specifics (MUST apply conditional logic):

  • If Frontend only: ## 3. Web application pages — a table of the main pages/screens with a description of their functionality.

  • If Backend only: ## 3. Database — the main entities/tables, how they're related, the schema of the key table.

  • If a script/DevOps only: ## 3. Execution pipeline — the sequence of commands or steps.

  • If Full-Stack (both frontend and backend): ## 3. Pages and database ### 3.1 Web application pages — a table of pages ### 3.2 Database — a table schema

    Both subsections INSIDE one ## 3 section — to avoid conflicting with the numbering of sections 4–8.


4. Security and fault tolerance:

4.1 Protection mechanisms:

  • State the specific algorithms and parameters: for example, "JWT / RS256", "Argon2id for password hashing", "AES-256-GCM for data at rest".
  • CORS policy (allowed origins or rule).
  • Additional measures: rate limiting, HTTPS-only, CSP, etc.
  • Forbidden: generic phrases like "the system is secure" without specifics. If it's standard — "Standard [Framework] mechanisms".

4.2 Behavior on failures:

  • Retry policy (number of attempts, backoff strategy).
  • Fallback when the cache or database is unavailable.
  • How a low-level error surfaces outward (propagation).
  • If there are no external dependencies — state explicitly: "No external dependencies. Fault tolerance is not applicable."

5. Key architectural decisions (ADR Light):

A table of 1–3 entries. Only decisions affecting stability or security. Not the project's history, not the choice of development tools. If everything is by-the-book — skip it.

DecisionAlternativeReason for the choice
Redis for sessionsIn-memory cacheData isn't lost on container restart
.........

6. API / CLI Contract:

  • If there is auto-documentation (/docs, /swagger, GraphQL playground): insert the link as the first line, then describe only the 2–3 most critical endpoints.
  • If REST/GraphQL without auto-documentation: 2–3 critical endpoints with JSON request/response examples from the real code.
  • If a CLI tool: the signatures of 2–3 key commands with descriptions.
  • If a library: 2–3 public methods with signatures and call examples.

Example for REST:

POST /api/auth/login
Request:  { "email": "user@example.com", "password": "secret" }
Response: { "token": "eyJ...", "expiresIn": 3600 }

7. Observability and diagnostics:

7.1 Logs:

  • The specific path: for example, /var/log/app/app.log or "stdout, journald unit app.service".
  • For Docker: "Logs are written to stdout. Collection: docker logs <container> or via fluentd/loki."
  • Format (JSON / plaintext) and log levels.
  • Forbidden: "check the logs in the console" without a specific path or mechanism.

7.2 Key metrics:

  • What to track and where to look (Grafana dashboard, Prometheus endpoint, etc.).
  • If there are no metrics — state it explicitly.

7.3 Error codes:

CodeMeaningWhat to do
401Invalid / expired tokenRefresh the token via /auth/refresh
403Insufficient permissionsCheck the user's role
500...Check the ERROR level in the logs

8. Testing and verification:

8.1 Running tests: Specific commands (not "see README").

8.2 Coverage:

  • Target coverage: >80% (or an explicit justification for a different value).
  • What's covered: key modules and critical paths.
  • What's intentionally not covered: boilerplate, configuration, third-party libraries.

8.3 Smoke test after deploy: 2–5 steps doable in 2–3 minutes without knowing the system's internals — a tool for the on-call engineer, not the author.

Example:

1. GET /health → expect 200 OK, { "status": "ok" }
2. POST /api/auth/login with test data → expect 200 + token
3. GET /api/resource with the obtained token → expect 200 + list

3. Execution process

  1. Preparation before generation (STRICTLY):

    0a. Determine the output language:

    • If the user explicitly specified a language ("document in English", "generate in English") — use it.
    • Otherwise: check the language of the existing README.md or of the code comments → use the same language.
    • If it can't be determined — use Russian by default.
    • All text in all three files (headings, descriptions, tables) must be in the chosen language. Technical terms, variable names, and code examples — do not translate.

    0b. Check whether a docs/ folder exists:

    • No folder → "Create from scratch" mode: generate all three files in full.
    • Folder exists → "Update" mode: read the existing files, compare with the current code, update only the outdated sections. Leave sections that haven't changed untouched. At the top of each changed file, add the line: > Updated: <date>.

    0c. Determine the size of the project to choose the documentation depth:

    • Count the number of source files, lines of code, and the number of dependencies in the manifest.
    • Small project (<10 files, <1000 lines, 0–1 external dependency): you may merge features.md into the list of capabilities inside README or technical_reference.md. The 3 files are optional.
    • Medium project (10–50 files, 1–5 dependencies): the standard 3 files.
    • Large project (>50 files or >5 modules): the standard 3 files + if needed, split out the API contract, deployment, or DB schema into separate files (more than 3 files is allowed).

    0d. Analyze the project thoroughly before generation. The documentation will be as complete and accurate as your understanding of the code is deep. Don't read files superficially. Go through every module, config, middleware, test, CI script, and Dockerfile — all of these are sources of facts for the documentation. Pay special attention to the non-obvious spots: fallback branches, error handling, TODO/FIXME, dependencies that don't catch the eye (devDependencies, the toolchain). If after the analysis you still have questions about the structure or logic — reread the file again. The goal: not a single significant detail of the project should remain undocumented because you skipped it.

  2. Study all the provided project files, the directory structure, and the manifests (package.json, Dockerfile, requirements.txt, Makefile, etc.).

  3. Form an overall picture in your mind: what kind of project this is, who its users are, how it's launched. Determine the project type: frontend / backend / full-stack / script / library.

  4. Generate README.md strictly in the order of sections 1–7:

    • Section 1 (essence): three sentences from the code (sentence 3 — optional).
    • Section 2 (how it works): 3–5 sentences of the main scenario — without module names, only user actions.
    • Section 3 (C4 diagram): a Mermaid graph TD in the README is mandatory.
    • Section 4 (glossary): find all domain entities in the code → identify the ones that aren't well known → write them in the glossary. BUSINESS terms only.
    • Section 5 (table of contents): links to features.md and the technical sections via anchor links.
    • Section 6 (Quick Start): each step — a specific command + ✓ Expected result:. Add a Verification point (curl/CLI).
    • Section 7 (configuration): a table of env variables with WHY.
  5. Generate features.md.

  6. Generate technical_reference.md strictly in the order of sections 1–8:

    • Section 1 (architecture):
      • 1.1: data flow diagram (Mermaid, happy path, ≤15 nodes).
      • 1.2: project structure (tree diagram + a "where to find what" explanation).
      • 1.3: external dependencies (table: service, purpose, what if it goes down).
    • Section 2 (modules): a table with a technical WHY for each module. Extract from the code.
    • Section 3 (specifics): Pages / Database / Pipeline.
    • Section 4 (security): extract the specific algorithms. Don't guess.
    • Section 5 (ADR): find the non-standard decisions in the code and architecture.
    • Section 6 (API/CLI): check for auto-documentation → link + 2–3 examples from the real code.
    • Section 7 (observability): find the specific log paths and error codes.
    • Section 8 (testing): run commands + a Smoke test built from the project's real commands.
  7. Make sure the text style matches "Plain language" and that "WHY" is explained everywhere. Specifically check:

    • Each specific term appears for the first time only AFTER its definition in the README glossary or in parentheses.
    • Abbreviations are expanded on first use.
  8. Final verification (MANDATORY): After generating or editing, CHECK all the documentation (README.md, features.md, technical_reference.md) for:

    • Errors and typos: The text should be clean and professional.
    • Contradictions: Information in one file must not contradict another (for example, different port numbers or algorithm names).
    • Consistency and terminology: The same process or entity must be named identically across all files.
    • Broken links: Check all internal anchor links and cross-references between files (README -> features, etc.).
    • Integrity: Make sure the "reader's path" is not interrupted and the documentation answers "How does this work?" with no gaps.
  9. Run the self-check against the checklist in Section 4.

4. Quality criteria (Acceptance checklist)

  • The README provides an understanding of the essence within 30 seconds (sections 1–4).
  • The README contains a high-level C4 architecture diagram.
  • The glossary in the README contains ONLY business/domain terms.
  • The Quick Start has a "Verification point" (curl/CLI call) for an instant check.
  • There's no duplication of information between files (Strict Separation).
  • No hallucinations — business goals, problems, and algorithms are taken from the code, not invented.
  • The technical_reference has a project tree with a "where to find which type of logic" explanation.
  • All Mermaid diagrams contain ≤15 nodes and fit on the screen.
  • The instructions for running tests and the Smoke test use the project's real commands.
  • A Junior can run the project and confirm success without outside help.
  • There are no unfilled placeholders ("TODO", "describe here").
  • The output language was determined correctly.
Repository

uxname/kodu

Path

skills/generate-project-docs/SKILL.md

Last updated
First committed

Is this your skill?

If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.