architecture-clean-architecture
Architecture Clean Architecture
Overview
Use this skill to structure systems so business rules remain stable while infrastructure and frameworks evolve.
Scope Boundaries
- Framework and infrastructure details are leaking into domain logic.
- Dependency direction is inconsistent and change cost is rising.
- Teams need explicit boundaries between use cases, adapters, and delivery layers.
Core Judgments
- Domain boundary: what business rules must stay framework-independent.
- Use-case orchestration: what belongs in application services versus domain entities.
- Dependency inversion points: where interfaces must isolate infra concerns.
- Transaction and consistency scope: where atomicity belongs in the stack.
Practitioner Heuristics
- Domain layer should not import transport, ORM, queue, or UI frameworks.
- Application layer coordinates workflows; domain layer owns business invariants.
- For dynamic languages, define explicit data contracts (schema/types) at boundaries instead of passing untyped
any/objectpayloads that force downstream casts. - Prefer narrow ports with stable semantics over generic "utility" interfaces.
Workflow
- Map current modules to domain, application, interface-adapter, and infrastructure responsibilities.
- Identify dependency violations and hidden framework coupling in business rules.
- Define or refine ports where infrastructure currently bleeds into domain logic.
- Move orchestration responsibilities to application use cases and invariants to domain objects.
- Align transaction boundaries with use-case semantics, not repository convenience.
- Record remaining boundary debt and migration sequence.
Common Failure Modes
- "Clean" layers exist physically but still share mutable models across boundaries.
- Domain services become anemic wrappers while business logic moves to adapters.
- Generic DTOs and untyped maps cross layers, increasing casts and null checks.
Failure Conditions
- Stop when dependency direction cannot be explained by domain intent.
- Stop when boundary contracts remain implicit or loosely typed.
- Escalate when required boundary changes are blocked by organizational ownership constraints.
More from kentoshimizu/sw-agent-skills
graph-algorithms
Graph algorithm workflow for modeling entities/relations and selecting traversal, path, ordering, or flow strategies. Use when correctness or performance depends on graph representation and algorithm choice; do not use for schema-only modeling or deployment topology planning.
14bash-style-guide
Style, review, and refactoring standards for Bash shell scripting. Trigger when `.sh` files, files with `#!/usr/bin/env bash` or `#!/bin/bash`, or CI workflow blocks with `shell: bash` are created, modified, or reviewed and Bash-specific quality controls (quoting safety, error handling, portability, readability) must be enforced. Do not use for generic POSIX `sh`, PowerShell, or language-specific application style rules. In multi-language pull requests, run together with other applicable `*-style-guide` skills.
11powershell-style-guide
Style, review, and refactoring standards for PowerShell scripting. Trigger when `.ps1`, `.psm1`, `.psd1` files, or CI workflow blocks with `shell: pwsh` or `shell: powershell` are created, modified, or reviewed and PowerShell-specific quality controls (error handling, parameter validation, readability, operational safety) must be enforced. Do not use for Bash, generic POSIX `sh`, or language-specific application style rules. In multi-language pull requests, run together with other applicable `*-style-guide` skills.
10github-codeowners-management
Govern CODEOWNERS rules so review routing reflects real ownership and risk boundaries on GitHub. Use when repository ownership mapping or mandatory reviewer rules must be defined, updated, or audited; do not use for non-GitHub runtime architecture or data-layer design.
9security-authentication
Security workflow for authentication architecture, credential lifecycle, and session/token assurance. Use when login, identity proofing, MFA, or session security decisions are required; do not use for authorization policy design or non-security quality tuning.
9redis-caching-patterns
Redis caching workflow for latency improvement with explicit key strategy, TTL/invalidation policy, and correctness bounds. Use when Redis-backed caching decisions are required for application performance; do not use for repository-wide architecture governance or release management policy.
9