Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 more

    Draft Diff Guard

    1

    Enforce dry-runs and 4-point sanity checks to prevent destructive code edits and stubbed implementations.

    $3

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned
    Draft Diff Guard

    Draft Diff Guard

    Example session with this skill installed

    Refactor the calculateTotal function in src/finance.ts to include tax, but keep all existing JSDoc comments and don't change the function signature.

    • Read your context and instructions
    • Compiled the draft diff guard

    I have staged the requested changes for src/finance.ts. The implementation includes tax logic while maintaining the existing API contract and documentation. All pre-flight sanity checks have passed.

    📋 Proposed Changes (Staged Dry-Run)

    Files to modify:

    • src/finance.ts (+5 lines, -2 lines)

    Summary of Changes:

    • Updated calculateTotal to include a 5% tax calculation.
    • Preserved existing JSDoc documentation and parameter names.
    • Ensured the return type remains a number to satisfy downstream callers.

    Four-Point Sanity Checklist:

    • Preservation: All comments, docstrings, and license headers preserved.
    • Scope Lock: Strictly restricted to requested files.
    • Contract Guard: Public exports and interfaces preserved.
    • No Placeholders: Complete implementation, zero TODO/pass stubs.
    • Pre-Flight Gate: Syntax check passed cleanly.

    Unified Diff Preview:

    --- a/src/finance.ts
    +++ b/src/finance.ts
    @@ -1,10 +1,13 @@
     /**
      * Calculates the total price for a set of items.
      * @param prices Array of item prices.
      * @returns The sum of all prices.
      */
     export function calculateTotal(prices: number[]): number {
    -  return prices.reduce((a, b) => a + b, 0);
    +  const subtotal = prices.reduce((a, b) => a + b, 0);
    +  const taxRate = 0.05;
    +  const total = subtotal * (1 + taxRate);
    +  return total;
     }
    

    Next steps

    1. Review the tax rate calculation logic.
    2. Confirm if a 5% fixed rate is acceptable or needs to be a parameter.
    3. Approve the changes to apply them to src/finance.ts.

    Approval Gate: Ready to apply changes to disk. Proceed? (yes / no / revise)

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

    About this skill

    Uncontrolled AI edits can lead to stripped comments, broken public APIs, and dangerous placeholder stubs in production code. draft-diff-guard enforces a strict dry-run protocol that prevents agents from writing directly to disk until changes are validated against rigorous quality gates.

    What it does

    • Staged Dry-Runs creates in-memory buffers and unified diffs to prevent premature or accidental file mutations.
    • Comment Preservation ensures docstrings, JSDoc, license headers, and inline explanations remain intact during refactoring.
    • Scope Locking restricts modifications to authorized files, blocking unrequested formatting or "drive-by" refactors.
    • Contract Guarding protects public APIs and function signatures from breaking changes or unintentional renaming.
    • Placeholder Detection rejects any code containing TODO, pass, or NotImplementedError stubs.

    How it works

    1. Stage Buffer: The agent generates a staged version of the proposed file change in memory without touching the disk.
    2. Execute Sanity Checks: The system runs the four-point checklist to verify preservation, scope, contracts, and completeness.
    3. Pre-Flight Verification: Automated syntax checks and the diff_guard.py script validate the diff for technical correctness.
    4. Interactive Approval: A structured summary and unified diff are presented for human review before final disk write.

    Frameworks & tools

    This skill includes standalone validation scripts in Python and Node.js. It integrates with AST parsers and language-specific syntax checkers like tsc --noEmit or node --check to ensure code integrity.

    Why this beats prompting it yourself

    Generic prompts often fail to catch subtle regressions like missing license headers or new TODO stubs during complex refactors. This skill provides a programmatic enforcement layer with a dedicated diff_guard script that acts as a hard gate, ensuring your agent follows high-stakes engineering standards every time.

    Use cases

    • Refactoring legacy modules where preserving original comments and docstrings is critical for maintenance.
    • Preventing agents from polluting PRs with unrelated formatting changes in adjacent files.
    • Ensuring API stability by flagging unintentional changes to exported function signatures.
    • Catching incomplete implementations or stubs before they reach your CI pipeline.

    Known limitations

    Requires a local environment capable of running Python or Node.js scripts for the validation gates. Performance may vary depending on the size of the unified diff being analyzed.

    Requires Python or Node.js environment to run the diff_guard validation scripts. Performance scales with diff size.

    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

    Money-back guarantee

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

    Trust & safety

    Security scan

    Security scan passed 10 days ago

    Requires

    Git

    Permissions

    Terminal / Shell
    Read Files
    Write Files
    Listed10 days ago

    What's inside

    Frequently Asked Questions

    This skill acts as a programmatic gatekeeper that intercepts AI-generated code. It performs a 4-point sanity check—verifying comment preservation, scope locking, contract guarding, and placeholder detection—to ensure the agent doesn't introduce 'stubs' or break existing API signatures.

    The skill includes standalone validation scripts for both Python and Node.js environments. It leverages AST parsers and syntax checkers like `tsc` to perform technical verification before any changes are committed to your disk.

    While the validation scripts are language-agnostic for many checks, the deep structural analysis (like AST parsing) is currently optimized for Python and TypeScript/JavaScript environments. It is best suited for agents that have the ability to execute local scripts or CLI tools.

    The skill operates on a 'Staged Dry-Run' workflow: the agent writes to an in-memory buffer first, the guard script validates that buffer, and only after passing all checks is a unified diff presented for final human approval and disk write.

    Draft Diff Guard requires a local environment capable of running Python 3.x or Node.js. Extremely large files or massive multi-file diffs may experience slight latency during the AST parsing and validation phase.

    No. Runs 100% offline using standard Python or Node.js without third-party dependencies.

    New in Code Quality & Review