living-docs-kit 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/LICENSE +9 -0
  2. package/README.md +85 -0
  3. package/agents/docs-reviewer.md +33 -0
  4. package/agents/docs-writer.md +31 -0
  5. package/bin/cli.mjs +68 -0
  6. package/package.json +21 -0
  7. package/skills/docs-design/SKILL.md +91 -0
  8. package/skills/docs-design/references/theme-schema.md +108 -0
  9. package/skills/docs-guide/SKILL.md +83 -0
  10. package/skills/docs-init/SKILL.md +136 -0
  11. package/skills/docs-init/assets/DOCS-GUIDE.template.md +81 -0
  12. package/skills/docs-init/assets/agents-snippet.md +7 -0
  13. package/skills/docs-init/assets/deploy-github-pages.yml +43 -0
  14. package/skills/docs-init/assets/site-template/content/index.md +4 -0
  15. package/skills/docs-init/assets/site-template/docs.config.json +36 -0
  16. package/skills/docs-init/assets/site-template/engine/assets/app.js +414 -0
  17. package/skills/docs-init/assets/site-template/engine/assets/base.css +229 -0
  18. package/skills/docs-init/assets/site-template/engine/build.mjs +432 -0
  19. package/skills/docs-init/assets/site-template/engine/check.mjs +100 -0
  20. package/skills/docs-init/assets/site-template/engine/dev.mjs +49 -0
  21. package/skills/docs-init/assets/site-template/engine/facts.mjs +157 -0
  22. package/skills/docs-init/assets/site-template/engine/i18n.mjs +99 -0
  23. package/skills/docs-init/assets/site-template/engine/lib.mjs +368 -0
  24. package/skills/docs-init/assets/site-template/engine/palette.mjs +149 -0
  25. package/skills/docs-init/assets/site-template/engine/theme-tool.mjs +201 -0
  26. package/skills/docs-init/assets/site-template/engine/vendor/mermaid.min.js +3636 -0
  27. package/skills/docs-init/assets/site-template/package.json +24 -0
  28. package/skills/docs-init/assets/site-template/themes/atlas.json +40 -0
  29. package/skills/docs-init/assets/site-template/themes/fjord.json +40 -0
  30. package/skills/docs-init/assets/site-template/themes/graphite.json +45 -0
  31. package/skills/docs-write/SKILL.md +109 -0
  32. package/skills/docs-write/references/authoring.md +125 -0
  33. package/skills/docs-write/references/page-types.md +104 -0
package/LICENSE ADDED
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,85 @@
1
+ # living-docs kit
2
+
3
+ Skills and subagents that give a code project a documentation website written for people. The site has:
4
+
5
+ - a concise overview with drill-down into detail pages;
6
+ - clickable, zoomable diagrams;
7
+ - interactive decision tables;
8
+ - links from the docs straight into the code;
9
+ - labels that mark pages whose code has changed since they were checked;
10
+ - switchable themes and fonts.
11
+
12
+ It works in **Claude Code** and **Cursor**. Cursor also loads skills and subagents from the `.claude/` folders.
13
+
14
+ ## Install
15
+
16
+ Run this from the root of the project you want to document:
17
+
18
+ ```sh
19
+ npx living-docs-kit # only this project (./.claude)
20
+ npx living-docs-kit --all # all your projects (~/.claude)
21
+ ```
22
+
23
+ The same commands work on macOS, Linux and Windows. Update with `npx living-docs-kit@latest` (add `--all` for the user-level copy). Remove with `--uninstall`.
24
+
25
+ A project-level install can be committed with the project, so everyone who clones it gets the same skills. If both exist, the project copy takes precedence over the user-level one.
26
+
27
+ Requirements: Node.js 20+ and git (recommended, used for change tracking).
28
+
29
+ ## Use
30
+
31
+ | You say (or type) | What runs |
32
+ |---|---|
33
+ | "set up living docs for this project", `/docs-init` | **docs-init**: asks for the design, creates `docs-site/`, drafts `DOCS-GUIDE.md`, shows it to you, iterates until you approve, then generates the site |
34
+ | "update the docs", "document the refund flow" | **docs-write**, usually through the **docs-writer** subagent |
35
+ | "make a theme from https://…", "use this palette image", "keep the text at 120%", "make Graphite the default" | **docs-design** |
36
+ | "the docs should also cover X", "write shorter pages", "show me the docs guide" | **docs-guide** |
37
+ | "are the docs correct?" | the **docs-reviewer** subagent (read-only) |
38
+
39
+ To view the site, run `cd docs-site && npm run dev` and open http://localhost:4321; it rebuilds and reloads on every change. You can also open `docs-site/dist/index.html` straight from disk.
40
+
41
+ ## What is in the kit
42
+
43
+ ```
44
+ skills/
45
+ docs-init/ setup + first generation; carries the site template, the guide template,
46
+ an AGENTS.md snippet and an optional GitHub Pages workflow
47
+ docs-design/ themes: create from a URL, image or description; edit; set default; save a font size
48
+ docs-guide/ maintains DOCS-GUIDE.md (topics, sections, tone, limits, update policy)
49
+ docs-write/ how to write the pages; modes plan / pages / update / topic
50
+ agents/
51
+ docs-writer.md writes pages in its own context (several can run in parallel)
52
+ docs-reviewer.md read-only accuracy and readability review
53
+ ```
54
+
55
+ ## Inside a project after setup
56
+
57
+ ```
58
+ docs-site/
59
+ docs.config.json title, default theme, code-link editor and web base, limits, state
60
+ DOCS-GUIDE.md the brief for the writer; edit it by hand or via docs-guide
61
+ content/ the pages (Markdown + frontmatter)
62
+ themes/ one JSON per theme; each one appears in the site's theme picker
63
+ engine/ build, dev server, checker, facts/stamp, theme and palette tools
64
+ ```
65
+
66
+ Useful commands (run in `docs-site/`):
67
+
68
+ | Command | What it does |
69
+ |---|---|
70
+ | `npm run dev` | live preview |
71
+ | `npm run build` | build `dist/` |
72
+ | `npm run build:hosted` | build with code links pointing to GitHub/GitLab instead of the local editor |
73
+ | `npm run check` | broken links, missing code files or lines, length limits, stale pages |
74
+ | `npm run facts` | what the tools know about the project and the docs coverage |
75
+ | `npm run theme -- list` | list themes; `validate`, `fix`, `set`, `set-default` are also available |
76
+
77
+ ## Behaviour of the site controls
78
+
79
+ - **Theme picker.** The choice is remembered in the reader's browser until they pick "Default". The default for everyone is `defaultTheme` in `docs.config.json`, set by docs-design.
80
+ - **A− / A+.** Temporary text size; it resets on reload. To keep a size, ask the agent (docs-design writes it into a theme, or into a new variant of it).
81
+ - **"Possibly outdated" label.** It appears when the files a page describes changed after the page was last verified. The `/_status/` page lists all such pages.
82
+
83
+ ## Updating the engine
84
+
85
+ Ask "upgrade the docs-site engine". docs-init replaces `engine/` from the installed kit and leaves content, themes, the guide and the config untouched.
@@ -0,0 +1,33 @@
1
+ ---
2
+ name: docs-reviewer
3
+ description: Read-only reviewer for the living-docs documentation site. Checks pages for accuracy against the code, readability for a human newcomer, compliance with DOCS-GUIDE.md, navigability (drill-down links, clickable diagrams) and staleness, and returns a prioritized list of concrete fixes. Use after initial generation, after large updates, or when the user asks whether the docs are correct or good.
4
+ model: inherit
5
+ tools: Read, Grep, Glob, Bash
6
+ readonly: true
7
+ ---
8
+
9
+ You review a documentation website written for people. It lives in the project folder that has `docs.config.json` next to `engine/` (usually `docs-site/`). You never modify files.
10
+
11
+ Prepare:
12
+
13
+ 1. Read `DOCS-GUIDE.md` in the site folder.
14
+ 2. Read the references of the `docs-write` skill (`references/authoring.md` and `references/page-types.md`). The skill is in `.claude/skills/docs-write/`, `~/.claude/skills/docs-write/`, `.cursor/skills/docs-write/`, `~/.cursor/skills/docs-write/`, `.agents/skills/docs-write/` or `~/.agents/skills/docs-write/`.
15
+ 3. Run `npm run check` and `node engine/facts.mjs` in the site folder for the mechanical problems and the coverage numbers.
16
+
17
+ Review the pages you were given, or, if none were named, the home page, every section overview and a sample of detail pages. For each page, judge:
18
+
19
+ 1. **Accuracy.** Open the files in `sources` and the `code:` links. Check at least three concrete claims per page against the code: names, conditions, limits, status codes, order of steps. Wrong claims are the most important findings.
20
+ 2. **First-read clarity.** Could a developer new to the project understand the summary and the first screen without reading the code? Flag jargon, missing definitions, walls of text and retold code.
21
+ 3. **Guide compliance.** Check language, tone, length limits, required sections for the page type, edge cases with tests, and diagram rules.
22
+ 4. **Navigation.** The page should be reachable from its parent overview and its map diagram. Diagram nodes should link where detail exists, and related pages should link to each other.
23
+ 5. **Freshness.** Look for stale or unverified pages, and for code changed since the last stamp.
24
+ 6. **Gaps.** Look for priority topics from the guide with no page, and for important code with no coverage (`uncoveredCodeFiles`).
25
+
26
+ Return a prioritized list, most important first. Each item has:
27
+
28
+ - the page path;
29
+ - the problem, quoting at most one short fragment;
30
+ - the evidence, with a file and line when it is about accuracy;
31
+ - the concrete fix.
32
+
33
+ End with one line of overall assessment. Keep it compact; a writer will act on it.
@@ -0,0 +1,31 @@
1
+ ---
2
+ name: docs-writer
3
+ description: Writes and updates pages of the living-docs documentation site (docs-site/content) for human readers, verified against the code. Use for the plan, pages, update and topic modes of the docs-write skill - initial generation of the docs site, filling stub pages (one writer per section can run in parallel), refreshing pages after code changes, or documenting a specific module, flow or rule. Not for changing themes or the documentation guide.
4
+ model: inherit
5
+ skills: docs-write
6
+ ---
7
+
8
+ You maintain a documentation website written for people, not for AI. It lives in the project folder that has `docs.config.json` next to `engine/` (usually `docs-site/`).
9
+
10
+ Your first action in every run is to read the `docs-write` skill completely and follow it. It is in the first of these locations that exists:
11
+
12
+ - `.claude/skills/docs-write/SKILL.md` or `~/.claude/skills/docs-write/SKILL.md`
13
+ - `.cursor/skills/docs-write/SKILL.md` or `~/.cursor/skills/docs-write/SKILL.md`
14
+ - `.agents/skills/docs-write/SKILL.md` or `~/.agents/skills/docs-write/SKILL.md`
15
+
16
+ Then read `DOCS-GUIDE.md` in the site folder completely. Its rules override the skill's defaults.
17
+
18
+ Your task message tells you:
19
+
20
+ - the **mode**: `plan`, `pages`, `update` or `topic`;
21
+ - for `pages`, the list of page files you own;
22
+ - for `topic`, what to document.
23
+
24
+ If the mode is missing, infer it as the skill describes. Rules for this run:
25
+
26
+ - Work only on the pages you were given, plus the minimal link fixes elsewhere they require. Other writers may be editing other sections at the same time.
27
+ - Read the code before you describe it. Never state behaviour you did not verify; use an `> [!UNVERIFIED]` callout instead.
28
+ - Stamp only the pages you actually verified: `node engine/facts.mjs stamp <files>`.
29
+ - Do not edit `engine/`, `themes/` or `DOCS-GUIDE.md`.
30
+ - You cannot ask the user questions. When something is ambiguous, choose the reading best supported by the code, and mention it in your report.
31
+ - Finish with `npm run check` (0 errors) and the short report the skill describes. Return only that report.
package/bin/cli.mjs ADDED
@@ -0,0 +1,68 @@
1
+ #!/usr/bin/env node
2
+ // Installs the living-docs skills and subagents.
3
+ // npx living-docs-kit current project (./.claude/)
4
+ // npx living-docs-kit --all all projects (~/.claude/)
5
+ // npx living-docs-kit --uninstall remove them again (combine with --all for the user-level copy)
6
+ import fs from 'node:fs';
7
+ import os from 'node:os';
8
+ import path from 'node:path';
9
+ import { fileURLToPath } from 'node:url';
10
+
11
+ const KIT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
12
+ const SKILLS = ['docs-init', 'docs-design', 'docs-guide', 'docs-write'];
13
+ const AGENTS = ['docs-writer.md', 'docs-reviewer.md'];
14
+ const args = process.argv.slice(2);
15
+ const has = (...f) => f.some((x) => args.includes(x));
16
+ const version = JSON.parse(fs.readFileSync(path.join(KIT, 'package.json'), 'utf8')).version;
17
+
18
+ if (has('-h', '--help')) {
19
+ console.log(`living-docs-kit ${version}
20
+
21
+ Usage:
22
+ npx living-docs-kit install into the current project (./.claude/)
23
+ npx living-docs-kit --all install for all your projects (~/.claude/)
24
+ npx living-docs-kit --uninstall remove from the current project (add --all for ~/.claude/)
25
+ npx living-docs-kit --version
26
+
27
+ Claude Code and Cursor both load skills and subagents from these .claude folders.
28
+ Run the project install from the root of the project you want to document.`);
29
+ process.exit(0);
30
+ }
31
+ if (has('-v', '--version')) { console.log(version); process.exit(0); }
32
+
33
+ const unknown = args.filter((a) => !['--all', '--uninstall'].includes(a));
34
+ if (unknown.length) { console.error(`✗ unknown option: ${unknown.join(' ')} (see --help)`); process.exit(1); }
35
+
36
+ const all = has('--all');
37
+ const base = all ? path.join(os.homedir(), '.claude') : path.join(process.cwd(), '.claude');
38
+
39
+ if (!all && process.cwd() === os.homedir()) {
40
+ console.error('✗ You are in your home folder. Run this from a project root, or use --all to install for all projects.');
41
+ process.exit(1);
42
+ }
43
+
44
+ try {
45
+ if (has('--uninstall')) {
46
+ let n = 0;
47
+ for (const s of SKILLS) { const p = path.join(base, 'skills', s); if (fs.existsSync(p)) { fs.rmSync(p, { recursive: true, force: true }); n++; } }
48
+ for (const a of AGENTS) { const p = path.join(base, 'agents', a); if (fs.existsSync(p)) { fs.rmSync(p); n++; } }
49
+ console.log(n ? `✓ removed ${n} items from ${base}` : `nothing to remove in ${base}`);
50
+ console.log('Existing docs-site/ folders in your projects are not touched.');
51
+ process.exit(0);
52
+ }
53
+ fs.mkdirSync(path.join(base, 'skills'), { recursive: true });
54
+ fs.mkdirSync(path.join(base, 'agents'), { recursive: true });
55
+ for (const s of SKILLS) {
56
+ const dest = path.join(base, 'skills', s);
57
+ fs.rmSync(dest, { recursive: true, force: true });
58
+ fs.cpSync(path.join(KIT, 'skills', s), dest, { recursive: true });
59
+ }
60
+ for (const a of AGENTS) fs.copyFileSync(path.join(KIT, 'agents', a), path.join(base, 'agents', a));
61
+ console.log(`✓ living-docs-kit ${version}: installed 4 skills and 2 subagents into ${base}`);
62
+ console.log(all ? ' Available in all your projects.' : ' Available in this project. You can commit .claude/ so everyone who clones it gets them.');
63
+ console.log('\nNext: restart Claude Code or reload Cursor, then ask "set up living docs for this project" (or /docs-init).');
64
+ console.log('To update later: npx living-docs-kit@latest' + (all ? ' --all' : ''));
65
+ } catch (e) {
66
+ console.error('✗ ' + e.message);
67
+ process.exit(1);
68
+ }
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "living-docs-kit",
3
+ "version": "0.1.0",
4
+ "description": "Skills and subagents for Claude Code and Cursor that build and maintain a human-friendly documentation website for a code project.",
5
+ "type": "module",
6
+ "bin": {
7
+ "living-docs-kit": "bin/cli.mjs"
8
+ },
9
+ "files": [
10
+ "bin/",
11
+ "skills/",
12
+ "agents/",
13
+ "README.md",
14
+ "LICENSE"
15
+ ],
16
+ "keywords": ["claude-code", "cursor", "agent-skills", "subagents", "documentation", "static-site", "mermaid"],
17
+ "license": "MIT",
18
+ "engines": {
19
+ "node": ">=20"
20
+ }
21
+ }
@@ -0,0 +1,91 @@
1
+ ---
2
+ name: docs-design
3
+ description: Create, change and manage the visual design of the living-docs documentation site - colour palettes, fonts, base font size, line height, widths and extra CSS - and choose which theme is the default. Use whenever the user wants a new theme or palette for the docs site (from a website URL, an image or screenshot, or a description), wants to tweak colours or fonts, wants to make a theme the default, or wants to save the font size they picked in the site (e.g. "keep the text at 120%"), even if they do not say "theme".
4
+ ---
5
+
6
+ # docs-design
7
+
8
+ Themes live in `<site>/themes/<id>.json`, one file per theme. Every theme appears automatically in the site's theme picker. The default theme is `defaultTheme` in `<site>/docs.config.json`.
9
+
10
+ How the reader-side controls behave (explain this when relevant):
11
+
12
+ - **Theme picker in the site.** A choice there is remembered in that browser only, until the reader picks "Default: …" again. It never changes files. The default for everyone is the one set in `docs.config.json`.
13
+ - **A−/A+ buttons in the site.** They change the text size temporarily and nothing is saved; it resets on reload. The indicator shows a percentage of the theme's base size. To keep a size, the user asks for it and this skill writes it into a theme (see "Save a font size").
14
+
15
+ This skill is interactive; run it in the main conversation. Talk to the user in their language. Theme labels are shown in the site, so write them in the documentation language.
16
+
17
+ ## Locate the site
18
+
19
+ Use the folder that has `docs.config.json` next to `engine/` (usually `docs-site/`). If none exists, tell the user to run the `docs-init` skill first. Run every command below from the site folder.
20
+
21
+ ## Tools
22
+
23
+ ```bash
24
+ node engine/theme-tool.mjs list # themes; ★ marks the default
25
+ node engine/theme-tool.mjs show <id> # theme with all derived values filled in
26
+ node engine/theme-tool.mjs validate [id] # schema + WCAG contrast; exit 1 on errors
27
+ node engine/theme-tool.mjs fix <id> # repair failing contrast (changes lightness only)
28
+ node engine/theme-tool.mjs new <id> --from <base> --label "Label"
29
+ node engine/theme-tool.mjs set <id> <path> <value> # e.g. set fjord typography.baseSize 19
30
+ node engine/theme-tool.mjs set-default <id>
31
+ node engine/theme-tool.mjs remove <id>
32
+ node engine/palette.mjs --url <website> # CSS variables, colours by usage, fonts
33
+ node engine/palette.mjs --image <file-or-url> # dominant colours with share and contrast
34
+ ```
35
+
36
+ Read `references/theme-schema.md` before writing or editing a theme file. It lists every token and explains how to map a raw palette onto tokens.
37
+
38
+ ## Create a theme
39
+
40
+ 1. **Get the raw material.**
41
+ - **Website:** run `palette.mjs --url`. If it reports very few colours (sites rendered by JavaScript), take a screenshot with a browser tool if one is available, save it, and run `--image` on it. Look at the site or the screenshot yourself when you can; usage counts alone do not reveal which colour is the brand accent.
42
+ - **Image:** if it is a URL, `palette.mjs --image` downloads it. Also look at the image yourself, because the order of the swatches often carries meaning.
43
+ - **Description:** choose the colours yourself.
44
+ - **Variant of an existing theme:** `theme-tool.mjs new <id> --from <base>`.
45
+ 2. **Map to tokens** following the mapping rules in the reference. Decide `mode` (light/dark) from the background.
46
+ - If the user asked for both modes, make two themes (e.g. `acme-light` and `acme-dark`) sharing the same accent hue.
47
+ 3. **Pick fonts.**
48
+ - Reuse the source's fonts when they exist on Google Fonts.
49
+ - Otherwise choose the closest readable Google Font and say so.
50
+ - Always add a fallback stack ending in a generic family.
51
+ - Build a `googleFontsUrl` (css2 API) that loads only the weights you use, typically 400, 600 or 700, and italic 400.
52
+ - Body text must be highly readable. Display-only fonts may be used for `heading` only.
53
+ 4. **Write** `themes/<id>.json`. Use a lowercase-hyphen `id`, a human `label`, and `source` saying where it came from (URL, file name, "description").
54
+ 5. **Validate:** run `theme-tool.mjs validate <id>`.
55
+ - On contrast errors, run `theme-tool.mjs fix <id>`, then validate again.
56
+ - Tell the user which colours were adjusted and why, e.g. "the link colour was darkened slightly to be readable on the background".
57
+ - Never ship a theme that fails validation.
58
+ 6. **Preview:** run `npm run build`, and suggest `npm run dev` if the preview is not already running. Point the user to the theme picker.
59
+ 7. **Ask whether it becomes the default.** If yes, run `set-default <id>`.
60
+
61
+ ## Change a theme
62
+
63
+ - Small changes: `theme-tool.mjs set <id> <path> <value>`. It validates before saving. Examples:
64
+ - `set graphite colors.accent "#4fb3a9"`
65
+ - `set atlas layout.contentMaxWidth 820`
66
+ - `set fjord fonts.body "'Inter', system-ui, sans-serif"`
67
+ - Several changes: edit the JSON file, then validate.
68
+ - When a font family changes, update `googleFontsUrl` too.
69
+ - If the user wants to keep the original, create a variant with `new … --from …` instead of editing.
70
+ - Anything the tokens cannot express goes into `extraCss`, always scoped with `:root[data-theme="<id>"]` (see the reference).
71
+
72
+ ## Save a font size
73
+
74
+ The user picked a size in the site (the indicator shows e.g. `120%`) and wants to keep it.
75
+
76
+ 1. Get the percentage. Ask for it if they did not say it.
77
+ 2. Find which theme they were viewing. It is usually the default; ask if unclear.
78
+ 3. Compute the new base size: `new baseSize = round(theme's baseSize × percentage / 100)`. Example: 17 px × 120% = 20 px. Values must stay between 12 and 28.
79
+ 4. Ask one question: change this theme, or create a new variant (e.g. `fjord-large`, labelled "Fjord (large text)")?
80
+ - To change: `set <id> typography.baseSize <px>`.
81
+ - For a variant: `new <id>-large --from <id> --label "…"`, then the `set` command on the new id.
82
+ 5. If the theme should also become the default, run `set-default`.
83
+ 6. Build, and tell the user to reset the site control to 100%. Otherwise the scale applies on top of the new base.
84
+
85
+ ## Set the default
86
+
87
+ Run `theme-tool.mjs set-default <id>`, then build. Readers who picked a theme in their browser keep their choice until they select "Default" again. Mention this if the user expects everyone to see the change immediately.
88
+
89
+ ## Remove a theme
90
+
91
+ Run `theme-tool.mjs remove <id>`. The default theme cannot be removed; set another default first.
@@ -0,0 +1,108 @@
1
+ # Theme schema
2
+
3
+ A theme is `themes/<id>.json`. The build turns every theme into CSS variables under `:root[data-theme="<id>"]`; `engine/assets/base.css` uses only these variables. All colours must be 6-digit hex.
4
+
5
+ ## Full example
6
+
7
+ ```json
8
+ {
9
+ "id": "acme-light",
10
+ "label": "Acme (light)",
11
+ "mode": "light",
12
+ "source": "https://acme.example — extracted palette",
13
+ "colors": {
14
+ "bg": "#f7f8fa",
15
+ "surface": "#ffffff",
16
+ "surfaceAlt": "#eef1f5",
17
+ "text": "#1d2733",
18
+ "textMuted": "#566271",
19
+ "heading": "#111a24",
20
+ "border": "#d6dde5",
21
+ "accent": "#0f766e",
22
+ "accentText": "#ffffff",
23
+ "link": "#0d6a63",
24
+ "codeBg": "#eef1f5",
25
+ "codeText": "#1d2733",
26
+ "highlight": "#d7ece9",
27
+ "success": "#1f7a4d",
28
+ "warning": "#8a5a00",
29
+ "danger": "#b42318"
30
+ },
31
+ "fonts": {
32
+ "body": "'Source Sans 3', 'Segoe UI', system-ui, sans-serif",
33
+ "heading": "'Source Sans 3', 'Segoe UI', system-ui, sans-serif",
34
+ "mono": "'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace",
35
+ "googleFontsUrl": "https://fonts.googleapis.com/css2?family=Source+Sans+3:ital,wght@0,400;0,700;1,400&family=JetBrains+Mono:wght@400;600&display=swap"
36
+ },
37
+ "typography": { "baseSize": 17, "lineHeight": 1.65, "headingWeight": 700 },
38
+ "layout": { "contentMaxWidth": 760, "sidebarWidth": 280, "radius": 8 },
39
+ "diagram": { "nodeBg": "#eef1f5", "nodeBorder": "#0f766e" },
40
+ "extraCss": ""
41
+ }
42
+ ```
43
+
44
+ ## Tokens
45
+
46
+ | Token | Required | Used for |
47
+ |---|---|---|
48
+ | `id` | yes | file name and `data-theme` value; lowercase letters, digits, hyphens |
49
+ | `label` | yes | name in the theme picker, in the documentation language |
50
+ | `mode` | yes | `light` or `dark`; sets `color-scheme` and diagram dark mode |
51
+ | `source` | no | where the palette came from (shown by `theme-tool list`) |
52
+ | `colors.bg` | yes | page background |
53
+ | `colors.surface` | yes | cards, tables, callouts, search box, diagrams |
54
+ | `colors.surfaceAlt` | no | hover states, default diagram nodes (derived from surface) |
55
+ | `colors.text` | yes | body text |
56
+ | `colors.textMuted` | yes | secondary text: breadcrumbs, captions, summaries of child pages |
57
+ | `colors.heading` | no | headings (default: text) |
58
+ | `colors.border` | yes | all hairlines |
59
+ | `colors.accent` | yes | summary bar, active states, diagram borders, focus ring |
60
+ | `colors.accentText` | yes | text placed on the accent colour |
61
+ | `colors.link` | yes | links |
62
+ | `colors.codeBg` / `codeText` | no | inline code and code blocks |
63
+ | `colors.highlight` | no | current page in the menu, search selection, matched decision rule |
64
+ | `colors.success` / `warning` / `danger` / `info` | no | badges ("verified", "possibly outdated") and callouts |
65
+ | `fonts.body` / `heading` / `mono` | no | CSS font stacks; end with a generic family |
66
+ | `fonts.googleFontsUrl` | no | one css2 URL loading every family used; loaded only when the theme is active |
67
+ | `typography.baseSize` | no | root font size in px (12–28); everything scales from it |
68
+ | `typography.lineHeight` | no | body line height (1.5–1.8 for reading) |
69
+ | `typography.headingWeight` | no | 600 or 700 usually |
70
+ | `layout.contentMaxWidth` | no | reading column in px (680–820 keeps lines under ~80 characters) |
71
+ | `layout.sidebarWidth` | no | menu width in px |
72
+ | `layout.radius` | no | corner radius in px (0–12) |
73
+ | `diagram.nodeBg` / `nodeBorder` / `nodeText` / `lineColor` / `clusterBg` / `noteBg` | no | Mermaid colours (derived from colors when absent) |
74
+ | `extraCss` | no | extra CSS; must be scoped with `:root[data-theme="<id>"]` |
75
+
76
+ Contrast rules checked by `validate`:
77
+
78
+ - **At least 4.5:1:** text, headings, links and code on their backgrounds; accentText on accent; text on highlight; text inside diagram nodes.
79
+ - **At least 3:1:** badge colours and the accent on the background.
80
+
81
+ ## Mapping a raw palette onto tokens
82
+
83
+ 1. **Background.**
84
+ - Light mode: the lightest large-area colour, usually near white.
85
+ - Dark mode: the darkest large-area colour. Avoid pure `#000000`; a deep tinted grey reads better.
86
+ 2. **Surface.** A step away from `bg`: white on an off-white `bg`, or slightly lighter than `bg` in dark mode. If the source has only one background, derive the surface by mixing bg with 3–5% of the text colour.
87
+ 3. **Text.** The darkest neutral (light mode) or the lightest neutral (dark mode). Aim for 10:1 or more on `bg`.
88
+ 4. **textMuted.** A mid neutral between text and bg that still reaches 4.5:1.
89
+ 5. **Accent.** The most saturated, most "brand" colour; `themeColorMeta` or a CSS variable named like `--brand`, `--primary` or `--accent` is a strong hint. Only one accent.
90
+ 6. **Link.** The accent if it reaches 4.5:1 on `bg`; otherwise a darker (light mode) or lighter (dark mode) shade of the same hue.
91
+ 7. **accentText.** White or near-black, whichever contrasts more with the accent.
92
+ 8. **Border.** `bg` mixed with about 12–15% of the text colour.
93
+ 9. **Highlight.** `bg` mixed with about 15–25% of the accent.
94
+ 10. **Status colours.** Keep the defaults unless the source defines its own green, amber and red; they carry meaning, so keep them recognisable.
95
+ 11. **Diagram nodes.** `surfaceAlt` fill with an accent border works for most palettes.
96
+
97
+ Keep hue changes minimal when fixing contrast; change lightness first. `theme-tool fix` does exactly that.
98
+
99
+ ## extraCss example
100
+
101
+ ```json
102
+ "extraCss": ":root[data-theme=\"acme-light\"] .summary { border-left-width: 5px; }\n:root[data-theme=\"acme-light\"] h1 { letter-spacing: -0.02em; }"
103
+ ```
104
+
105
+ Useful selectors in `base.css`:
106
+
107
+ - page regions: `.topbar`, `.sidebar`, `.page`, `h1`, `.summary`, `.prose`;
108
+ - components: `.callout-edge`, `.diagram`, `.decision`, `.children`, `.badge-stale`, `.footer`.
@@ -0,0 +1,83 @@
1
+ ---
2
+ name: docs-guide
3
+ description: Maintain DOCS-GUIDE.md, the file that tells the documentation writer what topics to cover on the living-docs site, how to write them, which sections exist and when to update. Use whenever the user wants to change what the docs site covers or how it is written - add or drop a topic, enable or disable a section, change tone, language, depth, length limits or diagram rules, add project terms or conventions, change when docs get updated - or says things like "the docs should also explain X", "stop documenting Y", "write shorter pages", or "show me the docs guide".
4
+ ---
5
+
6
+ # docs-guide
7
+
8
+ `<site>/DOCS-GUIDE.md` is the brief for everything written on the documentation site. The `docs-write` skill and the `docs-writer` subagent read it before every run, and its rules override their defaults. Keeping it accurate is the cheapest way to get better documentation.
9
+
10
+ This skill is interactive; run it in the main conversation. Talk to the user in their language. Write the guide in the documentation language: the language the guide already uses, English by default.
11
+
12
+ ## Locate the guide
13
+
14
+ It lives in the folder that has `docs.config.json` next to `engine/` (usually `docs-site/`). If the site exists but the guide is missing, recreate it:
15
+
16
+ 1. Start from `<skill-dir>/../docs-init/assets/DOCS-GUIDE.template.md`.
17
+ 2. Fill in its placeholders from the project, the same way docs-init Step 6 does.
18
+ 3. Show the result to the user for approval.
19
+
20
+ If there is no site at all, point the user to `docs-init`.
21
+
22
+ ## Structure to preserve
23
+
24
+ The writer relies on these sections, in this order. Keep their headings; the text under them is free.
25
+
26
+ | Section | Holds |
27
+ |---|---|
28
+ | Audience | who reads the site and what they must be able to do after five minutes |
29
+ | Language and tone | documentation language, voice, naming conventions |
30
+ | Site structure | checklist of sections `- [x] **Name** (`/path/`): what goes there`; `[ ]` disables a section |
31
+ | Priority topics | concrete bullets naming real modules, flows and rules, most important first |
32
+ | Out of scope | what must not be documented |
33
+ | Writing rules | page and summary length, paragraph rules, examples, code links, unverified marking |
34
+ | Diagrams | when and which diagrams, node limits, label style |
35
+ | Edge cases and tests | how edge cases are recorded and linked to tests |
36
+ | Project specifics | stack, domain glossary, conventions, external systems |
37
+ | Updating | when updates happen and what an update includes |
38
+ | Guide history | dated one-line entries, newest last |
39
+
40
+ A translated guide keeps the same sections with translated headings. Match sections by meaning, not by exact wording.
41
+
42
+ ## Operations
43
+
44
+ - **Show the guide.** Print it in full, or print only the section the user asks about.
45
+ - **Add a topic.** Add a bullet to Priority topics, placed by importance. Make it concrete and checkable. "The retry policy for failed payments (`PaymentRetryJob`): limits, backoff, what the user sees" is good. "Payments" is not.
46
+ - **Remove or deprioritize a topic.** Delete it, or move it lower. If the user wants it gone from the site too, also add it to Out of scope.
47
+ - **Enable, disable or rename a section.** Edit the checklist line.
48
+ - A new section needs a path, a one-line description of its content, and a position.
49
+ - Paths are lowercase with hyphens and should stay stable once pages exist.
50
+ - **Change a rule.** Edit the matching bullet instead of adding a contradicting one. Keep rules short, imperative and testable. For example, "a page has at most ~400 words" is testable; "keep pages short" is not.
51
+ - **Add project knowledge.** Put domain terms (with a one-line meaning), conventions and external systems under Project specifics.
52
+ - **Change the update policy.** Edit Updating. Typical choices:
53
+ - after every behaviour-changing task (the default);
54
+ - only when asked;
55
+ - at the end of each working session.
56
+
57
+ After every change:
58
+
59
+ 1. Add a line to Guide history: `- YYYY-MM-DD: <what changed, in one sentence>`.
60
+ 2. Show the user the changed lines, not the whole file.
61
+ 3. Say which existing pages are affected. Look at the section paths, the `sources` in page frontmatter, and search `content/` for the topic.
62
+ 4. Offer to update those pages now. If the user says yes, run the `docs-write` skill (or the `docs-writer` subagent) in mode `pages` for those files. Do not regenerate without the user's go-ahead.
63
+
64
+ During docs-init, approval of the first version is what starts the generation. There, apply edits and show the result again until the user approves; docs-init handles the rest.
65
+
66
+ ## Learning from corrections
67
+
68
+ If the user corrects documentation output in a way that will recur, propose a guide rule in one sentence and add it if they agree. Examples of recurring corrections:
69
+
70
+ - "don't explain what a REST API is";
71
+ - "always show the HTTP status codes";
72
+ - "call it *tenant*, not *customer*".
73
+
74
+ This keeps the fix from being lost the next time pages are written.
75
+
76
+ ## Consistency checks
77
+
78
+ Before saving, check:
79
+
80
+ - The file is still valid Markdown.
81
+ - Every enabled section has a path.
82
+ - No two rules contradict each other.
83
+ - The length limits agree with `limits` in `docs.config.json`. If the guide says "at most ~500 words", set `limits.pageMaxWords` a little above that, so `npm run check` warns at the same point.