CtrlK
BlogDocsLog inGet started
Tessl Logo

evilissimo/design-by-contract

Analyze code to suggest and add Design by Contract specifications (preconditions, postconditions, invariants, semantic invariants) in any language. Trigger on: "Design by Contract", "DBC", "preconditions", "postconditions", "class invariants", "code contracts", "formal specifications", "document assumptions", "add contracts", "make this function safer", "define what this function guarantees", "add assertions to document behavior", Bertrand Meyer, Eiffel contracts, or when discussing invariants that should always hold. Do NOT skip for non-Eiffel code — DBC applies everywhere via assertions, type guards, properties.

92

1.05x
Quality

90%

Does it follow best practices?

Impact

95%

1.05x

Average score across 5 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

task.mdevals/scenario-2/

Contract a Payment Webhook Boundary

Problem/Feature Description

A Node service receives payment webhook payloads from an external provider. Several production failures came from missing fields, unrecognized statuses, and handlers continuing after malformed payloads. Add contract-oriented documentation and enforcement at the boundary so downstream code can rely on a normalized event.

Output Specification

Produce webhook_contract_analysis.md, webhook.ts, and webhook_contract_tests.md showing expected valid and invalid cases.

Input Files

=============== FILE: webhook.ts ===============

type RawWebhook = any

export function handlePaymentWebhook(payload: RawWebhook) {
  const eventId = payload.id
  const amount = Number(payload.data.amount)
  const status = payload.data.status

  if (status === "paid") {
    markInvoicePaid(payload.data.invoice_id, amount)
  }

  return { eventId, status }
}

evals

SKILL.md

tile.json