Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add instructions/kklimuk/docx-cli/claude-mdgit clone --depth 1 https://github.com/kklimuk/docx-cliWhat it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.08873 | $0.08873 |
| Opus 5 | $0.04437 | $0.04437 |
| Sonnet 5 | $0.01775 | $0.01775 |
| Haiku 4.5 | $0.00887 | $0.00887 |
Grade A, and why
docx-cli CLAUDE.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 106 lines — stays where its author put it; the contents beside it link to each section on GitHub.
docx-cli
CLI for AI agents to read, edit, and comment on .docx files. JSON-AST output, locator-based addressing, full format fidelity via in-place XML mutation.
Bun, not Node. Use Bun.file, Bun.write, Bun.env, Bun.$. Bun loads .env automatically — no dotenv.
Subsystem-specific guidance lives in nested CLAUDE.md files that load when you edit those folders. If you need to add a new CLAUDE.md to describe a new practice for a part of the system, do so.
Conventions
These conventions are NOT SUGGESTIONS. These are rules.
- All stdout goes through
respond()(JSON ack) orwriteStdout()(text) fromsrc/cli/respond.ts— neverprocess.stdout.write. Both useBun.write(Bun.stdout, ...); the 64 KB truncation that bites on early exit is real and silent, and these helpers are the only safe path. - File naming: kebab-case, named after the primary export (
xml-node.ts→XmlNode). - Newspaper ordering. The entry point (primary export) goes at the top; its dependencies follow in the order it uses them, then their dependencies, and so on — a file reads top-to-bottom like a newspaper. Use hoisted
functiondeclarations for internal helpers so this works at runtime; arrow functions only for inline callbacks and short utilities. Types are usually not the primary exports and should go below the functions/classes that are. - Feature nesting When a file accumulates too many dependencies to be read well with newspaper ordering (> 300 lines), split them into a separate folder/file named after the feature they're working on. It should be a folder if it is going to represent a logical feature of dependencies. This nesting can continue indefinitely if subfeatures have subfeatures of their own.
- JSX is for emitters only. Files that construct fresh XML can be
.tsx; readers/locators/analysis stay.ts. Components are PascalCase, accept props, may returnNullableXmlNode(null skipped by flatten). Attribute names with colons use the hyphen shortcut (w-val="x"→w:val="x") or JSX spread. - Component vs view vs lens vs free function vs transient cursor: five shapes, one decision tree.
- A pure
props → XmlNodebuilder is a PascalCase component — destructure its props in the signature (noprops.xaccess), and don't take aDocument(or any package state). - Stateful OOXML state lives in tree-owning views, embedded as fields on
Document:Body, plus one view per OPC part —StylesView,NumberingView,CommentsView,NotesView,RelationshipsView,ContentTypesView,SettingsView,CorePropertiesView,MarginalsView. Each owns its part'sXmlNodetree and any maps keyed to it, and exposes afromPackage/fromXml/writeTolifecycle (registertoo, for the lazily-provisioned ones).MarginalsViewis the one that owns MANY parts (everyword/header{N}.xml/word/footer{N}.xml) keyed by part name rather than one — so it has no singleregister; theMarginalslens mints each part's rel + content-type as it allocates it. Cross-view dependencies (e.g.,NotesView.ensureNoteStyles(stylesView)) are passed as method arguments — no view reaches up toDocument. - Cross-cutting lenses (
Images,Hyperlinks,Equations,TrackChanges,Comments,Fonts,Marginals) are NOT fields onDocument— they're stateless, constructed at the call site:new Images(document).add(source),new TrackChanges(document).accept(["tc0"]),new Marginals(document).set(sectPrs, "footer", "default", spec),await new Fonts(document).setDefault("Times New Roman"). They hold only a back-reference; the embedded views are the state they reach through.Marginalsis the header/footer authoring lens — the noun pairdocx headers/docx footersshare it viaMarginalKindthe wayfootnotes/endnotesshareNote— reaching throughMarginalsView(part trees) + relationships/content-types (part registration) + settings (the even/odd toggle) + the live<w:sectPr>reference nodes (see src/core/marginals).Fontsis the one that also touches an UNMODELED part — the document font lives in BOTHword/styles.xml<w:docDefaults>(owned byStylesView) andword/theme/theme1.xml's<a:fontScheme>(not a view: read/mutated/staged throughPkgonly whenset-default-fontruns, so unrelated saves never re-serialize the theme blob). - Free functions are reserved for: pure builders (the components above), the AST reader (
src/core/ast/read.ts— Document's construction pass; populates the embedded views from XML and is the sole assigner oftcNids), and emitter helpers insrc/core/blocks/table/sectionsthat thread aDocumentbecause they touch many slices in one call. If a free function's body operates on one slice ofdocument, make it a method on that slice's view instead. - Transient cursors are the one stateful shape that is NEITHER a view nor a lens: a short-lived object holding position state over a SINGLE node's child list, valid only within one mutation pass (today
CellInsertionCursorin src/core/table, which keeps a batch's inserts into one<w:tc>in entry order). It holds noDocument, isn't embedded on one, and dies with the pass — so don't file it as a lens. It lives beside the primitives it sequences, and the CLI constructs one per target and calls it.
- A pure
- JSX.Element = XmlNode (single, not nullable).
Fragmentreturns a#fragmentsentinel unwrapped inflatten()andserialize(). Components returnnullto render nothing;jsx()converts that to an empty fragment. Thejsx/jsxs/jsxDEVruntime exports are distinct functions, not= jsxaliases (knip flags aliased re-exports as duplicates) — don't collapse them. - Path aliases:
@core→src/core/index.ts,@core/*→src/core/*. Use these insrc/cli/*;src/coreitself uses relative sibling imports. Import the body emitters from the@core/blocksand@core/tablesubpaths, not the@corebarrel —ast/typesalready exportsParagraph/Table/TableCell/TableRowas types, and barrel-merging the same-named value emitters is confusing. - Variable names: descriptive, no single/two-letter (
paragraphnotp). Exception: regex-match destructuring (const [, prefix, idx] = match). - Inline props in the signature. When a component's props type is used only by that component, write it inline (
function HeadingStyle({ styleId }: { styleId: BaselineStyleId; … })) rather than declaring a separate namedPropstype. Extract a named type only when it's shared. - knip runs strict (
bun run check, no rule overrides inknip.json). An unused export is dead code — delete it (this is a CLI app, not a library; there are no external@coreconsumers). The one exception: an export staged for a named upcoming tier with no caller yet gets a@publicJSDoc tag whose comment names the future consumer (knip honors@public) — e.g.HorizontalRule(S8) and ther/a/wp/picimage namespaces (S5). Don't silence knip by re-adding rule suppressions. - Style: tabs, double quotes (Biome enforced). Early returns over else-if chains.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 2d ago First seen · 106 lines · 8,873 tokens per session scan A 665a4ac135ea
docx-cli CLAUDE.md is an instructions file published in the GitHub repository kklimuk/docx-cli (194 stars, last pushed 15d ago), licensed MIT. It adds 8,873 tokens to every session, about $0.0444 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other instructions, from other repositories
open-agent-hub AGENTS.md
AGENTS.md instructions for guanyang/open-agent-hub, covering agents.md, 1. think before coding, 2. simplicity first, 3. surgical changes and 4. goal-driven execution.
superdesign-skill AGENTS.md
Instructions for superdesigndev/superdesign-skill, covering project agent memory, what this repo is, skill flow invariant: two entry paths, ground truth for cli behavior and plugin packaging & release.
stewie-pixel guidelines
Behavioral guidelines to reduce common LLM coding mistakes. Use when writing, reviewing, or refactoring code to avoid overcomplication, make surgical changes, surface assumptions, and define verifiable success criteria.
vanguard-frontier-agentic copilot-instructions.md
Instructions for VincentChuWaiChow/vanguard-frontier-agentic, covering vanguard frontier agentic repository instructions, what to optimize for, repo structure, rules for changes and cross-platform asset rule.
archeyes CLAUDE.md
Instructions for thisAAY/archeyes, covering archeyes — project guide, layout, design system, commands and publishing a release.
kleinanzeigen-reader CLAUDE.md
Instructions for its-me-prash/kleinanzeigen-reader, covering claude.md — kleinanzeigen-reader, what this repo is, auto-load instructions for claude code, quick command reference and fetch a listing.