spec to adversarial tests

    1

    Turns a spec, function, or diff into a test suite engineered to fail against near-miss (mutated) implementations, not just obvious breakage. Use when code needs tests that prove behavior rather than exercise it.

    Free

    Security scanned

    Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 more

    spec to adversarial tests

    Example session with this skill installed

    Generate an adversarial test suite for a Python function process_payment(amount, balance) that deducts funds and returns a status, ensuring it handles all edge cases.

    • Read your context and instructions
    • Compiled the spec to adversarial

    I have analyzed the payment processing logic and generated an adversarial test suite focused on killing near-miss mutations.

    Adversarial Test Suite for process_payment

    Assumptions Block

    • Contract Guarantees: balance must never be negative post-transaction.
    • Caller Controls: amount is expected to be a positive numeric value.

    Underdetermined (Flagged): The spec is silent on behavior when amount is exactly zero. I have pinned this to "allow" and added a test to enforce it.

    import pytest
    from payment_module import process_payment
    
    def test_rejects_insufficient_funds():
        # Invariant: Cannot spend more than the available balance
        assert process_payment(amount=101, balance=100) == "INSUFFICIENT_FUNDS"
    
    def test_allows_exact_balance_spend():
        # Invariant: Spending total balance results in zero, not rejection
        assert process_payment(amount=100, balance=100) == "SUCCESS"
    
    def test_rejects_negative_payment_amount():
        # Invariant: Payment must be a positive movement of value
        assert process_payment(amount=-50, balance=100) == "INVALID_AMOUNT"
    
    def test_handles_zero_amount_as_noop():
        # Pinning underdetermined behavior: zero is a success no-op
        assert process_payment(amount=0, balance=100) == "SUCCESS"
    

    Kill Map

    Variant (Mutation)Killer TestPriorityStatus
    Flip amount > balance to >=test_allows_exact_balance_spendMUSTUNEXECUTED
    Remove negative checktest_rejects_negative_payment_amountMUSTUNEXECUTED
    Change amount == 0 to amount <= 0test_handles_zero_amount_as_noopMAYUNEXECUTED
    Swallow exception on type mismatchtest_rejects_negative_payment_amountMUSTUNEXECUTED

    Next steps

    1. Update payment_module.py if test_handles_zero_amount_as_noop fails to match your desired business logic.
    2. Integrate these tests into your CI/CD pipeline.
    3. Run a mutation coverage tool like mutmut to verify the Kill Map.

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

    About this skill

    Turns a spec, function, or diff into a test suite engineered to fail against near-miss (mutated) implementations, not just obvious breakage. Use when code needs tests that prove behavior rather than exercise it.

    What it does

    • Assumption mapping identifies what a spec guarantees and flags underdetermined edge cases.
    • Failure cataloging applies known patterns like off-by-one errors, partial batch failures, and type confusion to your specific domain.
    • Invariant derivation defines properties that must hold regardless of implementation, testing the contract rather than the code.
    • Mutation testing generates "near-miss" variants of your code to check whether the test suite can catch subtle logic flips or dropped branches.
    • Kill map generation provides a table showing exactly which test catches which specific failure mode.

    How it works

    1. Provide a spec or code snippet and ask for an adversarial suite.
    2. Review the assumptions and underdetermined points the agent identifies before it writes code.
    3. Receive a runnable test file with tests named after the invariants they protect.
    4. Analyze the Kill Map to see which mutations (e.g., flipping a comparison) each test is responsible for catching.

    Frameworks & tools

    Language agnostic. Works with standard unit testing frameworks like Pytest, Jest, Mocha, Vitest, or ExUnit.

    Use cases

    • Mission-critical logic where a single comparison flip (e.g., < vs <=) causes data corruption.
    • Refactoring legacy code to check that a new implementation adheres to the original contract.
    • Hardening public APIs against unexpected or malicious inputs.
    • Auditing developer PRs to find holes in existing test coverage.

    Known limitations

    Does not perform actual execution of tests unless the environment supports it; output includes an UNEXECUTED label for kill maps in restricted environments.

    Does not execute tests in environments without a runtime. Requires a clear spec or function to derive invariants.

    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 any payment.

    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

    Free forever

    No account required to browse

    Trust & safety

    Security scan

    Security scan passed 2 days ago

    • Free with an Agensi account

    Permissions

    No special permissions declared or detected

    Listed2 days ago

    What's inside

    Frequently Asked Questions

    The skill is language-agnostic and produces tests for standard frameworks such as Pytest, Jest, Vitest, and ExUnit, making it compatible with almost any modern software stack.

    You will receive a set of mapped assumptions, a fully runnable test file with invariant-based test cases, and a 'Kill Map' that explains exactly which bug patterns each test is designed to catch.

    No complex setup is required; simply provide your specification or code snippet to the agent, and it will guide you through an initial review of identified edge cases before generating the final test suite.

    Yes, it is ideal for legacy code; by deriving invariants from the existing implementation, the skill creates a safety net that ensures your new code adheres to the original contract without carrying over existing bugs.

    New in Testing & Debugging