Code Review + Test Generation: Ship Reliable Code

    by Dirty

    1

    Automated code auditor that identifies logic flaws, security holes, and generates verified fail-first regression tests.

    $9

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned

    Works with the AI Agents you already use

    Code Review + Test Generation: Ship Reliable Code

    Example session with this skill installed

    Review the apply_discount function in pricing.py and ensure it handles edge cases like negative prices and rounding. Then write the necessary tests.

    • Read your context and instructions
    • Compiled the code review

    I have completed the review of pricing.py. I found 3 high-severity issues related to input validation and floating-point math. I have generated a test suite and verified that the new tests fail on your current code and pass after my suggested fixes.

    Review: pricing.py

    Scope: pricing.py reviewed. No files skipped.
    Baseline: No existing test suite found.

    Summary

    • Critical: 0 | High: 3 | Medium: 0 | Low: 1
    • Verdict: Fix first

    Findings

    [High] pricing.py:3 — apply_discount accepts negative values for the price parameter.
    Why it matters: This allows the creation of orders with negative totals, potentially leading to unauthorized credits.
    Fix: Add a check at the start of the function: if price < 0: raise ValueError("price must not be negative").

    [High] pricing.py:4 — Multiplication by 0.9 results in floating-point precision errors (e.g., 19.99 becomes 17.991).
    Why it matters: Financial totals will mismatch between database records and payment gateway charges.
    Fix: Wrap the return value in a rounding function: return round(price * (1 - rate), 2).

    [High] pricing.py:3 — Discount code comparison is case-sensitive.
    Why it matters: Users entering "save10" instead of "SAVE10" will be silently denied a valid discount.
    Fix: Normalize the input: code = str(code or "").strip().upper().

    [Low] pricing.py:7 — No feedback for invalid codes.
    Why it matters: Users cannot distinguish between a typo and an expired code.
    Fix: Update docstring to clarify that unknown codes return the original price.

    Test Suite Evidence

    import pytest
    from pricing import apply_discount
    
    def test_negative_price_raises_value_error():
        # Before fix: FAILED (returned -90.0)
        # After fix: PASSED (raised ValueError)
        with pytest.raises(ValueError):
            apply_discount(-100.0, "SAVE10")
    
    def test_rounds_to_cents():
        # Before fix: FAILED (returned 17.991)
        # After fix: PASSED (returned 17.99)
        assert apply_discount(19.99, "SAVE10") == 17.99
    
    def test_code_is_case_insensitive():
        # Before fix: FAILED (returned 100.0)
        # After fix: PASSED (returned 90.0)
        assert apply_discount(100.0, "save10") == 90.0
    

    Next steps

    1. Apply the input validation guards to pricing.py.
    2. Merge the provided test_pricing.py into your test directory.
    3. Run the full suite to verify the fixes in your environment.

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

    About this skill

    A complete, practical playbook for reviewing a codebase and leaving it better tested than you found it. It covers how to scope a review and read in the right order, what to check across correctness, security, performance, error handling, edge cases and maintainability, and how to report every finding by severity with a file and line reference and a concrete fix — no vague complaints. Then it shows how to generate unit and integration tests, including tests that fail first to prove they catch the bug. Includes a worked example (a buggy discount function, its findings, and the tests that cover it) and an end-of-review checklist.

    Does not perform architectural redesigns. Large repos may require sampled reviews. Requires a working local test runner for fail-first verification.

    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 11 days ago

    Permissions

    Read Files
    Write Files
    Listed11 days ago

    What's inside

    Frequently Asked Questions

    This skill works with any language or framework as long as your environment has a standard test runner (like Jest, Pytest, or Go Test). It integrates directly with your CLI to execute tests and verify fixes in real-time.

    Unlike generic prompts, this skill requires the agent to prove a bug exists by writing a failing regression test before suggesting a fix. This eliminates 'hallucinations' and ensures every recommendation is grounded in executable code.

    You will receive the 'code review test gen' skill manifest, including the specialized auditing logic and the 'fail-first' verification workflow. It also includes the Seven-Point Audit checklist used to scan for security and logic flaws.

    The skill is optimized for individual modules or specific PRs; for very large repositories, we recommend running the audit on a per-module basis (under 1,000 lines at a time) to ensure the agent maintains deep logical context.

    Simply add the skill to your AI agent's library and provide it with access to your local file system and CLI. The agent will then initialize by baseline-testing your current suite before starting the audit.

    New in Code Quality & Review

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Code Quality & Review.