clean-architecture

Organizes feature modules into domain, data, and presentation layers for Next.js and monorepo projects.

Updated Apr 7, 2026
One-click install
npx skills add https://github.com/hontauadrian/sfx-app-empty-test --skill clean-architecture-hontauadrian
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: clean-architecture
Source: https://github.com/hontauadrian/sfx-app-empty-test/tree/main/.overstory/claude-profiles/reviewer/skills/clean-architecture
Command: npx skills add https://github.com/hontauadrian/sfx-app-empty-test --skill clean-architecture-hontauadrian

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Without a consistent layer structure, feature code becomes tangled: UI components call APIs directly, business logic leaks into components, and cross-feature imports create circular dependencies. This Skill enforces a clean architecture where dependencies point inward (presentation → data → domain), keeping code testable and maintainable. ## Core Features & Use Cases - Feature Module Scaffolding: Defines the standard directory layout for domain (models, use cases), data (remote, repositories, DTOs, mappers), and presentation (pages, components, validators) layers. - Monorepo Support: Shows how to split shared domain/data layers into a @project/shared package while apps own only the presentation layer. - Barrel Export Rules: Specifies what may be exported from a feature's index.ts (use cases, domain types, validators) and what must stay internal (remote functions, data models, mappers). - Use Case: When creating a new "users" feature in a Next.js app, follow this Skill to generate the folder tree, write the User domain model, a React Query repository hook, a DTO mapper, and a compliant barrel export. ## Quick Start Ask the AI to scaffold a new feature module following the clean architecture layer structure with domain, data, and presentation folders.

Frequently Asked Questions about clean-architecture

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

FAQPage Schema
How do I structure a feature folder with clean architecture in Next.js?▼

Create domain, data, and presentation subfolders inside features/[feature]. Domain holds plain TypeScript models and use cases, data holds remote calls, React Query repositories, DTOs and mappers, and presentation holds pages, components, and Zod validators.

How to share domain and data layers in a monorepo?▼

Place domain and data layers in a shared package such as @project/shared, including shared base hooks and validators. Each app then owns only its presentation layer, importing use cases through the shared package's barrel exports.

Can the domain layer import React Query or axios?▼

No. The domain layer must not import from the data layer or any framework and must not perform I/O. Use cases are thin wrappers that delegate to repository hooks, keeping domain models as plain TypeScript interfaces.

What should a feature barrel export in clean architecture?▼

Export only use cases, domain model types, and validators from the feature's index.ts. Never export data-layer internals such as remote functions, data models, mappers, or repository hooks directly.

Why use a mapper between API responses and domain models?▼

Mappers convert DataModel DTOs matching the API shape into domain models, isolating the rest of the app from backend naming conventions. Mapping flows one direction only, from DataModel to Domain, never the reverse.