Works with the AI Agents you already use

    Bulletproof Test Suite: 100% Line & Branch Coverage Engine

    by Tushar

    1

    - They mock out critical services into inert placeholders that never throw errors.

    $5.99

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned
    Bulletproof Test Suite: 100% Line & Branch Coverage Engine

    Bulletproof Test Suite: 100% Line & Branch Coverage Engine

    Example session with this skill installed

    I have a PaymentProcessor class in TypeScript that handles credit card charges, currency validation, fraud scoring, and retry logic on network timeouts. Write a complete test suite for Vitest that covers 100% of the lines and branches, especially the error paths and retry exhaustion.

    • Read your context and instructions
    • Compiled the bulletproof test suite

    Summary

    Analyzed the Abstract Syntax Tree (AST) for PaymentProcessor.ts and mapped 21 distinct branch decision points across input validation, currency allowance, card expiration, idempotency deduplication, fraud score thresholds, and network retry loops. Synthesized a Vitest test suite achieving

    100.0% line and branch coverage with zero dead code and zero mock hallucinations.

    MetricNaive Agent TestsBulletproof 100% Test Suite
    Line Coverage68% (Misses catch blocks & throws)100.0% (Every line exercised)
    Branch Coverage42% (Happy path only)100.0% (All 21 AST branches covered)
    Boundary PerturbationNone (tests single valid number)0, negative cents, expired year/month, unsupported currency
    Failure Mode TestingMocks always return 200 OKTransient socket drops, 503 retry exhaustion, fraud score > 85
    Assertion RigortoBeDefined()Exact transaction IDs, retry counters, and error messages

    1. Exhaustive Test Suite (payment_processor.test.ts)

    import { describe, it, expect, vi, beforeEach } from 'vitest';
    import { PaymentProcessor, ChargeRequest } from './payment_processor';
    
    describe('PaymentProcessor (100% Branch Coverage Suite)', () => {
      let mockGateway: { postCharge: any };
      let processor: PaymentProcessor;
    
      beforeEach(() => {
        mockGateway = { postCharge: vi.fn() };
        processor = new PaymentProcessor(mockGateway, 2026, 11);
      });
    
      const validReq: ChargeRequest = {
        idempotencyKey: 'key_valid_123',
        amountCents: 5000,
        currency: 'USD',
        cardExpiryYear: 2027,
        cardExpiryMonth: 12,
        fraudRiskScore: 20,
      };
    
      it('nominal path: successfully processes valid charge on first attempt', async () => {
        mockGateway.postCharge.mockResolvedValueOnce({ status: 'success', txnId: 'txn_999888' });
        const res = await processor.processCharge(validReq);
        expect(res.status).toBe('succeeded');
        expect(res.transactionId).toBe('txn_999888');
        expect(res.retriesAttempted).toBe(0);
      });
    
      it('boundary validation: throws on zero or negative amount', async () => {
        await expect(processor.processCharge({ ...validReq, amountCents: 0 }))
          .rejects.toThrow('Invalid amount: 0. Must be strictly positive.');
        await expect(processor.processCharge({ ...validReq, amountCents: -500 }))
          .rejects.toThrow('Invalid amount: -500. Must be strictly positive.');
      });
    
      it('boundary validation: throws on unsupported currency', async () => {
        await expect(processor.processCharge({ ...validReq, currency: 'JPY' }))
          .rejects.toThrow('Unsupported currency: JPY. Allowed: USD, EUR, GBP');
      });
    
      it('card expiration: throws when card expiry is in the past', async () => {
        await expect(processor.processCharge({ ...validReq, cardExpiryYear: 2025, cardExpiryMonth: 12 }))
          .rejects.toThrow('Payment card is expired.');
      });
    
      it('idempotency branch: returns cached duplicate response without duplicate network calls', async () => {
        mockGateway.postCharge.mockResolvedValueOnce({ status: 'success', txnId: 'txn_initial' });
        await processor.processCharge(validReq);
        const duplicate = await processor.processCharge(validReq);
        expect(duplicate.transactionId).toBe('idemp_key_valid_123');
        expect(mockGateway.postCharge).toHaveBeenCalledTimes(1);
      });
    
      it('fraud evaluation: throws when risk score exceeds 85', async () => {
        await expect(processor.processCharge({ ...validReq, idempotencyKey: 'key_fraud', fraudRiskScore: 92 }))
          .rejects.toThrow('Charge blocked by automated fraud heuristic: risk score 92');
      });
    
      it('retry & recovery: succeeds after transient network failure', async () => {
        mockGateway.postCharge
          .mockRejectedValueOnce(new Error('ETIMEDOUT'))
          .mockResolvedValueOnce({ status: 'success', txnId: 'txn_retry_ok' });
        const res = await processor.processCharge({ ...validReq, idempotencyKey: 'key_retry' });
        expect(res.status).toBe('succeeded');
        expect(res.retriesAttempted).toBe(1);
        expect(mockGateway.postCharge).toHaveBeenCalledTimes(2);
      });
    
      it('retry exhaustion: throws when maxRetries is exceeded', async () => {
        mockGateway.postCharge.mockRejectedValue(new Error('503 Service Unavailable'));
        await expect(processor.processCharge({ ...validReq, idempotencyKey: 'key_fail' }))
          .rejects.toThrow('Payment gateway failed after 3 attempts');
        expect(mockGateway.postCharge).toHaveBeenCalledTimes(3);
      });
    });
    

    2. AST Coverage Audit Verification

    $ python scripts/coverage_auditor.py examples/payment_processor.ts --test examples/payment_processor.test.ts
    ====================================================================
     BULLETPROOF 100% TEST COVERAGE & BRANCH AUDIT REPORT
    ====================================================================
    Target:         examples/payment_processor.ts
    Test File:      examples/payment_processor.test.ts
    Status:         PASSED (Zero Coverage Gaps)
    Branch Score:   21 / 21 (100.0%)
    Threshold:      100.0%
    --------------------------------------------------------------------
    File                                       | Branches   | Covered  | Score   
    --------------------------------------------------------------------
    payment_processor.ts                       | 21         | 21       | 100.0%
    --------------------------------------------------------------------
    [OK] 100% branch and condition coverage achieved! All execution paths tested.
    ====================================================================
    

    Next steps

    1. Run native coverage in your pipeline: npx vitest run --coverage --coverage.thresholds.lines=100.
    2. Integrate scripts/coverage_auditor.py into your GitHub Actions PR checks with --min-coverage 100.
    3. If new branches are added to payment_processor.ts, run coverage_auditor.py --scaffold to automatically output stubs for missing vectors.

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

    About this skill

    Stop Shipping Code With Fake Test Coverage

    Standard AI coding agents generate tests that look impressive but test almost nothing:

    • They execute only the optimistic happy path.
    • They mock out critical services into inert placeholders that never throw errors.
    • They miss every fallback branch, catch block, and nullish coalescing operator (??).
    • When network errors, negative numbers, or expired sessions hit production, the service crashes because those code paths were never once exercised in a test.

    Bulletproof Test Suite changes that. It turns your agent (Claude Code, Cursor, Copilot, Antigravity, or local LLMs) into an SDET that conducts deep AST control-flow audits and synthesizes tests targeting genuine 100% line, branch, and condition coverage.


    The 5-Vector Test Generation Swarm

    Rather than writing unstructured, ad-hoc test cases, the skill directs your agent through an exhaustive 5-vector inspection:

    1. Boundary & Input Perturbation: Exercises 0, -1, MAX_SAFE_INTEGER, empty strings, whitespace, Unicode, empty collections [], and clock backwards skew.
    2. Control Flow Branch Exhaustion: Systematically forces both truthy and falsy evaluations for every if, else if, ternary (? :), switch/case, and short-circuit operator (&&, ||, ??).
    3. Error & Exception Path Injection: Validates that invalid arguments, network timeouts, and rejected promises throw the exact expected exceptions and trigger cleanup in finally blocks.
    4. State & Concurrency Verification: Verifies idempotency deduplication, exponential retry backoff, and thread-lock timeout handling.
    5. Mutation Resistance: Eliminates weak assertions (expect(val).toBeDefined()) in favor of strict property matching and state invariants that fail immediately if code mutations occur.

    Included Tools & Examples

    • scripts/coverage_auditor.py: Offline CLI that parses Python and TypeScript/JavaScript ASTs, flags untested branches with exact line numbers, and synthesizes parameterized test scaffolding.
    • examples/payment_processor.ts & .test.ts: Complete billing engine featuring 3D Secure, fraud heuristics, and retry exhaustion with 100% verified branch coverage.
    • examples/rate_limiter.py & test_rate_limiter.py: Token bucket implementation with thread safety, clock drift guards, and Redis failover tested to 100% branch coverage.

    Requires local Python environment for AST auditing scripts. Restricted to TypeScript, JavaScript, and Python. Scope limited to unit and integration testing.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed 13 days ago

    Software
    vitestNode.jsPythonjest

    Permissions

    Terminal / Shell
    Read Files
    Write Files

    Permissions are strictly limited to reading source and test files and writing test suites. No network connections are initiated.

    Listed13 days ago

    What's inside

    Frequently Asked Questions

    The skill uses AST (Abstract Syntax Tree) auditing to map every possible logical path, including hidden ternary branches and short-circuits that standard coverage tools often overlook. It then generates specific test stubs and boundary data to ensure every single line and error handler is executed and verified.

    This skill is compatible with AI agents capable of executing local scripts and supports development in TypeScript, JavaScript, and Python. It integrates directly with industry-standard runners like Vitest, Jest, and Pytest.

    You receive the core AST auditing engine, automated test scaffolding scripts, and a library of mutation-resistant assertion patterns. These tools work together to identify untested code and force your agent to address the 'unhappy paths.'

    Yes, you must be able to run local Python-based scripts for the AST auditing component to function. This allows the skill to deeply analyze your source code structure before generating the test requirements.

    Absolutely. One of the primary use cases is auditing legacy modules to identify dead code and generate robust suites for complex state machines, making it ideal for hardening older, mission-critical logic.

    Yes. The bundled AST auditor and test synthesizer natively parses Python AST (`ast` module) and TypeScript/JavaScript control flows (ES6+, TS types, Vitest, Jest, Pytest).

    A line like `return isAuthorized ? allow() : deny();` is 100% line-covered if either branch executes. Branch coverage ensures both paths are verified, preventing production security bypasses and unhandled exceptions.

    No, it enhances them. It works alongside your existing test runner by guaranteeing that your test suites actually cover every AST decision path before you push to production.

    New in Testing & Debugging

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Testing & Debugging.