contract-derived-verification

Derives agent verification signals from code contracts instead of model self-assessment.

Updated Aug 2, 2026
One-click install
npx skills add https://github.com/dperussina/function2agent --skill contract-derived-verification-dperussina
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: contract-derived-verification
Source: https://github.com/dperussina/function2agent/tree/main/.cursor/skills/contract-derived-verification
Command: npx skills add https://github.com/dperussina/function2agent --skill contract-derived-verification-dperussina

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Agents that grade their own output fail in measurable ways: intrinsic self-correction degrades reasoning accuracy, and LLM judges score AUROC 0.18-0.30 on false-success detection, worse than chance. This Skill replaces model self-assessment with verification signals derived mechanically from code contracts — type signatures, postconditions, exception classes, and existing tests — and forces every derived verifier to be validated against an independent artifact or marked provisional. ## Core Features & Use Cases - Signature-to-verifier mapping: Converts parameter types, return annotations, postconditions, raised exceptions, and docstrings into input guards, output validators, state verification checks, and typed failure taxonomies. - Validate-or-mark-provisional rule: Requires every derived verifier to name its derivation, be checked against an independent artifact (OpenAPI doc, schema file, SDK, recorded request), and carry provenance and confidence metadata; consumers fail closed on provisional verifiers. - Typed terminals and termination design: Defines Done/Failed/BudgetExhausted/NeedsHuman/Aborted terminal states, separates evaluate from decide, and specifies budget, no-progress, and oscillation detectors. - Use Case: When adding a critic or reflection loop to an agent, use this Skill to replace "review your answer" prompts with postcondition recomputation against the application's own API, and to record validated_against and confidence fields on every emitted node contract. ## Quick Start Ask the agent to design the verification and termination logic for a node using contract-derived checks instead of an LLM judge, and to mark any unvalidated derived field as provisional.

Frequently Asked Questions about contract-derived-verification

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I verify an agent's output without an LLM judge?▼

Derive checks from the code contract: parameter types become input guards, return types become output validators, and postconditions become state verification that recomputes values against an independent source. Postcondition recomputation detected all 9 numeric value errors in the referenced corpus where schema-shape checks detected none.

Why is LLM self-critique a bad default for agent improvement?▼

Research cited in the Skill shows intrinsic self-correction without external signal reduces accuracy across models and benchmarks, and apparent gains came from oracle labels. A critic is only worth its tokens when it has information the generator lacked, such as compiler output, test results, or state verification.

Can LLM judges detect false success in agent traces?▼

No. On distinguishing false success from honest failure, judges across GPT-4o, Sonnet 4.5, and Llama-3.3-70B scored AUROC 0.18-0.30, worse than chance, because they anchor on confident language and surface completion signals. Never let a judge decide whether a task succeeded.

What should I do when no independent artifact exists to validate a derived verifier?▼

Mark the verifier provisional by setting validated_against to none, which forces confidence to provisional. A consumer that requires a validated verifier must fail closed rather than proceed, and a model must never be substituted to fill the missing independent check.

What are the limitations of schema-derived verification?▼

Schema-derived checks validate shape, not values, so they are structurally blind to wrong-but-well-typed results. In the cited measurement the schema arm detected 0 of 9 numeric value errors and returned unverifiable on 92% of traces; only recomputation against an independent source catches that failure class.