/architecture-patterns
Architecture validation and patterns for clean architecture, backend structure enforcement, project structure validation, test standards, and context-aware sizing. Use when designing system boundaries, enforcing layered architecture, validating project structure, defining test
$ npx -y skills add yonatangross/orchestkit --skill architecture-patterns --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.
- You can call itInvoke it directly when you want it.
- Slash command
/architecture-patterns
Context preview
The summary Claude sees to decide when to auto-load this skill.
Architecture validation and patterns for clean architecture, backend structure enforcement, project structure validation, test standards, and context-aware sizing. Use when designing system boundaries, enforcing layered architecture, validating project structure, defining test
SKILL.md
architecture-patterns.SKILL.mdname: architecture-patterns
license: MIT
compatibility: "Claude Code 2.1.220+."
description: Architecture validation and patterns for clean architecture, backend structure enforcement, project structure validation, test standards, and context-aware sizing. Use when designing system boundaries, enforcing layered architecture, validating project structure, defining test standards, or choosing the right architecture tier for project scope.
tags: [architecture, clean-architecture, validation, structure, enforcement, testing-standards, right-sizing, over-engineering, context-aware]
skills: [scope-appropriate-architecture]
context: fork
agent: backend-system-architect
version: 2.1.0
author: OrchestKit
user-invocable: false
disable-model-invocation: false
complexity: high
persuasion-type: reference
effort: high
metadata:
category: document-asset-creation
allowed-tools:
- Read
- Glob
- Grep
- WebFetch
- WebSearch
paths: ["src/**", "package.json", "tsconfig.json"]
<!-- directive-density: intentional (teaches anti-patterns; NEVER markers describe real layering violations, not aspirational guidance) -->
Architecture Patterns
Consolidated architecture validation and enforcement patterns covering clean architecture, backend layer separation, project structure conventions, and test standards. Each category has individual rule files in `rules/` loaded on-demand. House scars and dated decisions rescued from retired reference tutorials live in `references/ork-delta.md`; the tutorials themselves are upstream's job (see "Upstream coverage" below).
Quick Reference
| Category | Rules | Impact | When to Use | |----------|-------|--------|-------------| | [Clean Architecture](#clean-architecture) | 3 | HIGH | SOLID principles, hexagonal architecture, ports & adapters, DDD | | [Project Structure](#project-structure) | 2 | HIGH | Folder conventions, nesting depth, import direction, barrel files | | [Backend Layers](#backend-layers) | 3 | HIGH | Router/service/repository separation, DI, file naming | | [Test Standards](#test-standards) | 3 | MEDIUM | AAA pattern, naming conventions, coverage thresholds | | [Right-Sizing](#right-sizing) | 2 | HIGH | Architecture tier selection, over-engineering prevention, context-aware enforcement |
**Total: 13 rules across 5 categories**
Quick Start
# Clean Architecture: Dependency Inversion via Protocol
class IUserRepository(Protocol):
async def get_by_id(self, id: str) -> User | None: ...
class UserService:
def __init__(self, repo: IUserRepository):
self._repo = repo # Depends on abstraction, not concretion
# FastAPI DI chain: DB -> Repository -> Service
def get_user_service(db: AsyncSession = Depends(get_db)) -> UserService:
return UserService(PostgresUserRepository(db))# Project Structure: Unidirectional Import Architecture
shared/lib -> components -> features -> app
(lowest) (highest)
# Backend Layers: Strict Separation
Routers (HTTP) -> Services (Business Logic) -> Repositories (Data Access)
Clean Architecture
SOLID principles, hexagonal architecture, ports and adapters, and DDD tactical patterns for maintainable backends.
| Rule | File | Key Pattern | |------|------|-------------| | Hexagonal Architecture | `${CLAUDE_SKILL_DIR}/rules/clean-hexagonal.md` | Driving/driven ports, adapter implementations, layer structure | | SOLID & Dependency Rule | `${CLAUDE_SKILL_DIR}/rules/clean-dependency-rule.md` | Protocol-based interfaces, dependency inversion, FastAPI DI | | DDD Tactical Patterns | `${CLAUDE_SKILL_DIR}/rules/clean-ports-adapters.md` | Entities, value objects, aggregate roots, domain events |
Design review checklist: `${CLAUDE_SKILL_DIR}/checklists/solid-checklist.md`. Domain entity scaffold: `${CLAUDE_SKILL_DIR}/scripts/domain-entity-template.py`.
Key Decisions
| Decision | Recommendation | |----------|----------------| | Protocol vs ABC | Protocol (structural typing) | | Dataclass vs Pydantic | Dataclass for domain, Pydantic for API | | Repository granularity | One per aggregate root | | Transaction boundary | Service layer, not repository | | Event publishing | Collect in aggregate, publish after commit |
Project Structure
Feature-based organization, max nesting depth, unidirectional imports, and barrel file prevention.
| Rule | File | Key Pattern | |------|------|-------------| | Folder Structure & Nesting | `${CLAUDE_SKILL_DIR}/rules/structure-folders.md` | React/Next.js and FastAPI layouts, 4-level max nesting, barrel file rules | | Import Direction & Location | `${CLAUDE_SKILL_DIR}/references/structure-import-direction.md` | Unidirectional imports, cross-feature prevention, component/hook placement |
Blocking Rules
| Rule | Check | |------|-------| | Max Nesting | Max 4 levels from src/ or app/ | | No Barrel Files | No index.ts re-exports (tree-shaking issues) | | Component Location | React components in components/ or features/ only | | Hook Location | Custom hooks in hooks/ or features/*/hooks/ only | | Import Direction | Unidirectional: shared -> components -> features -> app |
Backend Layers
FastAPI Clean Architecture with router/service/repository layer separation and blocking validation.
| Rule | File | Key Pattern | |------|------|-------------| | Layer Separation | `${CLAUDE_SKILL_DIR}/rules/backend-layers.md` | Router/service/repository boundaries, forbidden patterns, async rules | | Dependency Injection | `${CLAUDE_SKILL_DIR}/rules/backend-di.md` | Depends() chains, blocked DI patterns, violation detection | | File Naming & Exceptions | `${CLAUDE_SKILL_DIR}/rules/backend-repository.md` | Naming conventions, async rules, domain exceptions |
House scars for this category (exception-to-HTTP status map, import-level violation greps, DI override teardown): `${CLAUDE_SKILL_DIR}/references/ork-delta.md`.
Layer Boundaries
| Layer | Responsibility | Forbidden | |-------|---------------|-----------| |
Read more
name: architecture-patterns license: MIT compatibility: "Claude Code 2.1.220+." description: Architecture validation and patterns for clean architecture, backend structure enforcement, project structure validation, test standards, and context-aware sizing. Use when designing system boundaries, enforcing layered architecture, validating project structure, defining test standards, or choosing the right architecture tier for project scope. tags: [architecture, clean-architecture, validation, structure, enforcement, testing-standards, right-sizing, over-engineering, context-aware] skills: [scope-appropriate-architecture] context: fork agent: backend-system-architect version: 2.1.0 author: OrchestKit user-invocable: false disable-model-invocation: false complexity: high persuasion-type: reference effort: high metadata: category: document-asset-creation allowed-tools: - Read - Glob - Grep - WebFetch - WebSearch paths: ["src/**", "package.json", "tsconfig.json"]
<!-- directive-density: intentional (teaches anti-patterns; NEVER markers describe real layering violations, not aspirational guidance) -->
Architecture Patterns
Consolidated architecture validation and enforcement patterns covering clean architecture, backend layer separation, project structure conventions, and test standards. Each category has individual rule files in `rules/` loaded on-demand. House scars and dated decisions rescued from retired reference tutorials live in `references/ork-delta.md`; the tutorials themselves are upstream's job (see "Upstream coverage" below).
Quick Reference
| Category | Rules | Impact | When to Use | |----------|-------|--------|-------------| | [Clean Architecture](#clean-architecture) | 3 | HIGH | SOLID principles, hexagonal architecture, ports & adapters, DDD | | [Project Structure](#project-structure) | 2 | HIGH | Folder conventions, nesting depth, import direction, barrel files | | [Backend Layers](#backend-layers) | 3 | HIGH | Router/service/repository separation, DI, file naming | | [Test Standards](#test-standards) | 3 | MEDIUM | AAA pattern, naming conventions, coverage thresholds | | [Right-Sizing](#right-sizing) | 2 | HIGH | Architecture tier selection, over-engineering prevention, context-aware enforcement |
**Total: 13 rules across 5 categories**
Quick Start
# Clean Architecture: Dependency Inversion via Protocol
class IUserRepository(Protocol):
async def get_by_id(self, id: str) -> User | None: ...
class UserService:
def __init__(self, repo: IUserRepository):
self._repo = repo # Depends on abstraction, not concretion
# FastAPI DI chain: DB -> Repository -> Service
def get_user_service(db: AsyncSession = Depends(get_db)) -> UserService:
return UserService(PostgresUserRepository(db))# Project Structure: Unidirectional Import Architecture shared/lib -> components -> features -> app (lowest) (highest) # Backend Layers: Strict Separation Routers (HTTP) -> Services (Business Logic) -> Repositories (Data Access)
Clean Architecture
SOLID principles, hexagonal architecture, ports and adapters, and DDD tactical patterns for maintainable backends.
| Rule | File | Key Pattern | |------|------|-------------| | Hexagonal Architecture | `${CLAUDE_SKILL_DIR}/rules/clean-hexagonal.md` | Driving/driven ports, adapter implementations, layer structure | | SOLID & Dependency Rule | `${CLAUDE_SKILL_DIR}/rules/clean-dependency-rule.md` | Protocol-based interfaces, dependency inversion, FastAPI DI | | DDD Tactical Patterns | `${CLAUDE_SKILL_DIR}/rules/clean-ports-adapters.md` | Entities, value objects, aggregate roots, domain events |
Design review checklist: `${CLAUDE_SKILL_DIR}/checklists/solid-checklist.md`. Domain entity scaffold: `${CLAUDE_SKILL_DIR}/scripts/domain-entity-template.py`.
Key Decisions
| Decision | Recommendation | |----------|----------------| | Protocol vs ABC | Protocol (structural typing) | | Dataclass vs Pydantic | Dataclass for domain, Pydantic for API | | Repository granularity | One per aggregate root | | Transaction boundary | Service layer, not repository | | Event publishing | Collect in aggregate, publish after commit |
Project Structure
Feature-based organization, max nesting depth, unidirectional imports, and barrel file prevention.
| Rule | File | Key Pattern | |------|------|-------------| | Folder Structure & Nesting | `${CLAUDE_SKILL_DIR}/rules/structure-folders.md` | React/Next.js and FastAPI layouts, 4-level max nesting, barrel file rules | | Import Direction & Location | `${CLAUDE_SKILL_DIR}/references/structure-import-direction.md` | Unidirectional imports, cross-feature prevention, component/hook placement |
Blocking Rules
| Rule | Check | |------|-------| | Max Nesting | Max 4 levels from src/ or app/ | | No Barrel Files | No index.ts re-exports (tree-shaking issues) | | Component Location | React components in components/ or features/ only | | Hook Location | Custom hooks in hooks/ or features/*/hooks/ only | | Import Direction | Unidirectional: shared -> components -> features -> app |
Backend Layers
FastAPI Clean Architecture with router/service/repository layer separation and blocking validation.
| Rule | File | Key Pattern | |------|------|-------------| | Layer Separation | `${CLAUDE_SKILL_DIR}/rules/backend-layers.md` | Router/service/repository boundaries, forbidden patterns, async rules | | Dependency Injection | `${CLAUDE_SKILL_DIR}/rules/backend-di.md` | Depends() chains, blocked DI patterns, violation detection | | File Naming & Exceptions | `${CLAUDE_SKILL_DIR}/rules/backend-repository.md` | Naming conventions, async rules, domain exceptions |
House scars for this category (exception-to-HTTP status map, import-level violation greps, DI override teardown): `${CLAUDE_SKILL_DIR}/references/ork-delta.md`.
Layer Boundaries
| Layer | Responsibility | Forbidden | |-------|---------------|-----------| |
Showing the first part of this file.
The Complete AI Development Toolkit for Claude Code — 114 skills, 37 agents, 212 hooks. Production-ready patterns for full-stack development.
Repo: yonatangross/orchestkit
Other skills on orchestkit.
- /accessibility
Accessibility patterns for WCAG 2.2 compliance, keyboard focus management, React Aria component patterns, cognitive inclusion, native HTML-first philosophy, and user preference honoring. Use when implementing screen reader support, keyboard navigation, ARIA patterns, focus
Open skill - /agent-orchestration
Agent orchestration patterns for agentic loops, multi-agent coordination, alternative frameworks, and multi-scenario workflows. Use when building autonomous agent loops, coordinating multiple agents, evaluating CrewAI/AutoGen/Swarm, or orchestrating complex multi-step scenarios.
Open skill - /ai-ui-generation
AI-assisted UI generation patterns for json-render, v0.app, Google Stitch, Bolt Cloud, and Cursor workflows. Covers prompt engineering for component and full-stack app generation, review checklists for AI-generated code, design token injection, refactoring for design system
Open skill - /analytics
Queries local analytics across OrchestKit projects for agent usage, skill frequency, hook timing, team activity, session replay, cost estimation, and model delegation trends. Privacy-safe with hashed project IDs. Supports time-range filtering and comparative analysis. Use when
Open skill - /animation-motion-design
Animation and motion design patterns using Motion library (formerly Framer Motion) and View Transitions API. Use when implementing component animations, page transitions, micro-interactions, gesture-driven UIs, or ensuring motion accessibility with prefers-reduced-motion.
Open skill - /api-design
API contract design for REST and GraphQL, covering resource shape, URL and header versioning with deprecation windows, RFC 9457 Problem Details error handling, and OpenAPI specs. Use when specifying the wire contract an endpoint exposes, choosing a versioning scheme, or
Open skill

