Generate and maintain project documentation. Creates a lean README as a landing page with detailed docs pages split by topic in the configured docs directory. Use when user says "create docs", "write documentation", "update docs", "generate readme", or "document project".
76%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
Fix and improve this skill with Tessl
tessl review fix ./skills/aif-docs/SKILL.mdBefore mode routing or work, read existing files relative to the current project root in this order (reuse them if already loaded):
.ai-factory/skill-context/global-skill-context.md — all bundled skills..ai-factory/skill-context/aif-docs/SKILL.md — this skill.Missing files are skipped; an existing unreadable file stops dependent work with its path.
Precedence: individual > build (when applicable) > global > skill defaults; retain non-conflicting instructions and check all outputs against the effective rules.
These layers customize workflow; they do not replace the project's rules/architecture hierarchy or relax explicit requirements, ownership, scope, safety/privacy, validation, or approval boundaries. Report conflicts with those boundaries instead of overriding them.
global is a project-local layer, not home-directory configuration. Custom/extension skills do not automatically use it.
Generate, maintain, and improve project documentation following a landing-page README + detailed docs-directory structure.
paths.docs, default: docs/). Each file is self-contained — one topic, one page. A user should be able to read a single doc file and get the full picture on that topic.[← Previous Page](prev.md) · [Back to README](<docs-to-readme-link>) · [Next Page →](next.md). First page has no prev link; last page has no next link. Every page ends with a "See Also" section linking to 2-3 related pages.docs/workflow.md by default). Between doc pages in the same directory: workflow.md.references/REVIEW-CHECKLISTS.md before readability review. Preserve obligations, permissions, conditions, and uncertainty; clearer wording grants no additional authority or confidence.FIRST: Read .ai-factory/config.yaml if it exists to resolve:
paths.description, paths.architecture, and paths.docslanguage.ui for prompts and language.artifacts for generated docswriting.profile, writing.targets, and writing.dictionary (optional, disabled by default); language.technical_terms remains the fallback terminology policyIf config.yaml doesn't exist, use defaults:
.ai-factory/DESCRIPTION.md.ai-factory/ARCHITECTURE.mddocs/en (English)Note: README.md remains the landing page in the project root. Detailed docs are written to the resolved paths.docs directory (default: docs/).
Fix each artifact's language before selecting an editorial profile. An
explicit instruction for that artifact takes priority. Preserve an existing
document's language unless translation was requested; for new documents use
language.artifacts (fallback: language.ui, then en). The conversation
language never overrides the artifact language. The profile cannot translate.
If writing.profile is set to anything other than none, read
references/WRITING-PROFILE.md to validate settings before drafting (including
unknown profiles). A malformed writing section yields WARN [writing] and
skips the pass. Missing section/profile defaults to none. Activate only a
valid simple-technical profile with non-empty targets; otherwise keep the
ordinary workflow without loading RU/EN editorial references or running a pass.
THEN: Read .ai-factory/DESCRIPTION.md (use path from config) if it exists to understand:
Also read .ai-factory/ARCHITECTURE.md (use path from config) if it exists to align documentation with the project's structure and boundaries.
Explore the codebase:
package.json, composer.json, requirements.txt, go.mod, Cargo.toml, etc.src/ structure to understand architectureRead .ai-factory/skill-context/aif-docs/SKILL.md — MANDATORY if the file exists.
This file contains project-specific rules accumulated by /aif-evolve from patches,
codebase conventions, and tech-stack analysis. These rules are tailored to the current project.
How to apply skill-context rules:
Enforcement: After generating any output artifact, verify it against all skill-context rules. If any rule is violated — fix the output before presenting it to the user.
Scan for scattered markdown files in project root:
Use Glob to find all *.md files in the project root (exclude node_modules/, .ai-factory/, agent dirs):
CHANGELOG.md, CONTRIBUTING.md, ARCHITECTURE.md, DEPLOYMENT.md,
SECURITY.md, API.md, SETUP.md, DEVELOPMENT.md, TESTING.md, etc.Record each file, its size, and a brief summary of its content. This list is used in Step 1.1.
--web → Generate HTML version of documentationCheck what documentation already exists:
State A: No README.md → Full generation (README + docs dir)
State B: README.md exists, no docs dir → Analyze README, propose split into docs dir
State C: README.md + docs dir exist → Depends on flags (see below)State C with --web flag — ask the user:
Documentation already exists (README.md + resolved docs directory).
AskUserQuestion: What would you like to do?
Options:
1. Generate HTML only — build site from current docs as-is
2. Audit & improve first — check for issues, then generate HTML
3. Audit only — check for issues without generating HTMLBased on choice:
State C without --web flag → run Step 2 (State C) as usual.
If scattered .md files were found in the project root (from Step 0), propose consolidating them into the resolved docs directory.
Common files that should move to the resolved docs directory:
| Root file | Target in docs dir | Merge or move? |
|---|---|---|
CONTRIBUTING.md | <resolved docs dir>/contributing.md | Move |
ARCHITECTURE.md | <resolved docs dir>/architecture.md | Move |
DEPLOYMENT.md | <resolved docs dir>/deployment.md | Move |
SETUP.md | <resolved docs dir>/getting-started.md | Merge (append to existing) |
DEVELOPMENT.md | <resolved docs dir>/getting-started.md or <resolved docs dir>/contributing.md | Merge |
API.md | <resolved docs dir>/api.md | Move |
TESTING.md | <resolved docs dir>/testing.md | Move |
SECURITY.md | <resolved docs dir>/security.md | Move |
Files that stay in root (standard convention):
README.md — always staysCHANGELOG.md — standard root-level file, keep as-isLICENSE / LICENSE.md — standard root-level file, keep as-isCODE_OF_CONDUCT.md — standard root-level file, keep as-isIf scattered files found, ask the user:
Found [N] markdown files in the project root:
CONTRIBUTING.md (45 lines) — contribution guidelines
ARCHITECTURE.md (120 lines) — system architecture overview
DEPLOYMENT.md (80 lines) — deployment instructions
SETUP.md (30 lines) — setup guide (overlaps with getting-started)
Suggested actions:
→ Move CONTRIBUTING.md → <resolved docs dir>/contributing.md
→ Move ARCHITECTURE.md → <resolved docs dir>/architecture.md
→ Move DEPLOYMENT.md → <resolved docs dir>/deployment.md
→ Merge SETUP.md into <resolved docs dir>/getting-started.md
AskUserQuestion: Would you like to apply the consolidation?
Options:
1. Apply all suggestions
2. Let me pick which ones
3. Skip — keep files where they areBased on choice:
When moving/merging:
IMPORTANT: Never force-move files. Always show the plan and get user approval first.
When no README.md exists, generate the full documentation set.
Explore the codebase and identify documentation topics:
Always include:
- getting-started.md (installation, setup, quick start)
Include if relevant:
- architecture.md (if project has clear architecture: services, modules, layers)
- api.md (if project exposes API endpoints)
- configuration.md (if project has config files, env vars, feature flags)
- deployment.md (if Dockerfile, CI/CD, deploy scripts exist)
- contributing.md (if open-source or team project)
- security.md (if auth, permissions, or security patterns exist)
- testing.md (if test suite exists)
- cli.md (if project has CLI commands)Ask the user:
I've analyzed your project and suggest these documentation pages:
1. getting-started.md — Installation, setup, quick start
2. architecture.md — Project structure and patterns
3. api.md — API endpoints reference
4. configuration.md — Environment variables and config
AskUserQuestion: Would you like to generate these documentation pages?
Options:
1. Generate all of these
2. Let me pick which ones
3. Add more topicsBased on choice:
Structure (aim for ~80-120 lines):
# Project Name
> One-line tagline describing the project.
Brief 2-3 sentence description of what this project does and why it exists.
## Quick Start
\`\`\`bash
# Installation steps (1-3 commands)
\`\`\`
## Key Features
- **Feature 1** — brief description
- **Feature 2** — brief description
- **Feature 3** — brief description
## Example
\`\`\`
# Show a real usage example — this is where users decide "I want this"
\`\`\`
---
## Documentation
| Guide | Description |
|-------|-------------|
| [Getting Started](<readme-to-docs-dir>/getting-started.md) | Installation, setup, first steps |
| [Architecture](<readme-to-docs-dir>/architecture.md) | Project structure and patterns |
| [API Reference](<readme-to-docs-dir>/api.md) | Endpoints, request/response formats |
| [Configuration](<readme-to-docs-dir>/configuration.md) | Environment variables, config files |
## License
MIT (or whatever is in the project)Key rules for README:
For each approved topic, create a doc file:
[← Previous Topic](previous-topic.md) · [Back to README](<docs-to-readme-link>) · [Next Topic →](next-topic.md)
# Topic Title
Content organized by subtopic with headers, code examples, and tables.
Keep each section self-contained.
## See Also
- [Related Topic 1](related-topic.md) — brief description
- [Related Topic 2](other-topic.md) — brief descriptionNavigation link order follows the Documentation table in README.md (top to bottom). The first doc page omits the "← Previous" link; the last page omits the "Next →" link. Use the correct relative link from the resolved docs directory back to README.md. Example for the default docs/ layout:
getting-started.md: [Back to README](../README.md) · [Architecture →](architecture.md)
architecture.md: [← Getting Started](getting-started.md) · [Back to README](../README.md) · [API Reference →](api.md)
api.md: [← Architecture](architecture.md) · [Back to README](../README.md) · [Configuration →](configuration.md)
configuration.md: [← API Reference](api.md) · [Back to README](../README.md)Content guidelines per topic:
getting-started.md:
architecture.md:
api.md:
configuration.md:
deployment.md:
When README.md exists but is long (150+ lines) and there's no resolved docs directory yet.
Read README.md and identify:
Stays in README:
Moves to the resolved docs directory:
getting-started.mdarchitecture.mdapi.mdconfiguration.mdcontributing.mdYour README.md is [N] lines. I suggest splitting it:
README.md (~100 lines) — keep as landing page:
✓ Title + tagline
✓ Key features
✓ Quick install
✓ Example
✓ Documentation links table
Move to docs dir:
→ "Installation" section → <resolved docs dir>/getting-started.md
→ "Configuration" section → <resolved docs dir>/configuration.md
→ "API Reference" section → <resolved docs dir>/api.md
→ "Architecture" section → <resolved docs dir>/architecture.md
Proceed?When both README.md and the resolved docs directory exist.
Check for:
Check existing docs against current Core Principles for gaps (missing navigation, missing "See Also", stale formats). For the full compliance table and auto-fix rules → read references/REVIEW-CHECKLISTS.md (Standards Compliance section).
When gaps are found, include them in the audit report alongside content issues (Step 2.2). Treat them as regular improvements — show the plan and get user approval before applying.
Documentation audit results:
✅ README is lean (105 lines)
⚠️ Docs pages in the resolved docs directory are missing prev/next navigation — will add
⚠️ <resolved docs dir>/api.md is missing — project has 12 API endpoints
⚠️ <resolved docs dir>/configuration.md references old env var DB_HOST (now DATABASE_URL)
❌ <resolved docs dir>/getting-started.md links to setup.md which doesn't exist
Proposed fixes:
1. Add prev/next navigation to all doc pages in the resolved docs directory
2. Create <resolved docs dir>/api.md with endpoint reference
3. Update DATABASE_URL in <resolved docs dir>/configuration.md
4. Fix broken link in <resolved docs dir>/getting-started.md
Apply fixes?When Step 0 activates a valid profile, after drafting, splitting, or improving
content and before saving final Markdown or rendering HTML, apply
references/WRITING-PROFILE.md only to selected files already authorized for
this run. Compare the candidate with the pre-editorial draft/source before
accepting it. For an audit-only request,
report suggestions without rewriting. Generate-HTML-only skips this pass.
This step adds no files or actions to the approved scope. It does not affect chat replies, issues, plans, requirements validation, or quality-gate verdicts.
When --web flag is passed, generate a static HTML site from the markdown docs.
mkdir -p docs-htmlFor each markdown file (README.md + <resolved docs dir>/*.md), generate an HTML version:
Read the HTML template from templates/html-template.html and use it for each page.
Customize: {page_title}, {project_name}, {nav_links}, {content}.
For each doc file: parse markdown → convert to HTML elements → fix .md links to .html → generate nav bar → write to docs-html/.
File mapping: README.md → index.html, <resolved docs dir>/*.md → *.html.
Show tree of generated files and open docs-html/index.html hint.
MANDATORY after any content change (generation, split, improvement, file consolidation). Do NOT skip this step.
Skip this step only when "Generate HTML only" was chosen — no content was modified, nothing to review.
Read every generated/modified file and evaluate it using references/REVIEW-CHECKLISTS.md: Meaning Preservation first for requirement rewrites, then Technical Accuracy and Readability & Completeness. Compare rewritten requirements with their original source, including content moved or split between files. Report an explicit Meaning preservation: PASS or FAIL before readability results; use N/A — no requirements rewritten only when applicable. On failure, restore or repair the affected rewrite and repeat the comparison before proceeding. Missing source or unresolved ambiguity is a failure, not permission to guess.
Fix any issues found before presenting the result to the user. Display results as a compact table with ✅/❌/⚠️ status per item.
Only if files were moved/merged from root into docs/ during Step 1.1.
After the review confirms all content is correctly placed in docs/, offer to delete the original root-level files:
The following root files have been incorporated into docs/:
CONTRIBUTING.md → now in docs/contributing.md
ARCHITECTURE.md → now in docs/architecture.md
DEPLOYMENT.md → now in docs/deployment.md
SETUP.md → merged into docs/getting-started.md
AskUserQuestion: These originals are no longer needed. Delete them?
Options:
1. Yes, delete all originals
2. Let me pick which ones to delete
3. No, keep them (I'll clean up later)Based on choice:
When deleting:
git status to show what was deleted — user can restore with git checkout if neededDo NOT auto-delete. Always ask. The user may want to keep originals temporarily for reference or diff comparison.
After any documentation changes, update the Documentation section in AGENTS.md (if the file exists).
Read AGENTS.md and find the ## Documentation section. Update it to reflect the current state of all documentation files:
## Documentation
| Document | Path | Description |
|----------|------|-------------|
| README | README.md | Project landing page |
| Getting Started | `<resolved docs dir>/getting-started.md` | Installation, setup, first steps |
| Architecture | `<resolved docs dir>/architecture.md` | Project structure and patterns |
| API Reference | `<resolved docs dir>/api.md` | Endpoints, request/response formats |
| Configuration | `<resolved docs dir>/configuration.md` | Environment variables, config files |Rules:
AGENTS.md doesn't exist, skip this step silentlySuggest the user to free up context space if needed: /clear (full reset) or /compact (compress history).
README.md, <resolved docs dir>/*, and the Documentation section in AGENTS.md.config.yaml resolves paths.description, paths.architecture, paths.docs, language.ui, language.artifacts, language.technical_terms, and optional writing.profile, writing.targets, writing.dictionary. The profile and project dictionary are read-only inputs; targets never grant write ownership..ai-factory/DESCRIPTION.md, .ai-factory/ARCHITECTURE.md, roadmap/rules/research artifacts unless the user explicitly asks for broader edits.language.artifacts, then language.ui, then endocs-html/ to .gitignoreREADME.md, <resolved docs dir>/*, and the Documentation section in AGENTS.md), not the roadmap, RULES.md, or research artifacts resolved from configlee-to/ai-factory
9771b77
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.