Skip to content
Back to skills

Design By Contract Auditor

ASecurity

Use when evaluating preconditions, postconditions, and invariants, verifying trust boundary contracts, and preventing contract violations.

  • 7 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added November 9, 2026
ai-agentsrustbash

Security analysis

A100/100

Scanned November 21, 2026

npx -y skills add Harmitx7/tribunal-kit --skill design-by-contract-auditor --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Design By Contract Auditor?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Design By Contract Auditor
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/harmitx7-design-by-contract-auditor/badge)](https://www.skillsdirectory.com/skills/harmitx7-design-by-contract-auditor)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: design-by-contract-auditor
description: 'Use when evaluating preconditions, postconditions, and invariants, verifying trust boundary contracts, and preventing contract violations.'
version: 1.0.0
last-updated: 2026-10-30
skills:
  - clean-code
  - data-validation-schemas
tools: Read, Grep, Bash
scripts-binding:
  - src/verification/contract_engine.js
  - src/verification/index.js
inputs:
  function_signature: 'string'
  contract_definition: 'object'
outputs:
  contract_status: 'string'
  precondition_violations: 'array'
  invariant_violations: 'array'
trigger:
  - 'design by contract'
  - 'precondition audit'
  - 'postcondition verification'
  - 'invariant check'
  - 'contract violation detector'
  - 'design-by-contract-auditor'
---

# Design by Contract Auditor

## Mandatory Pre-Flight Context Inspection

Before auditing function contracts or injecting runtime contract assertions, inspect these 5 critical parameters:

1. **Precondition Obligation**: Check whether callers satisfy required argument bounds, non-null guarantees, and format constraints ($P_{\text{pre}}$).
2. **Postcondition Guarantee**: Verify that functions return values satisfying documented ranges, formats, and state changes ($Q_{\text{post}}$).
3. **Class & Module Invariants**: Ensure invariants hold unconditionally before method invocation and after method completion ($I_{\text{inv}}$).
4. **Trust Boundary Validation**: Enforce that validation occurs strictly at external input boundaries rather than deep in internal helper routines.
5. **Non-Disruptive Assertion Rule**: Do not introduce contract assertions that unexpectedly reject valid production workloads or break existing callers.

## Activation Boundaries

- **Activate when:** Designing core business logic interfaces, auditing boundary checks against null/undefined, reviewing financial/auth state mutations, or hardening domain models.
- **DO NOT activate when:** Auditing build pipeline configs (use `cicd-pro`).

## 🔁 Multi-Pass Execution Protocol

| Pass       | Phase                         | Core Action                                                                                  | Adaptive Depth         |
| :--------- | :---------------------------- | :------------------------------------------------------------------------------------------- | :--------------------- |
| **Pass 1** | **Interface Inspection**      | Inspect method signatures and docstrings to extract implicit and explicit assumptions.       | Fast / Standard / Deep |
| **Pass 2** | **Boundary Gap Scan**         | Run `auditContractCompleteness` to identify missing zero-division checks or null guards.     | All Modes              |
| **Pass 3** | **Executable Contract Wrap**  | Wrap functions using `withContract` with `requires`, `ensures`, and `checkInvariant`.        | Standard / Deep        |
| **Pass 4** | **Violation Diagnostic Test** | Test with invalid inputs; verify that `ContractViolationError` is thrown with exact context. | All Modes              |
| **Pass 5** | **Audit Synthesis**           | Emit contract status report and recommend contract assertions.                               | Standard / Deep        |

## Verification Command

```bash
npx jest test/unit/verification_contract.test.js
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.