Skip to content

Schema reference

Complete field-by-field reference for devcontract.json. The schema has eight clause families. All clauses except stack, cost, security, and definition_of_done are optional — include only what applies to your engagement.

Top-level fields

FieldTypeRequiredDescription
contract_versionstringYesSchema version. Currently "1.0".
projectstringYesProject name. Appears in the rendered steering block and evidence bundle.
partiesobjectYesThe parties to the contract. See below.
stackobjectYesLanguage, runtime, region, forbidden services.
costobjectYesBudget envelope and forbidden resources.
securityobjectYesAuth mechanism, secrets store, and deployment gates.
qualityobjectNoType hints, coverage, logging, forbidden code patterns.
architectureobjectNoRequired and forbidden architectural patterns.
complianceobjectNoRegulatory frameworks and data handling requirements.
auditobjectNoEvidence requirements and retention.
definition_of_doneobjectYesAcceptance criteria including scan gates.

parties

FieldTypeDefaultDescription
clientstringThe client identity — your name, team name, or organisation.
contractorstring"claude-code"The AI contractor identity. Appears in the evidence bundle.

stack

FieldTypeRequiredDescription
languagestringYesPrimary language. e.g. "python", "typescript".
language_versionstringYesRequired language version. e.g. "3.12".
runtimestringYesExecution runtime. e.g. "aws_lambda", "node", "container".
regionstringYesPrimary cloud region. e.g. "eu-north-1".
forbidden_servicesstring[]NoCloud services the AI must never suggest or use. e.g. ["ec2", "fargate", "rds"].

architecture

FieldTypeDescription
required_patternsstring[]Architectural patterns the AI must use. e.g. ["single_table_dynamodb", "handler_delegates_to_domain"].
forbidden_patternsstring[]Patterns the AI must never introduce. e.g. ["fat_handler", "orm_layer", "god_class"].
module_boundariesobjectMap of filename to responsibility. e.g. {"handler.py": "routing_only", "db.py": "data_access_only"}.
review_gatestring | nullIf set, major architectural decisions require this approval. e.g. "architecture_board_required".

cost

FieldTypeRequiredDescription
budget_envelopestringYesNamed budget tier. e.g. "aws_free_tier", "business", "enterprise".
forbidden_resourcesstring[]NoAWS/cloud resource types that must never be created. e.g. ["nat_gateway", "rds", "secrets_manager", "kms_cmk"].
approved_exceptionsstring[]NoExplicit exceptions to the budget envelope with documented rationale. e.g. ["route53_hosted_zone"].

security

FieldTypeRequiredDescription
auth_mechanismstringYesRequired authentication approach. e.g. "cognito_jwt", "oidc_saml", "mfa_required".
secrets_storestringYesWhere secrets must live. e.g. "ssm_parameter_store", "aws_secrets_manager".
forbidden_secrets_locationsstring[]NoWhere secrets must never appear. e.g. ["env_vars", "source_code", "config_files"].
pii_handlingstring | nullNoPII policy. e.g. "redact_before_llm".
owasp_compliancebooleanNoWhether OWASP Top 10 compliance is required. Defaults to true.
production_deploy_gatebooleanNoIf true, production deployment requires human approval. Defaults to true.
pen_test_gatebooleanNoIf true, a penetration test is required before production. Defaults to false.

quality

FieldTypeDefaultDescription
type_hints"required" | "recommended" | "optional""required"Type annotation requirement for all function signatures.
docstrings"all" | "public_only" | "optional""public_only"Docstring requirement.
test_coverage_mininteger80Minimum test coverage percentage.
logging_standardstring"module_logger_only"Logging approach. "module_logger_only" means logging.getLogger(__name__) — never print().
forbidden_patternsstring[][]Code patterns the AI must never write. e.g. ["print_statements", "bare_except", "mutable_defaults"].

compliance

FieldTypeDescription
frameworksstring[]Regulatory frameworks in force. e.g. ["gdpr"], ["gdpr", "iso27001"], ["iso27001", "cyber_essentials"].
data_classificationbooleanIf true, PII must be classified before any LLM processing.
audit_trailbooleanIf true, an immutable audit trail is required.
right_to_erasurestring | nullData deletion policy. "hard_delete_only" means soft-delete is forbidden.
data_residencystring | nullWhere data must reside. e.g. "eu_only", "uk_or_eu_only".
change_managementstring | nullChange management requirement. e.g. "crq_required" for enterprise/government.

audit

FieldTypeDefaultDescription
evidence_requiredbooleantrueWhether an evidence bundle must be produced at delivery.
evidence_formatstring"json"Evidence format. Currently only "json" is supported.
evidence_signedbooleantrueWhether the evidence bundle must be SHA-256 signed against the contract hash.
pr_comment_requiredbooleantrueWhether the evidence summary must be posted as a PR comment.
retention_yearsinteger | nullnullHow long evidence must be retained. Use 7 for regulated industries.
findings_min_detailstring"clause_level"Minimum granularity of evidence findings. "clause_level" means each clause must have a pass/fail result.

definition_of_done

FieldTypeDefaultDescription
tests_passbooleantrueAll tests must pass.
no_contract_violationsbooleantrueNo contract violations may be present at delivery.
coverage_metbooleantrueTest coverage must meet the quality.test_coverage_min threshold.
evidence_generatedbooleantrueA signed evidence bundle must have been produced.
security_scan_passbooleantrueThe Gatekeep security scan must pass.
pr_comment_postedbooleantrueThe evidence summary must be posted as a PR comment.
pen_test_passbooleanfalseA penetration test must have passed. Enterprise/government only.
dpo_review_gatebooleanfalseDPO review is required. GDPR + regulated SaaS.
accessibility_audit_passbooleanfalseAn accessibility audit must have passed. Government/public sector.
change_management_approvedbooleanfalseChange management approval must have been obtained.
scan_gatesScanGate[][]Gatekeep scan gates. See scan gates reference.

ScanGate object

FieldTypeRequiredDescription
categorystringYesGatekeep finding category. One of: governance, dependency, code_quality, security, iac, secret, sast, license, quality.
severitystringYesMinimum severity level to trigger this gate. One of: critical, high, medium, low, info.
thresholdintegerNoMaximum number of findings allowed at this severity. Default 0 — fail on any finding.
blockingbooleanNoIf true, exceeding the threshold blocks the PR. If false, advisory only. Default true.

Minimal example

{
  "contract_version": "1.0",
  "project": "my-python-api",
  "parties": {"client": "your-name", "contractor": "claude-code"},
  "stack": {
    "language": "python", "language_version": "3.12",
    "runtime": "aws_lambda", "region": "eu-north-1"
  },
  "cost": {
    "budget_envelope": "aws_free_tier",
    "forbidden_resources": ["nat_gateway", "rds", "secrets_manager"]
  },
  "security": {
    "auth_mechanism": "cognito_jwt",
    "secrets_store": "ssm_parameter_store"
  },
  "definition_of_done": {
    "tests_pass": true, "coverage_met": true,
    "scan_gates": [
      {"category": "secret", "severity": "critical", "blocking": true},
      {"category": "sast", "severity": "high", "blocking": true}
    ]
  }
}