Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 more

    Formal Correctness Engineer

    1

    Turns your agent into an adversarial correctness engineer: explicit specs, complexity bounds, refusal of invalid premises, and testable code.

    Free

    2 usesSecurity scanned
    Formal Correctness Engineer

    Formal Correctness Engineer

    Example session with this skill installed

    I'm designing a metrics ingestion path for our payments service and need a defensible review before we ship. Please act as an adversarial correctness engineer on this design: a single Python worker consumes an unbounded Kafka stream of transaction amounts (floats in dollars) and maintains a rolling average of the last 5,000 events in memory, then a gRPC endpoint exposes it. Our SLO is p99 read latency under 2 ms and under 50 MB RAM per worker. I'm worried about floating-point drift on the running sum and about what happens when the stream stalls or the worker restarts. Give me the full spec, verdict, resource bounds, a reference implementation with no placeholders, the checks I should run, and the exact conditions under which your answer stops holding.

    • Read your context and instructions
    • Compiled the formal correctness engineer

    Summary

    The design is conditionally valid: a circular buffer with Kahan-compensated summation meets the latency and memory SLO exactly, but restart durability and stall semantics must be specified explicitly rather than assumed.

    MetricBefore (naive sum)After (bounded Kahan)
    Read complexityO(cap) recomputeO(1)
    RAM per workerunbounded list, ~38 MB growth5,000 slots, < 1 MB
    Drift at 1e7 events~1e-9 relative, unbounded sign~1e-16 per update, bounded
    Restart behavioraverage lost, silently wrongrejected: requires offset checkpoint

    VERDICT: conditional. MODEL: ring buffer + compensated accumulator, sequence-numbered reads. ARTIFACT: BoundedMean class with push(), mean(), finite-value validation, and reset. CHECKS: capacity-1 identity, NaN/inf rejection, conservation of push count, monotonic window eviction. LIMITS: breaks if amounts arrive as non-finite floats, if cap exceeds 10^7 slots, or if readers require exactly-once across restarts without offset replay.

    Next steps

    • Persist consumer offset and replay the last cap events on restart
    • Switch amounts to integer cents to eliminate binary rounding at the source
    • Add a property test comparing incremental vs. recomputed means over 10^5 random pushes

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

    About this skill

    Stop shipping code that only works on the happy path. This skill transforms your agent into an adversarial correctness engineer that prioritizes machine-checkable evidence over vague reassurances. It forces explicit specifications, identifies mathematical impossibility early, and produces implementations with defined resource bounds.

    What it does

    • Formal Specification defines input domains, error semantics, and consistency models before writing code.
    • Complexity Analysis calculates time and space bounds for every algorithm to ensure it meets your performance budget.
    • Invariant Enforcement selects data structures that make invalid states unrepresentable and maintains clear state transitions.
    • Failure Visibility implements explicit error channels and observability rather than swallowing exceptions.
    • Verification Strategy generates testable properties like idempotence, monotonicity, and stability for critical logic.

    How it works

    1. Analyze constraints by mapping your request to specific problem classes and checking known lower bounds.
    2. Review premises to identify invalid assumptions, such as using regex for nested markup or exact streaming medians without storage.
    3. Build models using the Algorithmic Decision Ladder to select the most efficient representation for your data.
    4. Implement artifacts with runnable code that includes Kahan compensation for floats or ownership-aware concurrency.

    Frameworks & tools

    Language agnostic with specialized knowledge in Rust, Ada/SPARK, Julia, C++, Python (fractions/NumPy), and formal tools like Z3 or TLA+ concepts.

    Why this beats prompting it yourself

    Generic prompts often lead to "clever" code that fails at the edges. This skill enforces a rigid response pattern (SPEC, VERDICT, MODEL, BOUND) that prevents silent approximations and forces the agent to prove its work.

    Use cases

    • Auditing concurrent algorithms for race conditions or memory ordering issues.
    • Building high-precision financial systems using exact rational arithmetic.
    • Designing streaming data pipelines with fixed memory ceilings and backpressure.
    • Verifying parser logic for complex, nested data structures.

    Known limitations

    This skill focuses on algorithmic and systems correctness, not aesthetic UI design or creative writing. It requires standard IEEE arithmetic for floating-point compensation to be effective.

    Proof sketches are hand-derived obligations, not machine-checked outputs — it cites Z3/Lean/Coq but does not invoke them. Long responses are split into modules requiring follow-up prompts to complete.

    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

    2 uses

    Times used to date

    Free forever

    No account required to browse

    Trust & safety

    Security scan

    Security scan passed 1 month ago

    • Free with an Agensi account

    Permissions

    Read Files

    File Scopes

    **/*.py
    **/*.rs
    **/*.go
    **/*.ts

    The skill only reads the code and design documents under review; it produces specs, verified snippets, and test plans without network access or writes.

    Listed1 month ago

    What's inside

    Frequently Asked Questions

    While the skill is language-agnostic, it excels in environments requiring strict memory safety and precision, such as Rust, Ada/SPARK, C++, and high-precision Python (NumPy/fractions). It is optimized for use with advanced reasoning models that support complex logic and structured output.

    Unlike standard coding prompts that aim for immediate execution, this skill enforces a 'SPEC-VERDICT-MODEL-BOUND' framework. It prioritizes adversarial testing and mathematical proof of work, ensuring your agent rejects invalid premises rather than providing 'hallucinated' workarounds.

    This skill is ideal for building high-stakes systems such as financial transaction engines, concurrent data structures, and streaming pipelines where resource exhaustion or race conditions are unacceptable risks. It is not intended for creative tasks or front-end UI styling.

    Upon purchase, you receive the full skill configuration file containing the specialized logic, a comprehensive integration guide, and example templates for Formal Specification and Complexity Analysis. All future updates to the logic and framework compatibility are included at no extra cost.

    Implementation is straightforward: you import the skill into your preferred AI agent framework or playground. Once active, the agent will automatically begin analyzing every prompt through an adversarial lens to identify complexity bounds and potential state failures before writing a single line of code.

    New in Code Quality & Review