design-by-contract
OfficialFormalize code behavior with preconditions, postconditions, and invariants.
System Documentation
What problem does it solve?
This skill formalizes the expected behavior of software components using Design-by-Contract (DbC) principles. It defines clear obligations for callers (preconditions) and guarantees from functions (postconditions), along with object consistency rules (invariants), preventing integration bugs and improving code reliability across 8+ languages.
Core Features & Use Cases
- Multi-Language Contract Generation: Create contract annotations for Rust, Python, TypeScript, Java, C++, C#, and C using native or popular libraries (e.g.,
contractscrate, Zod,icontract). - Automated Verification & Remediation: Guides through running contract validation with appropriate runtime flags and fixing violations (precondition, postcondition, invariant) with targeted debugging strategies.
- Formal API Documentation: Contracts serve as executable specifications, clearly documenting the precise behavior and constraints of public APIs.
- Use Case: Develop a critical payment processing module. This skill ensures that all inputs are valid (preconditions), the processing logic delivers correct results (postconditions), and the system's state remains consistent (invariants).
Quick Start
Use the design-by-contract skill to add preconditions and postconditions to a Python function that calculates a discount, ensuring the input is valid and the output is within expected bounds. The agent will guide you through adding the contract annotations and verifying them.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: design-by-contract Download link: https://github.com/OutlineDriven/odin-claude-plugin/archive/main.zip#design-by-contract Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.