Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+22 more

    Test Architect: Tests That Catch Real Bugs

    1

    Writes tests tied to named risks (boundaries, dependency failures, concurrency) and runs them.

    Free

    Security scanned
    Test Architect: Tests That Catch Real Bugs

    Test Architect: Tests That Catch Real Bugs

    Example session with this skill installed

    Use the test-architect skill to write tests for rate_limiter.py. It guards our public API gateway.

    (rate_limiter.py source: https://github.com/hemapriyan-rk/claude-rigor-skills/blob/main/examples/test-architect/rate_limiter.py)

    • Read your context and instructions
    • Compiled the test architect

    I wrote 15 pytest tests in test_rate_limiter.py. Four fail, and I believe all four are real bugs in rate_limiter.py. There were no existing tests, so I used pytest with a fake clock to keep them deterministic. The last run was 4 failed, 11 passed.

    Risks covered

    RiskTestResult
    New key gets a full burst, then is deniedtest_new_key_gets_full_burst_then_is_deniedpass
    One client's usage leaks into another'stest_keys_are_isolatedpass
    Refill is wrongtest_refill_restores_exactly_elapsed_tokenspass
    Refill overshoots capacitytest_refill_never_exceeds_capacitypass
    Off-by-epsilon at the refill boundarytest_fractional_refill_boundarypass
    A denied request still spends tokenstest_cost_exceeding_remaining_is_denied_and_does_not_spendpass
    Cost equal to capacitytest_cost_equal_to_capacity_allowed_oncepass
    Negative cost mints extra tokenstest_negative_cost_cannot_mint_tokens_beyond_capacitypass
    Clock steps backwards and locks the key outtest_clock_going_backwards_does_not_lock_out_keyFAIL: real bug
    Clock steps backwards and drains tokenstest_clock_going_backwards_does_not_drain_tokenspass
    retry_after on a new keytest_retry_after_new_key_is_zeropass
    retry_after accuracytest_retry_after_is_accurate_and_allow_succeeds_after_waitingpass
    retry_after consumes tokenstest_retry_after_does_not_consume_tokenspass
    retry_after for a cost that can never succeedtest_retry_after_for_unaffordable_cost_is_not_a_misleading_finite_waitFAIL: real bug
    Zero refill ratetest_zero_refill_rate_retry_after_does_not_crash_gatewayFAIL: real bug
    Concurrent callers overspend the buckettest_concurrent_callers_cannot_overspend_bucketFAIL: real bug

    Bugs found

    Concurrency (most serious): allow() checks the balance and then spends it without a lock. With 50 threads released together on a capacity-10 bucket, all 50 were allowed. In production, a burst from one client can get through the limiter. The test widens the race window with a sleeping clock, so it is deterministic. The fix is a threading.Lock around the refill, check and spend (or one lock per key).
    2.

    Clock going backwards: _refill doesn't guard against a negative elapsed time, so tokens go negative and the key is locked out for as long as the step. For example, a 3600 s step back with only 5 s of real time passing leaves that key denied. Use max(0, now - last).
    3.

    retry_after with cost above capacity: allow(key, cost=6) on a capacity-5 bucket can never succeed, but retry_after returns 1.0. A well-behaved client would retry forever. It should raise an error or return infinity.
    4.

    retry_after with refill_per_second=0: it raises ZeroDivisionError, which would be a 500 from the gateway. Validate the rate in __init__ or return infinity.

    The negative-cost test passes, but only because the next refill clamps the balance to capacity. allow(key, cost=-100) still returns True and spends nothing, so I'd reject negative costs explicitly.

    Not covered

    Memory growth: buckets never evicts keys, so a flood of unique keys (spoofed IPs) grows it without bound. That needs a design decision on eviction before I can test it.

    • NaN or infinite constructor arguments: they are unlikely from config, and the other fixes would cover them.
    • Gateway integration: how the gateway builds the key (for example X-Forwarded-For trust) is outside this file.

    Run the tests with python -m pytest -q test_rate_limiter.py from the tests2 directory. I didn't change rate_limiter.py. I can patch the four bugs if you want.

    The full test file it wrote (15 tests): https://github.com/hemapriyan-rk/claude-rigor-skills/blob/main/examples/test-architect/test_rate_limiter.py. Independently re-run: 4 failed, 11 passed; each failure is a real bug in rate_limiter.py.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    What it does

    Writes the tests that would actually catch a bug: boundary values, malformed-but-plausible input, each dependency failing, concurrent access, and ML fallback paths. Every test is named after the risk it covers, and the skill runs them and tells you which failures are real bugs.

    Why it exists

    Ten tests that run the same happy path with different values raise coverage and catch nothing. Concurrency and failure-injection tests are the ones most often skipped, and the ones most likely to find real problems.

    How it works

    1. Scopes to the code you asked about and follows your project's existing test framework and conventions.
    2. Lists the risks first, using a bundled catalog of failure cases by dependency type (HTTP, database, filesystem, queue, cache, clock, config, ML) and input boundaries.
    3. Writes deterministic tests: fake clocks, stubbed dependencies, seeded randomness. Uses property-based testing where a whole input range matters.
    4. Asserts on the contract, not the implementation, so tests don't pass just because they mirror the code.
    5. Runs the tests and separates real bugs from test mistakes, without quietly changing a test to make it pass.

    What you get

    A risk-to-test table with results, the test code, any bugs found with the input that triggers them, and the risks deliberately left out.

    When not to use it

    Generating maximum coverage numbers or snapshot tests for UI. It deliberately writes fewer, sharper tests.

    Open source

    Part of claude-rigor-skills: 30 MIT-licensed skills that make AI show its work. The demo below, with its inputs, is in the examples folder.

    How to use

    Skills on Agensi run inside your AI agent. Copy the prompt, paste it into your agent, and it connects to Agensi and installs this skill for you. If a payment is needed, your agent shows it to you first.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill passes our trust checks below.

    Security scanned

    Passed our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Free forever

    No account required to browse

    Trust & safety

    Security scanned

    Verified clean 6 days ago

    • Free to download with an account

    Listed6 days ago
    Updated4 days ago

    What's inside

    Frequently Asked Questions