Skip to main content
ClaudeWave
Skill85 estrellas del repoactualizado 3mo ago

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.

Instalar en Claude Code
Copiar
git clone --depth 1 https://github.com/ArabelaTso/Skills-4-SE /tmp/interface-contract-verifier && cp -r /tmp/interface-contract-verifier/skills/interface-contract-verifier ~/.claude/skills/interface-contract-verifier
Después abre una sesión nueva de Claude Code; el skill carga automáticamente.

SKILL.md

# 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
abstract-domain-explorerSkill

Applies abstract interpretation using different abstract domains (intervals, octagons, polyhedra, sign, congruence) to statically analyze program variables and infer invariants, value ranges, and relationships. Use when analyzing program properties, inferring loop invariants, detecting potential errors, or understanding variable relationships through static analysis.

abstract-invariant-generatorSkill

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 when adding formal specifications to code, generating verification conditions, inferring contracts for functions, or discovering loop invariants for proofs.

abstract-state-analyzerSkill

Performs abstract interpretation over source code to infer possible program states, variable ranges, and data properties without executing the program. Reports potential runtime errors including out-of-bounds accesses, null dereferences, type inconsistencies, division by zero, and integer overflows. Use when analyzing code for potential runtime errors, performing static analysis, checking safety properties, or verifying program behavior without execution.

abstract-trace-summarizerSkill

Performs abstract interpretation to produce summarized execution traces and high-level program behavior representations. Highlights key control flow paths, variable relationships, loop invariants, function summaries, and potential runtime states using abstract domains (intervals, signs, nullness, etc.). Use when analyzing program behavior, understanding execution paths, computing loop invariants, tracking variable ranges, detecting potential runtime errors, or generating program summaries without concrete execution.

acsl-annotation-assistantSkill

Create ACSL (ANSI/ISO C Specification Language) formal annotations for C/C++ programs. Use this skill when working with formal verification, adding function contracts (requires/ensures), loop invariants, assertions, memory safety annotations, or any ACSL specifications. Supports Frama-C verification and generates comprehensive formal specifications for C/C++ code.

agent-browserSkill

CLI-based browser automation with persistent page state using ref-based element interaction. Use when users ask to navigate websites, interact with web pages, fill forms, take screenshots, test web applications, or extract information from web pages.

ambiguity-detectorSkill

Detects and analyzes ambiguous language in software requirements and user stories. Use when reviewing requirements documents, user stories, specifications, or any software requirement text to identify vague quantifiers, unclear scope, undefined terms, missing edge cases, subjective language, and incomplete specifications. Provides detailed analysis with clarifying questions and suggested improvements.

api-design-assistantSkill

Design and review APIs with suggestions for endpoints, parameters, return types, and best practices. Use when designing new APIs from requirements, reviewing existing API designs, generating API documentation, or getting implementation guidance. Supports REST APIs with focus on endpoint structure, request/response schemas, authentication, pagination, filtering, versioning, and OpenAPI specifications. Triggers when users ask to design, review, document, or improve APIs.