interface-contract-verifier
/interface-contract-verifier
Verify that interface and class contracts (preconditions, postconditions, invariants) are preserved across program versions. Use when validating refactorings, checking API compatibility, verifying design-by-contract implementations, or ensuring behavioral contracts remain intact after code changes. Automatically detects contract violations, identifies affected methods and classes, and provides actionable guidance for resolving violations while maintaining program correctness.
- Author
- ArabelaTso ↗
- Repository
- Skills-4-SE ↗
- Licence
- Apache-2.0
- Last repository change
- 21.08.2026
Assessment and security
- Files in this package
- 4
- Scripts
- 2
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 21.08.2026, without references to retired models or APIs.
Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.
- 2 scripts in this package. Review them before installing, as Claude may execute them.
Scripts: scripts/contract_extractor.py, scripts/contract_verifier.py
What it does and when to use it
Verify that interface and class contracts (preconditions, postconditions, invariants) are preserved across program versions. Use when validating refactorings, checking API compatibility, verifying design-by-contract implementations, or ensuring behavioral contracts remain intact after code changes. Automatically detects contract violations, identifies affected methods and classes, and provides actionable guidance for resolving violations while maintaining program correctness.
Original author description
Verify that interface and class contracts (preconditions, postconditions, invariants) are preserved across program versions. Use when validating refactorings, checking API compatibility, verifying design-by-contract implementations, or ensuring behavioral contracts remain intact after code changes. Automatically detects contract violations, identifies affected methods and classes, and provides actionable guidance for resolving violations while maintaining program correctness.
How it works
- Overview
- Core Workflow
- Contract Types
- Verification Rules
- Violation Types
- Resolution Guidance
- Resources
SKILL.md preview
---
name: interface-contract-verifier
description: Verify that interface and class contracts (preconditions, postconditions, invariants) are preserved across program versions. Use when validating refactorings, checking API compatibility, verifying design-by-contract implementations, or ensuring behavioral contracts remain intact after code changes. Automatically detects contract violations, identifies affected methods and classes, and provides actionable guidance for resolving violations while maintaining program correctness.
---
# Interface Contract Verifier
## Overview
Verify that formal or structured contracts (preconditions, postconditions, invariants) defined in interfaces and classes are preserved when updating to a new program version.
## Core Workflow
### 1. Extract Contracts
Extract contracts from both versions:
```bash
python scripts/contract_extractor.py --program old_version --output old_contracts.json
python scripts/contract_extractor.py --program new_version --output new_contracts.json
```
### 2. Verify Contracts
Compare and verify contract preservation:
```bash
python scripts/contract_verifier.py --old old_contracts.json --new new_contracts.json --output report.json
```
### 3. Review Violations
Examine violations: weakened preconditions, strengthened postconditions, broken invariants.
## Contract Types
### Preconditions
Requirements before method execution:
```python
def withdraw(amount):
"""Precondition: amount > 0 and amount <= balance"""
```
### Postconditions
Guarantees after method execution:
```python
def deposit(amount):
"""Postcondition: balance == old(balance) + amount"""
```
### Invariants
Properties always true for a class:
```python
class BankAccount:
"""Invariant: balance >= 0"""
```
## Verification Rules
**Liskov Substitution Principle**:
- Preconditions can be weakened (accept more)
- Postconditions can be strengthened (guarantee more)
- Invariants must be maintained
## Violation Types
### Strengthened Precondition (Error)
New version rejects previously valid inputs.
### Weakened Postcondition (Error)
New version guarantees less.
### Broken Invariant (Critical)
Class invariant no longer holds.
## Resolution Guidance
### Fix Strengthened Precondition
Relax precondition or update callers.
### Fix Weakened Postcondition
Strengthen implementation to meet original guarantee.
### Fix Broken Invariant
Add checks to maintain invariant in all methods.
## Resources
- **[references/design_by_contract.md](references/design_by_contract.md)**: Design by Contract principles
- **scripts/contract_extractor.py**: Extract contracts from code
- **scripts/contract_verifier.py**: Verify contract preservation
Files in this package (4)
- SKILL.md 3 KB
- references/design_by_contract.md 2 KB
- scripts/contract_extractor.py 5 KB
- scripts/contract_verifier.py 10 KB
Versions
The database has no other skills named interface-contract-verifier.
Database snapshot: 13.11.2026 · package version eaeb008784c2 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 90design-by-contract
Design with explicit contracts — preconditions, postconditions, invariants, guard clauses. Use when designing a function/class, hardening a boundary, or adding assertions. - 95static-reasoning-verifier
Verify code correctness statically against specifications using type checking, contract verification, and formal methods. Use when: (1) Verifying type safety and null safety in Python, Java, or C/C++ code, (2) Checking design-by-contract specifications (preconditions,… - 100system-interface-contracts
Use when defining or reviewing contracts between systems, modules, services, agents, jobs, events, APIs, or teams: ownership, inputs, outputs, invariants, compatibility, errors, idempotency, and versioning. Do NOT use for REST resource design alone (use `api-design`), async… - 100design-by-contract
Design-by-Contract (DbC) development. Use when implementing with formal preconditions, postconditions, and invariants across any language. - 100abstract-invariant-generator
Uses abstract interpretation to automatically infer loop invariants, function preconditions, and postconditions for formal verification. Generates invariants that capture program behavior and support correctness proofs in Dafny, Isabelle, Coq, and other verification systems. Use… - 100api-contract
Configure this skill should be used when the user asks about "API contract", "api-contract.md", "shared interface", "TypeScript interfaces", "request response schemas", "endpoint design", or needs guidance on designing contracts that coordinate backend and frontend agents. Use…