skill
skill-layered-domain-architecture
Agent Skill for Layered Domain Architecture and TDD workflow across software projects
Set up
Skills are installed by placing their folder where your agent loads skills.
The download comes from github.com/abbasjaber/skill-layered-domain-architecture itself, not from our server, so what you get is exactly what its author published.
Install instructions come from the README
README
synced Nov 1, 2026Layered Domain Architecture Skill
An Agent Skill providing production-grade guidelines, design patterns, and testing protocols for building backend systems using Layered Domain Architecture and Test-Driven Development (TDD).
Designed for AI coding assistants (Google Antigravity, Claude Code, Cursor, GitHub Copilot CLI, Codex) and human engineering teams.
⚡ Instant One-Line Installation with npx
No cloning or manual copying needed! Anyone can install the skill with one command:
1. Install into Current Project (Recommended)
Run this inside any project root to add the skill to .agents/skills/layered-domain-architecture:
npx github:abbasjaber/skill-layered-domain-architecture
Then commit .agents/skills to Git so your entire team and their AI agents have it automatically.
2. Install Globally (For All Projects on Machine)
Installs into ~/.gemini/config/skills and ~/.agents/skills:
npx github:abbasjaber/skill-layered-domain-architecture --global
3. Install Everywhere (Current Project + Globally)
npx github:abbasjaber/skill-layered-domain-architecture --all
🎯 Architecture Blueprint
[ HTTP / Transport Layer ] Controllers / Handlers / Resolvers
│
▼
[ Domain / Application Layer ] Services / Use Cases (Interfaces & Implementations)
│
▼
[ Data Access Layer ] Repositories / Data Mappers (Interfaces & Implementations)
│
▼
[ Serialization Layer ] Resources / DTOs / Serializers
Key Principles
- Separation of Concerns: Controllers handle transport only; Services handle business rules; Repositories handle database persistence; Resources handle API response contracts.
- Dependency Inversion: Code to interfaces. Services and Repositories expose explicit contracts bound via IoC containers.
- Strict TDD Verification: Every endpoint must pass tests for 401 (Unauthenticated), 403 (Unauthorized/RBAC), 400/422 (Validation & boundary limits), 200/201/204 (Success), and database transaction rollback integrity.
- Database Safety: All migrations must be strictly reversible (
upanddown), use UUID/ULID primary keys, and enforce referential integrity.
🌐 Supported Projects & Frameworks
This skill is designed for any backend API or server-side application that handles business logic, databases, and authentication, regardless of the language or framework.
1. Ideal Project Types
| Project Type | Why It Works Well |
|---|---|
| SaaS & Enterprise Platforms | Keeps large applications organized with strict domain boundaries (Staff/, Client/, Billing/, Auth/). |
| REST & GraphQL Web APIs | Ensures clean separation between request parsing, business rules, queries, and JSON response envelopes. |
| B2B / Multi-Audience Portals | Naturally separates different user interfaces (e.g., Client Portal vs. Staff/Admin Portal). |
| Fintech, Legal & Healthcare | Enforces auditability, strict RBAC security tests (401/403), and transactional database rollback guarantees. |
| Monoliths & Microservices | Works equally well inside a modular monolith or inside individual microservices. |
2. How the 4 Layers Map Across Frameworks
The pattern (Transport → Service → Repository → Resource) translates seamlessly into any backend stack:
| Framework / Language | Transport Layer | Domain Service Layer | Data Access Layer | Serialization Layer |
|---|---|---|---|---|
| Laravel / PHP | Controllers | Services (*Service.php) | Repositories (*Repository.php) | API Resources (*Resource.php) |
| NestJS / TypeScript | @Controller() | @Injectable() Services | TypeORM / Prisma Repositories | DTOs with class-transformer |
| FastAPI / Python | Routers (@router.get) | Domain Services / Use Cases | SQLAlchemy / SQLModel Repositories | Pydantic Schemas |
| Go | HTTP Handlers / Gin / Fiber | Use Case / Service structs | Storage / Repository interfaces | Response structs |
| Spring Boot / Java | @RestController | @Service classes | @Repository (JPA/Hibernate) | DTO records |
| ASP.NET Core / C# | ControllerBase | Application Services | EF Core Repositories | ViewModels / DTOs |
3. When NOT to Use It
- Pure Frontend Projects: Static websites, simple React/Vue SPA apps without a backend.
- Micro-Lambdas / Simple Webhooks: A simple 10-line cloud function that just resizes an image or sends an alert doesn't need 4 architectural layers.
- Data Science / ML Training Pipelines: Jupyter notebooks or Python data processing scripts (Pandas/PyTorch) don't follow web API layer patterns.
💡 How to Use
AI agents will automatically load this skill whenever tasks match triggering conditions such as:
- Designing or implementing new backend features, APIs, or domain modules.
- Refactoring fat controllers or extracting repositories.
- Setting up TDD feature test suites or endpoint verification.
- Writing reversible database migrations.
You can also prompt your agent explicitly:
/layered-domain-architecture
or
Follow the layered-domain-architecture skill to design the billing module.
📦 Manual Installation (Git Clone Alternative)
Globally
git clone https://github.com/abbasjaber/skill-layered-domain-architecture.git ~/.gemini/config/skills/layered-domain-architecture
Inside a Project
mkdir -p .agents/skills
git clone https://github.com/abbasjaber/skill-layered-domain-architecture.git .agents/skills/layered-domain-architecture
📄 License
MIT License. See LICENSE for details.