clean-architecture

Enforce inward-facing dependencies and isolate infrastructure from domain logic.

Updated Mar 29, 2026
One-click install
npx skills add https://github.com/marquesfelip/agents-and-skills --skill clean-architecture-marquesfelip
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: clean-architecture
Source: https://github.com/marquesfelip/agents-and-skills/tree/main/skills/clean-architecture
Command: npx skills add https://github.com/marquesfelip/agents-and-skills --skill clean-architecture-marquesfelip

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Defines and enforces a clear separation between domain, application, and infrastructure layers to prevent framework leakage, improve testability, and support scalable maintenance.

Core Features & Use Cases

  • Layered architecture guidance (Domain, Application, Interface Adapters, Infrastructure) with dependency inward rules.
  • Dependency inversion and port-adapter patterns (ports define interfaces; adapters implement them).
  • Guidance for domain purity, isolation of frameworks, and testable architecture decisions.
  • Use Cases: Audit an existing codebase to identify architecture violations and plan a refactor toward hexagonal/clean architecture.

Quick Start

Provide a concrete architecture review plan and a sample set of domain, application, and infrastructure boundaries for your codebase.

Frequently Asked Questions about clean-architecture

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

FAQPage Schema
How do I separate domain logic from infrastructure in a backend codebase?

Separating domain logic from infrastructure requires enforcing inward-facing dependencies using clean architecture, where ports define interfaces and adapters implement them to isolate frameworks. This prevents framework leakage and keeps your domain pure.

What is the best way to audit an existing codebase for clean architecture violations?

Auditing for clean architecture violations involves checking dependency directions across domain, application, and infrastructure layers to ensure dependencies point inward. This identifies framework leakage and pinpoints where to plan a refactor toward hexagonal architecture.

How does dependency inversion work with ports and adapters in domain-driven design?

Dependency inversion in domain-driven design works by defining ports as interfaces within the application layer, while infrastructure adapters implement those interfaces externally. This wiring at the composition root isolates domain logic and improves testability.

Can I apply hexagonal architecture to a backend system without using external frameworks?

Yes, applying hexagonal architecture isolates frameworks by treating them as infrastructure adapters outside the domain. Your core application and domain layers remain pure and framework-agnostic, communicating only through defined ports.

When should I not use clean architecture for my backend system?

Clean architecture may be unnecessary for very small or simple backend systems where the overhead of defining ports, adapters, and a composition root outweighs the maintainability and testability benefits gained from strict dependency inversion.