contract-first-clean-arch

Define backend architectures from contract-first schemas with domain, application, and infrastructure layers.

2|Updated Feb 17, 2026
One-click install
npx skills add https://github.com/joserprieto/ai-skills --skill contract-first-clean-arch
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: contract-first-clean-arch
Source: https://github.com/joserprieto/ai-skills/tree/main/skills/contract-first-clean-arch
Command: npx skills add https://github.com/joserprieto/ai-skills --skill contract-first-clean-arch

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Contract-first, architecture-first guidelines provide a structured approach to designing backend systems with a single source of truth (schemas) and clearly separated layers (domain, application, infrastructure). This approach helps prevent drift between contracts and implementation, reduces cognitive load when wiring services, and enables scalable governance across teams.

Core Features & Use Cases

  • Self-contained slices per business capability with domain, application, and infrastructure layers wired through a single composition root.
  • Contracts as the SSOT driving generation, validation, and drift protection, plus ADRs to document architectural choices.
  • Ports and adapters enforce dependency inwardness, enabling test doubles and flexible deployment of production vs. test environments.
  • Criteria-based patterns and test strategies (object mothers, doubles) to support fast, deterministic testing across layers.

Quick Start

Clone the repository and follow Steps 1 through 8 to bootstrap a contract-first, screaming-slices project.

Frequently Asked Questions about contract-first-clean-arch

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How does contract-first architecture prevent schema drift in backend development?

Contract-first architecture uses schemas as the single source of truth to drive code generation, validation, and drift protection, ensuring backend implementations never diverge from defined API contracts.

How do I structure a backend application using screaming architecture and Clean Architecture?

Structure your backend into self-contained slices per business capability, separating domain, application, and infrastructure layers wired through a single composition root to achieve screaming architecture.

Can I use ports and adapters to isolate domain logic for testing?

Ports and adapters enforce dependency inwardness, allowing you to inject test doubles and isolate domain layers for fast, deterministic testing across flexible deployment environments.

What is the Criteria pattern for queries in Clean Architecture?

The Criteria pattern structures query objects within the application layer, enabling maintainable, testable data retrieval logic that keeps infrastructure concerns separated from domain rules.

Do I need existing API schemas to start building contract-first backend systems?

Yes, contract-first development requires defining API schemas upfront to act as the single source of truth, which then drives the generation of domain slices and validation logic.

When should I avoid using contract-first Clean Architecture for my backend?

Avoid contract-first Clean Architecture for rapid prototyping or small-scale services where strict layering, composition roots, and schema-driven development introduce unnecessary overhead.