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 rules/alphabitcore/nexus-gateway/unit-test-coverage-95git clone --depth 1 https://github.com/AlphaBitCore/nexus-gatewayWrote 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/rules/alphabitcore/nexus-gateway/unit-test-coverage-95)<a href="https://agentmods.dev/rules/alphabitcore/nexus-gateway/unit-test-coverage-95"><img src="https://agentmods.dev/badge/rules/alphabitcore/nexus-gateway/unit-test-coverage-95.svg" alt="Measured on agentmods" 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 | $0.00766 | $0.00766 |
| Opus 5 | $0.00383 | $0.00383 |
| Sonnet 5 | $0.00153 | $0.00153 |
| Haiku 4.5 | $0.00077 | $0.00077 |
Grade A, and why
unit-test-coverage-95 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 3d 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 — 52 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Unit test coverage ≥95% (binding)
Canonical text lives in
CLAUDE.md. This rule is the IDE-side surfacing; when this file disagrees withCLAUDE.md,CLAUDE.mdwins.
The rule
Every Go package in packages/** must hit ≥95% statement coverage under go test -cover -count=1 ./..., OR be listed in scripts/.coverage-allowlist with a concrete category and rationale.
Enforcement
- Pre-commit hook runs
scripts/check-go-coverage.sh --stagedon the Go packages with staged changes. Blocks the commit if any non-exempt package falls below 95%. - Full sweep runs
npm run check:coverage(also covered bynpm run check:all). CI is wired to fail on threshold misses. - Strict-allowlist mode:
scripts/check-go-coverage.sh --strict-allowlistflags allowlisted packages that have since reached the threshold and can be removed from the file.
Allowlist policy
Adding a package to scripts/.coverage-allowlist requires:
- Explicit user approval in chat (echo the reason before committing).
- One of these categories in the trailing comment:
- (A)
cmd/*entry point — onlymain()wiring, no logic. - (B) Test helper (e.g.
bufconn,testutil,idptest,storetest). - (C) DB-bound — tests require live PostgreSQL.
- (D) OS-bound — tests need kernel APIs / system keychain / packet capture.
- (E) Network-infra-bound — tests need real S3 / NATS / Redis Sentinel.
- (F) Integration-only — existing tests live behind build tags.
- (A)
Packages that are currently below threshold but on the open-source readiness roadmap may be allowlisted under the "Open-source readiness backlog" section, with a follow-up reference. The long-term goal is an empty allowlist.
Writing tests that count
Tests must assert observable business behavior and named failure modes — not just exercise code paths. Coverage padding (calling a function only to bump the percentage without assertions, or asserting only err == nil) defeats the rule's purpose.
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.
- 3d ago First seen · 52 lines · 766 tokens per session scan A bacf88369ba0
unit-test-coverage-95 is a cursor rule published in the GitHub repository AlphaBitCore/nexus-gateway (22 stars, last pushed 8d ago), licensed Apache-2.0. It adds 766 tokens to every session, about $0.0038 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 cursor rules, from other repositories
go_test
Cursor rule "go_test" from tphakala/birdnet-go, covering go test best practices, go version, test function conventions, table-driven tests and test utilities and cleanups.
schema_test_implementation_guide
A concise and practical guide for building GoZod Schema test files, updated with the latest practices from stringtest.go, objecttest.go, and complextest.go.
python_clean_code
Python clean code for cookbook flagships and recipes.
go-test
Go test conventions — parallelism, table-driven tests, assertions.
d-test-unit-test
Cursor rule "d-test-unit-test" from xyzbit/AI-Coding, covering golang 单元测试规范, 命名规范, 测试用例组织, 测试代码结构 and 测试原则.
go-test.tpl
Go test conventions — parallelism, table-driven tests, assertions.