design-by-contract

Generate Design-by-Contract annotations for functions across multiple programming languages.

34|Updated Nov 17, 2025
One-click install
npx skills add https://github.com/OutlineDriven/odin-claude-plugin --skill design-by-contract
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: design-by-contract
Source: https://github.com/OutlineDriven/odin-claude-plugin/tree/main/skills/design-by-contract
Command: npx skills add https://github.com/OutlineDriven/odin-claude-plugin --skill design-by-contract

SYSTEM DOCUMENTATION & REQUIREMENTS

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., contracts crate, 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.