Borrowing it
Nothing to install: this file belongs to kklimuk/docx-cli. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/kklimuk/docx-cli/main/CLAUDE.mdgit clone --depth 1 https://github.com/kklimuk/docx-cliWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/instructions/kklimuk/docx-cli/claude-md)<a href="https://agentmods.dev/instructions/kklimuk/docx-cli/claude-md"><img src="https://agentmods.dev/badge/instructions/kklimuk/docx-cli/claude-md/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/instructions/kklimuk/docx-cli/claude-md"><img src="https://agentmods.dev/badge/instructions/kklimuk/docx-cli/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What 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.1 | $0.10697 | $0.10697 |
| Opus 5.5 | $0.04279 | $0.04279 |
| Sonnet 5.5 | $0.02139 | $0.02139 |
| Haiku 4.5 | $0.01070 | $0.01070 |
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 yesterday.
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 — 125 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. The production sinks use lazyBun.stdout.writer()/Bun.stderr.writer()FileSinks and await each write and flush before exit. Never switch these toBun.write(Bun.stdout, ...)orBun.stdout.write(...): large OS-pipe writes can repeat bytes or hang after a dependency accessesprocess.stdout(issue #8). Stderr goes throughwriteStderr()for the same reason. A reader that closes early (docx read … | head) is the consumer's choice, not a command failure: the sink swallowsEPIPE, drops later writes, and the command exits with its own code — never rethrow it (main's catch-all would write the error to the same dead pipe and crash with a stack trace). - 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.
- yesterday Changed · +1 lines · +190 tokens per session 962c4fed921e
- 5d ago Changed · +1 lines · +45 tokens per session 92d3a5551ef1
- 7d ago Changed · +9 lines · +675 tokens per session c7bfa67caca5
- 8d ago Changed · +12 tokens per session 9b9dd77340f9
- 21d ago Changed · +7 lines · +195 tokens per session 38827219eaac
- 1mo ago Changed · +1 lines · +707 tokens per session 4ada65fd8279
- 1mo 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 (225 stars, last pushed yesterday), licensed MIT. It adds 10,697 tokens to every session, about $0.0428 per session on Opus 5.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
vscode buildNext.instructions.md
Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).
next.js AGENTS.md
AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.
vscode oss-third-party-notices.instructions.md
Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, cache eligibility and rollout and applying the notice (cutover).
langchain AGENTS.md
AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.
deepseek-harness AGENTS.md
AGENTS.md instructions for deepseek-ai/deepseek-harness, covering agents.md, pre-stable apis and released session data, repository layout, commands and host sandbox failures.
vscode copilot-instructions.md
Copilot instructions for microsoft/vscode, covering vs code copilot instructions, project overview, root folders, core architecture (src/ folder) and built-in extensions (extensions/ folder).