Getting started¶
README.md files often become outdated because the code examples are
not regularly tested. readme-assert extracts fenced code blocks from
your readme and runs them as tests, using special comments as assertions.
Install¶
Quick Start¶
Add test assertions to code blocks in your README.md:
Run:
That's it. If any assertion fails, the process exits with a non-zero code.
How It Works¶
- Each fenced code block is extracted from the markdown
- Blocks with the same
test:groupname are merged; others run independently - Assertion comments (
//=> value) are transformed intoassert.strictEqual()orassert.deepStrictEqual()calls - Imports of your package name are rewritten to point to your local source
- Each block is written to a temp file and executed with
node
Agent Skills¶
There are portable skills you can install in Claude Code or any compatible agent:
/readme-assert— run readme-assert and walk through any failures/readme-assertify— convert an existing README into a testable one by addingtesttags and//=>assertion comments