Why green unit tests stopped giving me confidence
When a coding agent can generate a new component or reactive helper in 20 seconds, writing code is no longer the bottleneck. The bottleneck is proving that the code holds up under cases nobody thought to write an example test for.
When I built the micro-signal runtime and protocol adapters for @wcomp/elementum, all 200+ unit tests were green and line coverage sat above 95%. Every happy path passed. Every regression test I wrote passed.
Then I asked a harder question: what happens when two signals update inside a batch() across an arbitrary dependency graph, or when one subscriber throws halfway through a flush, or when an async fetcher reads its own state?
No example-based unit test answered those questions.
The 4-skill workflow that replaced ad-hoc prompting
Instead of asking a chat window to "write more tests" and hoping for the best, I installed my portable skill pack (npx skills add pinguxx/skills --global) and ran four skills in order:
-
spec: Before touching code, the agent writes down measurable success criteria, explicit non-goals, and state boundaries. No implementation starts while requirements are vague. -
plan: Turns the spec into a short file-level checklist with explicit invariants and the exact verification commands that must pass. -
implement-plan: Executes the approved plan step-by-step with tight feedback loops and zero scope creep. -
formal-verification: Targets the risky 5% of the codebase where a silent bug hurts most (reactive graphs, state machines, retry loops, untrusted input parsers) and generates an exhaustive, project-local verifier instead of more example tests.
You do not need formal methods for a button or a CSS layout. You run formal-verification on the modules where ordering, concurrency, or untrusted input can corrupt state silently.
What formal-verification generated and caught
Running formal-verification against @wcomp/elementum produced a zero-dependency Node script (tools/verify-formal-invariants.js, run with npm run verify:formal) that checks 6,162 states and graph topologies in under one second:
- Every 4-node reactive DAG topology (1,440 graphs) for glitch-free
computed()updates -
batch()fault isolation when one subscriber throws -
AsyncSignalout-of-order race monotonicity and self-subscription freedom - Untrusted A2UI graph depth, cycle, and URL scheme bounds
- Multi-instance
<el-toaster>active-deck exclusivity - AG-UI multi-run
runIdand JSON Patch path allowlist isolation
Remember that the unit test suite was already green at 95%+ line coverage. The very first run of npm run verify:formal failed immediately on two real bugs:
- A throwing subscriber inside
batch()aborted the flush loop early and silently dropped updates for sibling subscribers. - Reading an
AsyncSignalproperty inside its own fetcher created a self-subscription loop that re-triggered fetches endlessly.
Neither bug appeared in normal usage. Both took less than 20 minutes to fix once the verifier printed the exact failing state.
How to run this in your own repo
Install the skill pack once globally:
npx skills add pinguxx/skills --global Pick the one module in your repository that would hurt most if it failed silently, and invoke formal-verification on it. Wire the generated script into CI next to npm test.
As code generation gets cheaper, your highest-impact work shifts from typing implementations to defining invariants and running the skills that turn them into permanent CI gates.
- Portable skills (
spec,plan,implement-plan,formal-verification): https://github.com/pinguxx/skills - Verifier in action (
npm run verify:formal): https://github.com/pinguxx/Elementum
