behavior-contract

Bug condition/postcondition formalization as testable Behavior Contracts. Defines invariants that must be preserved across fixes.

509 stars

Best use case

behavior-contract is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Bug condition/postcondition formalization as testable Behavior Contracts. Defines invariants that must be preserved across fixes.

Teams using behavior-contract should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/behavior-contract/SKILL.md --create-dirs "https://raw.githubusercontent.com/a5c-ai/babysitter/main/library/methodologies/pilot-shell/skills/behavior-contract/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/behavior-contract/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How behavior-contract Compares

Feature / Agentbehavior-contractStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Bug condition/postcondition formalization as testable Behavior Contracts. Defines invariants that must be preserved across fixes.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# behavior-contract

You are **behavior-contract** -- the bug formalization skill for Pilot Shell bugfix mode.

## Overview

This skill formalizes bugs as Behavior Contracts -- precise, testable descriptions of what is wrong (Bug Condition), what should happen (Postcondition), and what must not change (Invariants).

## Contract Structure

### Bug Condition
The exact input, state, or sequence that triggers the bug. Must be specific enough to write a failing test.

**Example**: "When `processPayment()` receives an amount of exactly $0.00, it throws an unhandled TypeError instead of returning a zero-amount receipt."

### Postcondition
The correct behavior that must hold after the fix is applied.

**Example**: "When `processPayment()` receives $0.00, it returns a valid Receipt object with `amount: 0` and `status: 'completed'`."

### Invariants
Existing correct behaviors that must be preserved by the fix.

**Example**:
- "Positive amounts still process correctly"
- "Negative amounts still throw `InvalidAmountError`"
- "Receipt format remains unchanged for all amount types"

## Contract Document Template

```markdown
# Behavior Contract: [Bug Title]

## Bug Condition
[Precise description of triggering conditions]

## Postcondition
[Expected correct behavior after fix]

## Invariants
- [ ] Invariant 1: [existing behavior to preserve]
- [ ] Invariant 2: [existing behavior to preserve]

## Testable Assertions
1. `expect(processPayment(0)).toEqual({ amount: 0, status: 'completed' })`
2. `expect(processPayment(100)).toEqual({ amount: 100, status: 'completed' })`
3. `expect(() => processPayment(-1)).toThrow(InvalidAmountError)`
```

## Usage in Bugfix Workflow

1. Bug analysis identifies root cause at file:line
2. This skill formalizes the contract from the analysis
3. tdd-enforcer writes failing test from Bug Condition
4. tdd-enforcer writes preservation tests from Invariants
5. Minimal fix applied, contract audited

Related Skills

Smart Contract Analysis Skill

509
from a5c-ai/babysitter

Ethereum and blockchain smart contract security analysis

contract-test-framework

509
from a5c-ai/babysitter

Consumer-driven contract testing for SDK-API compatibility. Generate Pact consumer tests, verify provider contracts, configure Pact broker, and implement can-i-deploy checks.

pact-contract-testing

509
from a5c-ai/babysitter

Consumer-driven contract testing with Pact framework. Generate consumer contracts, configure Pact Broker publishing, execute provider verification, detect breaking changes, and integrate with CI/CD pipelines.

steering-behaviors

509
from a5c-ai/babysitter

Steering behaviors skill for flocking, avoidance, and group movement.

behavior-trees

509
from a5c-ai/babysitter

Behavior tree design and implementation skill for game AI. Enables creation of behavior tree structures, custom nodes, decorators, composites, and integration with game engines for NPC and enemy AI systems.

payer-contract-analysis

509
from a5c-ai/babysitter

Analyze payer contracts for reimbursement rates, terms, and value-based incentives to optimize revenue and support contract negotiations

contract-extractor

509
from a5c-ai/babysitter

Extracts key terms from contracts, identifies risks, flags unusual provisions

contract-analyzer

509
from a5c-ai/babysitter

Contract analysis and negotiation support skill with clause extraction and risk identification

docusign-contracts

509
from a5c-ai/babysitter

DocuSign contract and e-signature integration for deal closure

contract-test-generator

509
from a5c-ai/babysitter

Generate contract tests for API migrations with consumer-driven contracts and provider verification

process-builder

509
from a5c-ai/babysitter

Scaffold new babysitter process definitions following SDK patterns, proper structure, and best practices. Guides the 3-phase workflow from research to implementation.

Workflow & Productivity

babysitter

509
from a5c-ai/babysitter

Orchestrate via @babysitter. Use this skill when asked to babysit a run, orchestrate a process or whenever it is called explicitly. (babysit, babysitter, orchestrate, orchestrate a run, workflow, etc.)