Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 more

    SereneCode: Spec, Type & Contract Verification

    1

    Check AI-written Python against your spec, mypy types, and icontract contracts, then fix findings level by level.

    Free

    2 usesSecurity scanned
    SereneCode: Spec, Type & Contract Verification

    SereneCode: Spec, Type & Contract Verification

    Example session with this skill installed

    Check my new UserProfile class against REQ-001 with serenecode and fix whatever it finds, up to level 3.

    • Read your context and instructions
    • Compiled the serenecode

    Verified UserProfile against SPEC.md up to Level 3. Final verdict:

    complete. Getting there took three passes, and the type check found a real bug.

    Pass 1: Level 1 (structural) failed

    FindingFix
    SPEC.md has no **Source:** lineAdded **Source:** none — this SPEC.md is authoritative.
    __init__ missing precondition, postcondition and docstringAdded @require("@" in email), an @ensure that the stored email is normalised, and a docstring
    update_email missing postconditionAdded @ensure: the result equals the stored email and is already normalised

    Pass 2: Level 2 (mypy --strict) failed

    [FAIL] user.py line 34
    Incompatible types in assignment (expression has type "str | None",
    variable has type "str") [assignment]
    

    This was more than an annotation problem. update_email stored the

    raw address and only normalised the value it returned, so after update_email(" New@Example.COM ") the
    profile held " New@Example.COM ". That violates REQ-001.

    def update_email(self, new_email: str) -> str:
        """Store a normalised email address and return it."""
        self.email = new_email.strip().lower()
        return self.email
    

    Pass 3: Level 3 (tests and coverage) passed

    Serenecode Check — PASSED (verdict: complete)
    11 checked, 8 passed, 0 failed, 0 skipped, 3 exempt (2 advisory)
    
    • REQ-001: implemented (Implements: on UserProfile) and tested (Verifies: on test_update_email_normalises)
    • __init__ and update_email: 100% line and branch coverage

    Still open: 2 dead-code advisories say UserProfile and update_email look unused, because nothing under src/ calls them yet. Do you want me to allowlist them with # allow-unused: <reason>, or leave them until callers exist?

    Note: Level 3 means the tests passed and the coverage threshold was met. It doesn't prove the code correct.

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

    About this skill

    SereneCode turns "did the agent ship code?" into "does it match the spec, the types, and the contracts we agreed on?"

    This skill teaches your agent to drive the open-source SereneCode verifier (MIT, on PyPI) while it writes Python:

    • Spec first. Requirements live in SPEC.md as REQ-xxx IDs. Functions are tagged Implements: and tests are tagged Verifies:, so every requirement can be traced to code and tests.
    • Enforceable contracts. Preconditions, postconditions, and class invariants with icontract. The agent writes real conditions, not tautologies.
    • Verification in the edit loop. The agent checks each change through the SereneCode MCP tools or the CLI, at six levels:
      • L1 structure
      • L2 mypy --strict
      • L3 tests and coverage
      • L4 Hypothesis property testing
      • L5 CrossHair symbolic execution
      • L6 architecture
    • Fixes by level. Each finding gives a file, line, and suggestion, and the agent fixes it and reruns the check until the verdict is complete.
    • Honest reporting. The agent reports the overall verdict, skipped checks, and exemptions. It never claims that a passing property test proves the code correct.

    Requirements: Python and the serenecode package (pip install 'serenecode[mcp]'). The skill asks before it installs anything, and asks before enabling code execution for levels 3–6. The checks come from the package; this skill is the workflow.

    Requires serenecode package installation. Docstring tags must be at function/class level. Levels 4-6 require --allow-code-execution flag and user consent.

    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

    Requires

    Python 3.10+
    serenecode
    Python

    Permissions

    Terminal / Shell
    Write Files
    Network Access
    Read Files

    File Scopes

    SPEC.md
    SERENECODE.md
    src/**
    tests/**

    Shell: runs the serenecode CLI (check, spec, doctor). Read files: SPEC.md, SERENECODE.md, source and tests. Write files: applies fixes the user asked for. Network: only to pip install serenecode from PyPI, and only after the user agrees. Levels 3–6 execute the project's tests and generated inputs; the skill asks before enabling this.

    Listed1 month ago

    What's inside

    Frequently Asked Questions

    SereneCode adds a formal verification layer to Python development, using multi-level checks and requirement traceability to ensure code doesn't just run, but is mathematically and logically sound according to your SPEC.md.

    The skill is designed for use with agents that support Model Context Protocol (MCP) and requires the `serenecode` Python package, along with tools like mypy, icontract, and Hypothesis, to be installed in your local environment.

    Yes, the skill manages everything from basic structural checks (L1) to advanced symbolic execution and property-based testing (L4-L6), though higher levels typically require user-granted execution permissions for safety.

    Requirements live in SPEC.md as REQ-xxx IDs. Code is tagged "Implements: REQ-001" and tests "Verifies: REQ-001" in their docstrings. SereneCode reports any requirement with no implementation or no test. Tags show references exist; they don't prove the test checks the requirement's meaning.

    Yes. The skill is free and the serenecode package is open source under the MIT license: https://github.com/helgster77/serenecode

    New in Code Quality & Review