readme-assert
llms.txt9 starsChanged 8 months agoMITView on GitHub
Run code blocks in your README as tests readme-assert extracts fenced code blocks from markdown files and runs them as tests using Node.js. Special comments are transformed into assertions. Source: https://github.com/laat/readme-assert Docs: https://readme-assert.laat.dev npm install readme-assert Tag code blocks with test and add assertion comments: Run: npx readme-assert Equality (primitives use assert.strictEqual, objects/arrays use assert.deepStrictEqual): expr; //=> value expr; // => value expr; // → value expr; // -> value Throws: expr; // throws /pattern/ expr; //=> TypeError: message expr;…
- Installs packages
In this repositoryOne other file it gives its agents.
- docsSkill
The file
We split this llms.txt into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 68
All mode (--all): runs every JS/TS block.
≈ “Common” is an estimate: at least 1 in 5 of the 1,484 llms.txt files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
# readme-assert > Run code blocks in your README as tests readme-assert extracts fenced code blocks from markdown files and runs them as tests using Node.js. Special comments are transformed into assertions. Source: https://github.com/laat/readme-assert Docs: https://readme-assert.laat.dev ## Install npm install readme-assert ## Quick Start Tag code blocks with `test` and add assertion comments: ```javascript test 1 + 1; //=> 2 ``` Run: npx readme-assert ## Assertion Syntax Equality (primitives use assert.strictEqual, objects/arrays use assert.deepStrictEqual): expr; //=> value expr; // => value expr; // → value expr; // -> value Throws: expr; // throws /pattern/ expr; //=> TypeError: message expr; //=> TypeError: /regex/ expr; //=> TypeError Rejects: expr; // rejects /pattern/ expr; //=> rejects TypeError: message Console output (preserves the log call, adds assertion): console.log(expr); //=> value Resolves: await promise; //=> value promise; //=> resolves to value ## Code Block Tags Supported languages: javascript, js, typescript, ts Tag blocks as tests: ```javascript test ```javascript test my description ```javascript should add numbers ```ts test Text after the tag keyword appears as a description in test output: ✔ README.md:13 — add numbers (0.3ms) Group blocks to share scope: ```javascript test:groupname ```javascript test:groupname my description Auto-discover mode (--auto): runs any block with assertion comments. All mode (--all): runs every JS/TS block. ## CLI Usage: readme-assert [options] Options: --file, -f readme file to read --main, -m entry point of the module --auto, -a auto-discover test blocks --all, -l run all supported code blocks --require, -r require a CJS module before running (passed to node --require) --import, -i import an ESM module before running (passed to node --import) --print-code, -p print the transformed code --version, -v show version -h, --help show help ## Import Renaming Imports of your package name are automatically rewritten to point to local source. Reads the `name` field from package.json and resolves via `main`, `exports`, or `--main` override. Sub-path imports and require() are also rewritten. ## Integrations TypeScript (native, Node.js >=22.6): readme-assert --main ./src/index.ts tsx: readme-assert --import tsx --main ./src/index.ts SWC: readme-assert --import @swc-node/register/esm-register --main ./src/index.ts esbuild: readme-assert --require esbuild-register --main ./src/index.ts ts-node: readme-assert --require ts-node/register --main ./src/index.ts Babel: readme-assert --require @babel/register --main ./src/index.js happy-dom (browser globals): readme-assert --import @happy-dom/global-registrator/register.js jsdom (browser globals): readme-assert -r jsdom-global/register nock (HTTP mocking via setup file): readme-assert --import ./setup.js Custom setup: readme-assert --require ./test-setup.js
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

