Logo de Docs Builder

Docs Builder

Communauté
hamr0
docs-builder

Reorg a docs corpus, split an oversized doc, search it, keep pages current, index them

Présentation

Éditeurhamr0
Dépôtliteagents
Nom de la compétencedocs-builder
Étoiles
27
Forks
4
Fichiers inclus
1
LicenceApache-2.0
Liens
  • Instructions en Markdown

    Un fichier SKILL.md que le modèle charge à la demande : il ne consomme donc des tokens que lorsqu’une demande correspond réellement à la compétence.

  • Compatible avec tous les LLM

    Les compétences IA sont en simple Markdown, et non en code propre à un fournisseur. Elles fonctionnent donc avec GPT, Claude, Gemini, Grok ou un modèle local.

  • 1 fichiers inclus

    Des scripts, des modèles de documents et des références que le modèle peut consulter pendant son travail. Les fichiers sont en lecture seule et ne sont jamais exécutés.

  • Open source

    Publiée par hamr0 sur GitHub. Consultez les sources avant de l’installer.

Installation

Installez la compétence IA Docs Builder dans TypingMind pour l’utiliser avec n’importe quel LLM, ou ajoutez-la à un autre agent capable de lire SKILL.md.

1

Installer dans TypingMind

TypingMind installe une compétence directement depuis son dossier GitHub : l’application lit SKILL.md, regroupe les fichiers de ressources et enregistre le tout localement.

  1. Ouvrez l’application et accédez à Plugins → Compétences.
  2. Choisissez « Installer depuis GitHub ».
  3. Collez l’URL du dossier de la compétence indiquée ci-dessous, puis confirmez.
    https://github.com/hamr0/liteagents/tree/main/packages/ampcode/skills/docs-builder
  4. Activez la compétence dans chaque discussion où vous souhaitez pouvoir l’utiliser.
Plugins → Compétences → Ajouter → Via URL GitHub, puis collez l’URL du dossier et appuyez sur Continuer.
2

Installer dans un autre agent

Tout agent capable de lire le format Agent Skills peut utiliser cette compétence : copiez le dossier dans le répertoire des compétences de cet agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/hamr0/liteagents.git /tmp/liteagents
mkdir -p .claude/skills
cp -r /tmp/liteagents/packages/ampcode/skills/docs-builder .claude/skills/docs-builder
Redémarrez Claude Code après la copie pour que la nouvelle compétence soit prise en compte.

Utilisez cette compétence dans TypingMind

Activez Docs Builder dans n’importe quelle discussion TypingMind et le modèle s’occupe du reste. Le nom et la description de la compétence figurent dans le prompt système. Dès qu’une demande correspond, le modèle charge lui-même l’intégralité des instructions : vous n’avez jamais à l’invoquer manuellement, et elle ne consomme aucun token tant qu’elle n’est pas utilisée.

Le modèle charge automatiquement Docs Builder dès qu’une demande correspond à cette compétence.

Compatible avec tous les modèles IA

Les compétences IA sont de simples instructions Markdown, et non du code propre à un fournisseur. Ainsi, Docs Builder n’est pas lié au modèle pour lequel cette compétence a été conçue. Installez-la une seule fois dans TypingMind et utilisez-la avec GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama ou un modèle local que vous exécutez vous-même, le tout avec vos propres clés API.

  • Chargée uniquement en cas de besoin

    Le prompt système ne contient que le nom et la description. Les instructions sont récupérées à la première demande correspondante : une compétence inutilisée ne coûte donc rien.

  • Changez de modèle en cours de discussion

    La compétence étant constituée d’instructions et non de code, elle reste fonctionnelle lorsque vous changez de modèle : le nouveau modèle lit le même fichier SKILL.md.

Instructions de la compétence

Voici le contenu de SKILL.md que le modèle charge. Lisez-le avant l’installation : une compétence contient des instructions que votre modèle suivra.

docs-builder

Keep project docs current, complete and findable, and split a file when it outgrows its row in docs/index.md. Why it works this way, measured numbers and history: docs/product/docs-builder-README.md.

This does NOT make docs cheaper to read — never sell it as a token saving. Every mechanical step is the docs-builder.cjs script beside this file, the $DB path below (vanilla Node, zero deps). A model does two things only: classify and propose themes, and write pages.

  • Heavy model work always spawns a worker, tier stated explicitly (an omitted tier inherits the parent's). Never name a vendor model. Hand the worker its inputs — it has no skill text of its own — and it does the work itself, no sub-spawning. Anything that asks the user stays in the main session. Fall back to inline only if your tool cannot spawn.

Setup

docs-builder.cjs sits next to this file in docs-builder/, installed or run from the package. Never search the target repo for it, never reconstruct it from this spec; if it exists nowhere, say so and stop. Set DB to its ABSOLUTE path, then cd to the target repo root:

DB=<absolute path to docs-builder.cjs>
cd <target repo root>

Every command below is node $DB …. Everything the script writes (docs/.docs-builder/* state, docs/index.md, docs/log.md, the ledger, the config pointer) lands under the target repo; REPO= is only needed when not running from its root.

Hard rules

  • Only .md files are ever opened, read, edited or listed — a non-.md file is never touched, not even to report a mention.
  • Never moved, enforced in code: README.md, index.md, log.md, CHANGELOG.md, LICENSE.md, CONTRIBUTING.md, CODE_OF_CONDUCT.md, SECURITY.md, CLAUDE.md, AGENTS.md, AGENT.md (case-insensitive, any depth), every dot-dir, node_modules/.
  • Nothing moves before the user approves the table. Only after approval does apply-reorg run; it refuses while any row's bucket is empty.
  • Never split N files in one shot on a list the user has not seen.
  • reorg never splits. cleanup <file.md> is the ONLY entry to the split pipeline: exactly one .md file, refuses a missing or protected one.
  • cleanup-apply refuses without a labels.json that has exactly one core: true theme.
  • The original is always archived byte-identical (git mv into docs/archive/); every cleanup output is a new file, nothing edits a source doc.
  • docs/index.md has exactly one writer: index-flat — never hand-edit it.
  • Never rewrite CHANGELOG.md or log.md links (any depth). Nothing under docs/archive/ is ever a rewrite target; links elsewhere that point at an archived file are still repaired.
  • Commit only through the printed pathspec recipe; never git add -A, git add -u or git commit -a.

Invocation

With an argument (reorg [dir], cleanup <file>, search <query words...>) run that mode directly, no question.

Bare /docs-builder — ALWAYS ask, never auto-detect. Run node $DB due first and put its one-line verdict in the question text. Then AskUserQuestion, one question, header Mode, exactly these two options:

Question: What should docs-builder do?

  • First run — sort root-level .md files and everything under docs/ into product/wiki/logs/archive, then split anything too big into pages and index them. Use when docs are a pile of loose files, or docs-builder has never run here.
  • Docs drift — docs moved on since the last run: report what changed, rebuild the index, re-run lint. Nothing is restructured and nothing is split.

Do not offer a third option and do not recommend one. If due cannot run, say so plainly and ask anyway.

search is explicit-argument only, never a third picker option: /docs-builder search <query words...> runs node $DB search <query words...> (BM25 over docs/.docs-builder/outline.json, N= sets the result count, default 10; a first argument ending in .json is read as the outline path). Read-only, no model, nothing moves.

ChoiceRuns
First runReorg steps 1-3, then Finish; split each file the user picks (Cleanup), then Finish again
Docs driftnode $DB reorg, then Finish
reorg [dir] / cleanup <file>those steps directly

Buckets

  • product — docs about the product itself: specs, PRDs, designs. Flat.
  • wiki — generic knowledge: conventions, how-tos, standards. Flat; also where split pages go.
  • logs — one-time, timely records: POCs, experiments, incident write-ups, reports. The only bucket that nests, one level: docs/logs/<group>/.
  • archive — self-declared dead. Frozen: never re-checked.
  • docs/.docs-builder/ is machine state (plan, outline, labels, tasks, ledger, commit-*.txt); never hand-edit it.

Reorg — a whole corpus

1. Discover — nothing moves, nothing is classified:

node $DB discover

Scope with no argument: .md files at the repo root (top level only) plus everything under docs/ (recursive; product/, wiki/, logs/ re-checked every run, docs/archive/ skipped; gitignored files are skipped). node $DB discover <dir> scopes to exactly <dir> instead. Writes reorg-plan.json: per file h1, snip, lines, an oversized boolean, and a mechanical suggested bucket + reason. suggested is a PRIOR, never a verdict. bucket is empty on every row discover has not classified before; files already in product/, wiki/ or logs/ are real rows and need a bucket too. apply-reorg reads only bucket.

2. Classification interview — the model's judgment, behind the approval gate. Classify it yourself (no spawn), in one pass over the WHOLE plan table (file, h1, snip, lines, suggested+reason): fill bucket (product/wiki/logs/archive) on every row where it is empty and keep a one-line reason per row. Write only bucket into reorg-plan.json. A SHOUTED self-declared status (**Status: CLOSED**) is near-conclusive for archive; suggested never overrides the model. Then run:

PREVIEW=1 node $DB apply-reorg

It prints approval table — N row(s), sorted by destination, one line per row from <file> to <dest> · <lines> lines[ (oversized)] · <bucket>, then preview only — nothing moved, nothing written. (exit 1 if a row is still unclassified). Show the user the rows in a normal chat message, in printed order, each as printed plus · why: <your one-line reason>. Then ask via AskUserQuestion only "Approve these N moves?" — approve all / correct specific rows / abort. A correction changes bucket in the plan, then re-run the preview. Abort moves nothing.

3. Apply:

node $DB apply-reorg

Moves every row, oversized included (size decides splittable, not sorted); collisions get -2, -3; emptied source dirs are removed; moves are STAGED, never committed for you. It rebuilds docs/index.md and outline.json, writes the <!-- DOCS_INDEX:START --> pointer block into CONFIG (default CLAUDE.md; this package uses CONFIG=CLAUDE.md), and records each moved file's new path and bucket in the plan. Every move repairs inbound links to the old path (.md files only, relative and repo-rooted, own links re-based; fenced code blocks are never rewritten; a backticked exact path in prose IS rewritten, a link-shaped string inside an inline code span is not) and logs to docs/log.md.

It then prints the oversized docs it just moved, cleanup <NEW path> (N lines), logs/ last. If none, say so and skip the split question; otherwise show the list and ask which to split (any, all, none), then run Cleanup on each chosen file.

Docs drift. Bare node $DB reorg prints the due summary first (if a ledger stamp exists), runs discover, and stops only for rows with no bucket (new files, or files moved since). After a first sort the plan keeps each file's new path and approved bucket, so edited files do not re-ask. On a stop, run step 2 for the empty rows and then apply-reorg. Fully classified, it runs apply-reorg then lint and continues. OUT is ignored by reorg. reorg <dir> passes <dir> to discover.

Finish — after every run that moved or wrote files

apply-reorg, archive and cleanup-apply print a closing advisory and never commit. Its last lines are:

  • BRANCH: <name> — on main/master it reads do NOT commit: obey it, tell the user the files are ready and to switch to a branch first.
  • QUESTION: Commit these N files now? (plus a note naming files that already carried the user's own uncommitted edits) — relay that line via AskUserQuestion, header Commit: Commit (run the printed recipe) / Leave uncommitted (say what is pending; nothing this run did gets undone).
  • WARN: docs/.docs-builder/ is not gitignored — … — act on it: add docs/.docs-builder/ to .gitignore before the first commit (machine state; this script never edits it).

On Commit, run the printed recipe line EXACTLY as printed, never hand-edited, staged by hand, or scoped to docs/ alone (a .md outside docs/ can carry a repaired link):

git add --pathspec-from-file=docs/.docs-builder/commit-add.txt && git commit -m "docs: reorg" --pathspec-from-file=docs/.docs-builder/commit-files.txt

(When REPO is not the shell's cwd it prints git -C '<REPO>' … — run that form unmodified.) If it errors or names a missing path that is a BUG: stop and report it, do not silently hand-repair.

After a successful commit run node $DB ledger to stamp the consolidation. Without the stamp due stays NOT due and /remember's docs nudge never fires.

Cleanup — split one oversized file

node $DB cleanup docs/BIG.md (use the file's current path) prints its size and estimated write cost, scans, prints a heading-shape table, writes cleanup-shape.json, then STOPS. Nothing past it runs — no archive, no page, no model call — until the interview below is answered.

Interview. Spawn one cheapest-tier worker to read the document (weighted to the opening, enough of the rest to name the other themes); it returns the "mainly" theme and the other themes, and the MAIN session asks the user via AskUserQuestion, one question, exactly this shape:

Question: Is this split right?

<the shape table cleanup printed>

This document is mainly: <your read of the dominant theme>. Other themes present: <theme>, <theme>, ...

Is that right, and are those the themes you want split out?

Options at minimum Confirm (proceed with the themes exactly as stated) and Correct (the user names what the document is actually mainly about, and/or edits the other-themes list). A correction must change what gets built: the corrected "mainly" theme is the one marked core: true, the edited list is the fixed list proposed against. Never auto-detect and call it an interview.

2a. Propose (spawn one cheapest-tier worker, ONE call over ALL headings). Feed every records[].key plus its snip and the interview answer. Ask for a fixed theme list with a one-line gloss each; the interview's "mainly" theme is the core, exactly one; aim for no theme above ~30% of the lines. Its page carries the original's basename.

2b. Assign (spawn cheapest-tier workers, chunks of ~20 sections). Each section gets a theme from that list. Never emit a positional index. Echo records[].key back verbatim, delimited in the prompt:

<<<KEY>>>the exact key text<<<END>>>
snippet text on the following lines

Propose globally before assigning; validate before use. Write docs/.docs-builder/labels.json as { "themes": [{name, gloss, core?}], "labels": [{key, theme}] }, core: true on exactly the one interview theme.

3. Validate — hard gate, exits 1 on FAIL; do not proceed on FAIL, re-run the failing chunk:

node $DB validate

It checks every key exists once and none is invented or off-list, every outline source file still exists (paths), every relative .md link in INDEX (default docs/index.md) resolves (links), and every page citation lands in its own task's ranges (citations; uncited sections are reported, never block). REPO= must be the repo scan used.

4. Plan + apply:

node $DB cleanup-apply docs/BIG.md

Refuses before doing anything if labels.json is missing or has no core: true theme. Otherwise it runs plan (one docs/.docs-builder/tasks/task-<theme>.json per page, estimated cost for pages still to write) and, if any page is missing, stops. Re-run the same command after step 5: once every page exists it archives the original, relocates the core page to the original's directory under its original basename, restores inbound links from the archive to that core page (the split pages keep their archive citations), and rebuilds docs/index.md. node $DB plan alone re-reports what is left (a theme whose page exists in docs/wiki/, override PAGES=, is done).

5. Write pages (spawn one mid-tier worker per page). Hand each writer agent its task-<theme>.json: the writer brief is inside it. A page counts as written only with YAML frontmatter and at least 10 lines; shorter is PARTIAL and is rewritten. Each agent reads only its own line ranges, every claim cited (<file>:<start>-<end>) inside those ranges, 250 lines a ceiling. Write the core page under docs/wiki/ like the rest; cleanup-apply relocates it. Launch 3 at a time. Exit condition is a command: re-run node $DB plan and read it; step 5 is done only when it prints all pages written with no page listed PARTIAL (and no page(s) exist but are not a finished page WARN).

6. Archive — run for you by cleanup-apply; standalone node $DB archive docs/BIG.md is a verified move (hash, git mv, hash). Exit codes are not interchangeable:

exitmeaningwhat to do
0moved, all follow-ups succeedednothing
1the move failed — nothing movedfix and re-run
2the file moved, but a follow-up failed (archive: outline/labels sync or link rewrite; cleanup-apply: core page not relocated, index not rebuilt)fix by hand; do NOT re-run; for cleanup-apply finish with node $DB index-flat

Pruning the archive is the user's own git rm; nothing here deletes.

Other commands

  • node $DB index-flat rewrites docs/index.md: ## Product, ## Logs (grouped), ## Archive, each row an H1, a line count, a link, plus one (Lstart–end) line per H2. It prints a console-only WARN past 100 archive rows. Run it by hand after a git rm of archived docs.
  • node $DB lint <file.md...> → lint.json, declared-only. Act on supersession declared in a heading; everything else (supersessionInBody, uncited, redundant) is read or proposed to the user, never acted on. Observed beats inferred.
  • node $DB ledger stamps the consolidation; node $DB due prints what changed since (kinds new, moved, moved+changed, changed, deleted) and says REORG IS DUE at 5 changed docs. due only prints. Its output is a contract /remember reads: no ledger yet … NOT due., docs unchanged since <sha>. NOT due., the row table, <n> docs changed since <sha> (threshold 5) — REORG IS DUE.. /remember also runs index-flat on any drift; /docs-builder owns the ledger, /remember only reads it.

Final report

The final message ends with these eight lines, in this order, filled from what you did (a run that ends without them did not finish). A line for a step this run did not take says N/A (<why>); validate: is the Cleanup step-3 gate, so a run without a split says NOT RUN: no split.

mode: first-run | drift | reorg <dir> | cleanup <file> | search · asked: yes | N/A (argument given)
due: <one-line verdict> | NOT RUN: <reason>
classify: <N> rows · approved | corrected <K> | aborted | N/A (nothing unclassified)
split: <N> oversized offered · chose <files | none> | N/A (none oversized | cleanup mode: not offered)
cleanup: interview confirm | correct · pages <done>/<total> · PARTIAL 0 · archive exit <0|1|2> | N/A
gitignore: ignored | added | NOT ignored: <reason>
validate: PASS exit 0 | FAIL | NOT RUN: <reason>
finish: committed <sha> | left uncommitted (N files) · ledger stamped @ <sha> | NOT stamped: <reason>

Fichiers inclus

Le modèle lit ces fichiers à la demande lorsque la compétence est chargée. Ils sont accessibles en lecture et ne sont jamais exécutés.

Foire aux questions

À quoi sert la compétence IA Docs Builder ?

Reorg a docs corpus, split an oversized doc, search it, keep pages current, index them

Pourquoi utiliser Docs Builder sur TypingMind ?

Parce que vous l’installez une seule fois pour l’utiliser avec n’importe quel modèle. Docs Builder se compose de simples instructions en Markdown plutôt que de code propre à un fournisseur. La même compétence fonctionne donc avec GPT-5, Claude, Gemini, Grok ou un modèle local, et vous pouvez changer de modèle en cours de discussion sans perturber son fonctionnement. TypingMind utilise vos propres clés API : vous payez donc directement les fournisseurs plutôt qu’un abonnement par siège, et vos compétences et discussions restent dans votre propre espace de stockage.

Comment installer Docs Builder dans TypingMind ?

Dans TypingMind, ouvrez Plugins → Compétences → Installer depuis GitHub et collez https://github.com/hamr0/liteagents/tree/main/packages/ampcode/skills/docs-builder. TypingMind lit le fichier SKILL.md, regroupe les fichiers associés et installe le tout sous forme de compétence que vous pouvez activer pour chaque discussion.

Quels modèles d’IA peuvent utiliser Docs Builder ?

N’importe quel modèle que vous connectez dans TypingMind. Les compétences IA sont de simples instructions en Markdown, et non du code propre à un fournisseur. GPT, Claude, Gemini, Grok et les modèles locaux peuvent donc tous charger cette compétence lorsqu’une demande lui correspond.

Combien de modèles d’IA puis-je utiliser avec Docs Builder ?

Autant que vous le souhaitez. Tant qu’un modèle prend en charge les compétences, vous pouvez utiliser Docs Builder avec lui : GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama et bien d’autres, le tout dans TypingMind avec vos propres clés API.

La compétence IA Docs Builder est-elle gratuite ?

Oui. Cette compétence est publiée sur GitHub par hamr0 sous licence Apache-2.0. Vous ne payez que votre propre fournisseur d’IA pour les tokens utilisés.

Que sont les compétences IA ?

Une compétence IA est un ensemble d’instructions réutilisables qui apprend à un modèle d’IA à accomplir une tâche précise. Elle suit le format ouvert Agent Skills : un fichier SKILL.md contenant un nom et une description, ainsi que les éventuels scripts, modèles de documents ou fichiers de référence dont le modèle peut avoir besoin. Le modèle ne lit les instructions que lorsque votre demande correspond à la compétence. Une compétence installée ne coûte donc rien tant qu’elle n’est pas utilisée.

En quoi les compétences IA diffèrent-elles des plugins ou des serveurs MCP ?

Un plugin ou un serveur MCP fournit au modèle de nouveaux outils à appeler : du code qui s’exécute quelque part et renvoie un résultat. Une compétence IA lui apporte plutôt des connaissances et une méthode : comment aborder une tâche, quelles étapes suivre et à quoi ressemble un bon résultat. Les compétences sont de simples instructions en Markdown. Elles ne nécessitent donc ni serveur, ni clé API, ni environnement d’exécution, et fonctionnent avec n’importe quel modèle.

Tout voir

Créez votre propre espace IA dès maintenant

Abonnez-vous à notre newsletter pour être informé des nouvelles fonctionnalités et des prochains cadeaux à gagner 👇