원클릭으로
readme-assert
Verify README code blocks still work using readme-assert — extracts fenced blocks and runs them with assertion comments.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Verify README code blocks still work using readme-assert — extracts fenced blocks and runs them with assertion comments.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Set up a git pre-commit hook that rejects commits when staged files aren't formatted. Detects the repo's formatter and writes a check-only hook.
Set up a git pre-push hook that rejects pushes when code isn't formatted. Detects the repo's formatter and writes a check-only hook.
Convert existing README code examples into testable readme-assert blocks by adding test tags and assertion comments.
| name | readme-assert |
| description | Verify README code blocks still work using readme-assert — extracts fenced blocks and runs them with assertion comments. |
| user-invocable | true |
| allowed-tools | Bash Glob Grep Read Edit |
You are helping the user verify their README's code blocks still work. The tool
is readme-assert — it extracts fenced code
blocks tagged test and runs them with assertion comments transformed into real
assertions.
Find the README. Look for README.md or readme.md in the current
working directory. If neither exists, tell the user and stop.
Run it. Execute npx readme-assert with Bash.
Interpret the result.
No test code blocks found in ...: the README has no
test-tagged blocks. Read the README, find the candidate fenced JavaScript
/ TypeScript blocks, and ask the user whether to (a) tag them explicitly by
adding test after the language fence, or (b) re-run with --auto so
blocks containing assertion comments are picked up automatically. Show the
candidates.FAIL <path>:<line> header followed by a
source snippet and expected: / received: lines: parse the failing line
number, read that line in the README, understand what it's trying to
demonstrate, and propose a targeted fix. When it's ambiguous whether the
expected value or the code is wrong, ask before editing.After editing, re-run npx readme-assert to confirm.
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 (async):
expr; // rejects /pattern/
expr; //=> rejects TypeError: message
Console output (preserves the log call, adds assertion):
console.log(expr); //=> value
Resolves (async):
await promise; //=> value
promise; //=> resolves to value
Supported languages: javascript, js, typescript, ts.
Tag blocks as tests — text after test becomes the description in output:
```javascript test
```javascript test my description
```javascript should add numbers
```ts test
Group blocks to share scope (variables/imports carry across blocks in the same group):
```javascript test:groupname
```javascript test:groupname step two
--file, -f readme file to read
--main, -m entry point of the module
--auto, -a auto-discover test blocks (any block with assertion comments)
--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
Imports of the package name (from package.json name field) are automatically
rewritten to point to local source. Resolves via main, exports, or --main
override. Sub-path imports and require() are also rewritten.
readme-assert --main ./src/index.tsreadme-assert --import tsx --main ./src/index.tsreadme-assert --import @swc-node/register/esm-register --main ./src/index.tsreadme-assert --import @happy-dom/global-registrator/register.js//=> value usually just needs the expected value
updated to match reality — check git log or the surrounding prose when
unsure whether the expected or the code is canonical.npx readme-assert --print-code -f <path> prints the exact code readme-assert
will execute for each block. Useful when a transform is doing something
unexpected.