architecture-design/SKILL.md
Architecture and design-review skill covering Domain-Driven Design (DDD), Clean Architecture, SOLID, GoF design patterns, and event-driven architecture, with concrete Python 3.12+ and TypeScript 5.x idioms. Use whenever a structural design decision is in play — designing a new system or module, reviewing code for structural quality, choosing between architectural approaches, refactoring toward cleaner layering, placing business logic, defining module boundaries, evaluating aggregates and bounded contexts, applying SOLID, selecting a design pattern, or deciding when (and when not) to adopt event sourcing, CQRS, or event-driven messaging. Trigger on phrases like "design a system", "architecture review", "is this clean", "where does this logic belong", "aggregate", "bounded context", "hexagonal", "ports and adapters", "SOLID violation", "anemic domain model", "code smell", "refactor this", "use case layer", "event sourcing", "CQRS", or any moment a developer asks whether a piece of code is in the right place.
npx skillsauth add kayaman/skills architecture-designInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Guide for designing and reviewing systems through five lenses —
Domain-Driven Design, Clean Architecture, SOLID, GoF patterns, and
event-driven architecture — with concrete Python 3.12+ and TypeScript 5.x
idioms. Deep content is organized in references/; this file is the router.
Core principle. Good architecture maximizes the number of decisions not made and easily changed. The test of a design is how cheaply the system can absorb tomorrow's requirement, not how elegantly it handles today's. Ref: Martin, Clean Architecture, Ch. 15.
Route based on user intent.
Follow the six-phase sequence. Do them in order — each phase produces inputs the next one needs.
references/ddd.md §
Strategic. Do this before picking a framework or database.references/ddd.md § Tactical.
Aggregate boundaries dictate transaction boundaries.references/clean-architecture.md.references/design-patterns.md.references/event-driven.md.references/python.md) or
TypeScript (references/typescript.md).Walk references/evaluation-rubric.md section by section. It produces a
scored report covering: domain model health, layer integrity, SOLID
adherence, pattern usage, and integration style.
For a fast triage before a deeper review, use the Five-question smoke test:
If any answer is bad, the system has a structural problem that the referenced document diagnoses in detail.
| Lens | Load when… | Reference |
|---|---|---|
| DDD | modeling a domain, choosing aggregate boundaries, fighting anemic models, defining bounded contexts, aligning code with domain-expert language | references/ddd.md |
| Clean Architecture | deciding where logic belongs, drawing layer boundaries, auditing dependency direction, evaluating framework coupling, setting up ports & adapters | references/clean-architecture.md |
| SOLID | reviewing a class, auditing interfaces, diagnosing rigidity, untangling "shotgun surgery" changes, designing for extensibility | references/solid.md |
| Design Patterns | a recurring structural problem appears, or a team is reaching for a specific named pattern and you need to validate or challenge the choice | references/design-patterns.md |
| Event-Driven | services exchange messages, CQRS or event sourcing is proposed, eventual consistency is on the table, sagas/orchestration come up | references/event-driven.md |
Language-specific reference files load when translating any lens into code:
references/python.md — Python 3.12+ idioms for value objects,
aggregates, ports, DI, DTOs, pattern matching, Protocols.references/typescript.md — TypeScript 5.x idioms for branded types,
discriminated unions, readonly modeling, ports, DI, satisfies.These are the non-obvious traps that separate a good review from a mediocre one. Each is diagnosed deeper in its reference file.
Domain modeling
Layering
SOLID
isinstance / typeof checks: if callers
have to inspect subtypes, the hierarchy is broken.Patterns
Event-driven
Python idioms (3.12+)
@dataclass(frozen=True, slots=True) for value objects — __eq__
and __hash__ for free, immutability enforced.typing.Protocol (PEP 544) over abc.ABC for ports — structural
typing fits ISP naturally.@override (PEP 698, 3.12+) on every overridden method — catches
silent LSP drift.match statements replace type-switch idioms; pair with sealed-style
unions (Literal, discriminated dataclass).model_config = ConfigDict( frozen=True) to forbid mutation). Domain objects stay plain.TypeScript idioms (5.x)
readonly:
type UserId = string & { readonly __brand: unique symbol }.never-check default.satisfies (4.9+) preserves literal types on constants.using (5.2+) for RAII-style resource management in infrastructure.import type at every layer boundary keeps the type graph separate
from the value graph and plays nicely with erasableSyntaxOnly (5.8+)
and Node's native type-stripping.When explaining or recommending a choice, use this shape. Makes intent auditable and gives maintainers a learning path.
### Design Decision: <short label>
**Recommended approach:** <one line>
**References:**
- *<Book>* — <Author>, Ch. <n>: <one-line takeaway>
**Trade-offs:**
- ✅ <advantage>
- ⚠️ <caveat or cost>
**Why not <alternative>:** <one line, ideally with reference>
For code artifacts, cite the pattern inline:
# Architecture: Hexagonal (Ports & Adapters)
# Ref: Percival & Gregory, Architecture Patterns with Python, Ch. 2
class OrderRepository(Protocol): ...
// Pattern: Strategy — runtime algorithm selection
// Ref: GoF, Design Patterns, p. 315
interface PricingStrategy { calculate(order: Order): Money; }
Run this checklist. Each item maps to a reference section for how to verify.
ddd.md § Ubiquitous Language).ddd.md §
Aggregates).clean-architecture.md § The Dependency Rule). Enforce with an
import-linter or depcheck in CI.domain/ or application/
(clean-architecture.md § Frameworks Are Details).clean-architecture.md § Boundaries).solid.md § DIP).clean-architecture.md § Testability).event-driven.md).python.md or
typescript.md).Starter scaffolding for the most common structures lives in
assets/templates/:
assets/templates/aggregate-py.md — Python aggregate with value
objects, invariants, domain events.assets/templates/aggregate-ts.md — TypeScript aggregate with
branded IDs and discriminated state.assets/templates/use-case-py.md — Python use-case (interactor)
with port injection.assets/templates/use-case-ts.md — TypeScript use-case with port
injection.Copy, rename, replace placeholders. Templates are starting points, not mandates — deviate when the domain calls for it, and note why.
When an O'Reilly MCP or equivalent book-search connector is available,
search before making any consequential recommendation — one query
either confirms the direction or surfaces an alternative. If no book
search is connected, cite the canon from memory and mark the claim with
[unverified] so the reader knows to double-check. The canonical
references for this skill:
tools
Guidance for designing charts, graphs, plots, dashboards, and data visualizations that communicate clearly and persuade. Use when creating or reviewing a visualization, choosing a chart type, picking a color palette, decluttering a busy graphic, fixing misleading axes or proportions, building a dashboard, annotating a figure, or turning data into a presentation, report, or data-driven story. Grounded in the standard data-visualization literature (Knaflic, Tufte, Cleveland & McGill, Cairo, Wilke, Munzner, Few, Berinato). Covers chart selection, graphical perception and encoding, color and accessibility, decluttering, graphical integrity, dashboards, and narrative. Does NOT cover building data pipelines or ETL, statistical modeling or analysis methods, BI tool/vendor selection, or general UI/UX layout (see ux-design-principles). Tool-agnostic, with optional Python recipes.
development
Architect and implement production-grade microservices systems in TypeScript (NestJS) and Python (FastAPI), including resilience, observability, testing, deployment, and migration guidance.
development
--- name: databricks-genie-spaces-best-practices description: Design, configure, curate, govern, monitor, and integrate Databricks AI/BI Genie Spaces — the natural-language-to-SQL surface over Unity Catalog. Covers space scoping, general instructions, parameterized example SQL, SQL functions, trusted assets, JOIN configuration, knowledge store, certified queries, benchmarks, monitoring tab, feedback loops, the Genie Conversation API, governance via Unity Catalog (row filters, column masks, embed
tools
Implement OTP and passwordless authentication on AWS for TypeScript projects using Cognito CUSTOM_AUTH triggers (default) or a custom DynamoDB-backed flow, with SES (email) and SNS (SMS) delivery. Use when the user mentions OTP, one-time password, passwordless login, magic link, Cognito custom auth, DefineAuthChallenge, CreateAuthChallenge, VerifyAuthChallengeResponse, SES verification email, SNS SMS code, or MFA over email/SMS. Covers architecture decision (Cognito vs custom), Lambda trigger handlers, SES/SNS notifiers, DynamoDB schema with TTL, rate limiting, constant-time comparison, threat model (enumeration, replay, brute force), and aws-sdk-client-mock testing.