Skip to content

sb-dev/openquant / .agents/skills/spec-to-code-compliance

spec-to-code-compliance

Verified

Check implementation code against its specification, protocol, whitepaper, or design document. Trace each requirement to evidence, report contradictions and missing or partial enforcement, and find undocumented behavior.

FileKindSize
SKILL.mdskill md7.0 KB
upstream/.claude-plugin/plugin.jsonconfig370 B
upstream/README.mdmarkdown4.1 KB
upstream/agents/spec-compliance-checker.mdmarkdown5.7 KB
upstream/evals/.gitignoreother9 B
upstream/evals/documents-contradict/case.yamlconfig2.0 KB
upstream/evals/documents-contradict/fixture/README.mdmarkdown821 B
upstream/evals/documents-contradict/fixture/SPEC.mdmarkdown1.5 KB
upstream/evals/documents-contradict/fixture/Vault.solother2.8 KB
upstream/evals/documents-contradict/graders/reports-the-contradiction.mdmarkdown1.4 KB
upstream/evals/name-is-not-evidence/case.yamlconfig2.2 KB
upstream/evals/name-is-not-evidence/fixture/SPEC.mdmarkdown1.5 KB
upstream/evals/name-is-not-evidence/fixture/Vault.solother2.8 KB
upstream/evals/name-is-not-evidence/graders/senior-branch-unenforced.mdmarkdown1.5 KB
upstream/evals/name-is-not-evidence/graders/verdict-per-requirement.mdmarkdown1.0 KB
upstream/evals/routes-not-inline/case.yamlconfig2.9 KB
upstream/evals/routes-not-inline/fixture/SPEC.mdmarkdown1.5 KB
upstream/evals/routes-not-inline/fixture/Vault.solother2.8 KB
upstream/evals/routes-not-inline/graders/dispatches-the-workflow.mdmarkdown109 B
upstream/evals/routes-not-inline/graders/invokes-the-skill.mdmarkdown90 B
upstream/skills/spec-to-code-compliance/SKILL.upstream.mdmarkdown7.4 KB
upstream/skills/spec-to-code-compliance/agents/openai.yamlconfig252 B
upstream/skills/spec-to-code-compliance/assets/trail-of-bits-mark.svgother3.0 KB
upstream/skills/spec-to-code-compliance/resources/ANALYSIS_FORMAT.mdmarkdown2.8 KB
upstream/skills/spec-to-code-compliance/resources/DIVERGENCE_RUBRIC.mdmarkdown3.3 KB
upstream/skills/spec-to-code-compliance/resources/DOMAIN_NOTES.mdmarkdown5.7 KB
upstream/skills/spec-to-code-compliance/resources/WORKED_EXAMPLE.mdmarkdown4.1 KB
upstream/workflows/spec-compliance.jsscript28.4 KB

upstream/evals/documents-contradict/fixture/Vault.sol

View on GitHub
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.20;

interface IFeeSink {
    function record(address account, uint256 amount) external;
}

/// @notice Member vault with locked collateral and tiered redemption handling.
contract Vault {
    enum Tier {
        Standard,
        Senior
    }

    uint256 public constant FEE_BPS = 50;

    IFeeSink public immutable feeSink;
    address public immutable admin;

    mapping(address => uint256) public balances;
    mapping(address => uint256) public locked;
    mapping(address => Tier) public tier;

    uint256 public totalHeld;
    bool public paused;

    event Deposited(address indexed account, uint256 amount);
    event Redeemed(address indexed account, uint256 amount, uint256 fee);

    error Paused();
    error NotAdmin();
    error CollateralShortfall();
    error NothingToRedeem();

    constructor(IFeeSink sink) {
        feeSink = sink;
        admin = msg.sender;
    }

    modifier notPaused() {
        if (paused) revert Paused();
        _;
    }

    modifier onlyAdmin() {
        if (msg.sender != admin) revert NotAdmin();
        _;
    }

    function deposit(uint256 amount) external notPaused {
        balances[msg.sender] += amount;
        totalHeld += amount;
        emit Deposited(msg.sender, amount);
    }

    /// @notice Lock collateral against a member's balance.
    function lock(address account, uint256 amount) external onlyAdmin {
        locked[account] += amount;
    }

    /// @notice Redeem part of a member's balance, net of the redemption fee.
    function redeem(uint256 amount) external notPaused returns (uint256) {
        if (amount == 0) revert NothingToRedeem();
        if (!_collateralPreserved(msg.sender, amount)) revert CollateralShortfall();

        uint256 fee = (amount * FEE_BPS) / 10_000;
        uint256 payout = amount - fee;

        balances[msg.sender] -= amount;
        totalHeld -= amount;

        feeSink.record(msg.sender, fee);
        emit Redeemed(msg.sender, amount, fee);

        return payout;
    }

    /// @notice Whether the account keeps enough balance to cover its locked collateral.
    function _collateralPreserved(address account, uint256 amount) internal view returns (bool) {
        if (tier[account] == Tier.Senior) {
            return true;
        }
        return balances[account] - amount >= locked[account];
    }

    function setTier(address account, Tier newTier) external onlyAdmin {
        tier[account] = newTier;
    }

    function setPaused(bool value) external onlyAdmin {
        paused = value;
    }

    /// @notice Move a member's balance to another account.
    function reassign(address from, address to) external onlyAdmin {
        uint256 amount = balances[from];
        balances[from] = 0;
        balances[to] += amount;
        locked[to] += locked[from];
        locked[from] = 0;
    }
}
brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).Stars: 321kUpdated Claude CodeCodexVerifiedInstall
brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.Stars: 197kUpdated Claude CodeCodexVerifiedInstall
frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.Stars: 197kUpdated Claude CodeCodexVerifiedInstall
mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).Stars: 197kUpdated Claude CodeCodexVerifiedInstall