nwave-ai/nwave/nw-architectural-styles-tradeoffs

Claude Code and agent skill by nwave-ai/nwave

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Architectural style selection decision matrices, trade-off analysis, structural enforcement rules, and combination patterns. Load when choosing or evaluating architecture styles.

Install

npx vskill@latest install nwave-ai/nwave/nw-architectural-styles-tradeoffs

SKILL.md

The same SKILL.md was published earlier as nwave-ai/nwave/nw-architectural-styles-tradeoffs.

Architectural Styles: Selection and Trade-offs

Style Selection Decision Tree

Start here. Answer the dominant driver, follow to recommended style.

Is the domain complex with rich business rules?
YES -> Do you need infrastructure independence and high testability?
YES -> Hexagonal / Clean / Onion (functionally equivalent, different terminology)
NO -> Is the domain well-understood with clear module boundaries?
YES -> Modular Monolith (single deployment, structured boundaries)
NO -> Layered Architecture (simple, well-known, fast to start)
NO -> Is this a feature-heavy application with independent feature teams?
YES -> Vertical Slice (per-feature organization, CQRS-friendly)
NO -> Do you need independent deployment and scaling per capability?
YES -> Can the team handle distributed system operational complexity?
YES -> Microservices
NO -> Modular Monolith (extract to services later)
NO -> Is the primary concern async workflows or event-driven processing?
YES -> Event-Driven Architecture
NO -> Is this a data processing pipeline?
YES -> Pipe and Filter
NO -> Layered Architecture (sensible default)

Cross-Cutting Comparison Matrix

StyleDep. DirectionOrganizationDeploymentBest ForTeam Size
Hexagonal/Clean/OnionInward (DIP)Ports + adaptersSingle processInfrastructure-agnostic domainsAny
Layered (N-Tier)Top-downHorizontal layersSingle/multi-tierSimple CRUD, rapid developmentSmall-medium
Vertical SlicePer-featureFeature foldersSingle processFeature-heavy, CQRS systemsMedium-large
MicroservicesPer-serviceService boundariesDistributedIndependent teams, polyglotLarge
Event-DrivenPub-subEvents + handlersDistributedAsync workflows, audit, decouplingMedium-large
CQRSRead/write splitCommand + query modelsSingle or distributedDifferent read/write scalingMedium
Pipe and FilterData flowSequential filtersSingle or distributedETL, data processingAny
Modular MonolithInward per moduleDomain modulesSingle processStructured monolith, future extractionSmall-medium

When-to-Use / When-NOT Decision Matrix

Hexagonal / Clean / Onion (equivalent patterns, different names)
Use WhenAvoid When
Multiple client types consume same domain logicSimple CRUD with single data store
UI/DB technologies need periodic refreshLatency-critical paths (added indirection)
High testability required -- domain testable without infraSmall team where adapter overhead outweighs benefit
Alignment with DDD desiredApplication will never change infrastructure
Vertical Slice
Use WhenAvoid When
Teams understand code smells and refactoring patternsTeams unfamiliar with refactoring -- slices diverge
Feature-heavy apps where changes affect one featureHeavy cross-cutting concerns (shared validation, auth)
CQRS systems with independent commands/queriesEarly projects with poorly understood domain
Minimize cross-cutting changes on new featuresNeed strong architectural governance
Microservices
Use WhenAvoid When
Multiple teams need independent deployment cyclesSmall teams (operational overhead per service)
Different system parts need different tech stacksGreenfield with unclear boundaries -- start modular monolith
Independent scaling of capabilities adds valueStrong transactional consistency required across boundaries
Organization supports operational complexityRisk of "grains of sand" anti-pattern
Modular Monolith
Use WhenAvoid When
Greenfield with unclear domain boundariesIndependent deployment of components required
Non-trivial complexity benefiting from module isolationDifferent modules need different tech stacks
Module autonomy without distributed overheadTeam ready for microservices operational complexity
Microservice-like structure with monolith simplicity--
Event-Driven / CQRS
Use WhenAvoid When
Loose coupling between producers and consumersSimple request-response applications
Workflows spanning multiple services (eventual consistency)Strong immediate consistency required
Complete audit trails needed (event sourcing)Team unfamiliar with eventual consistency
Read/write workloads have very different scaling needsSimple CRUD where two models add unjustified overhead
Pipe and Filter
Use WhenAvoid When
Processing decomposes into independent, reorderable stepsRequest-response requiring synchronous completion
Steps have different scalability requirementsSteps must execute as single transaction
Flexibility to add/remove/reorder steps neededSteps require significant shared state
ETL, image processing, compiler pipelines--

Combination Patterns

Styles are composable. The "Explicit Architecture" approach (Herberto Graca) combines:

PatternRole in Combined Architecture
HexagonalFramework connecting external tools to the core
OnionOrganizes layers within the hexagon
DDDSupplies domain concepts and bounded contexts
CleanReinforces dependency inversion rules
CQRSSeparates commands from queries within each bounded context

Practical rule: hexagonal/clean/onion are the SAME pattern with different terminology. All enforce DIP with inward dependency flow. Pick one vocabulary and use it consistently.

Enforceable Structural Rules

Architecture rules are only real if they are enforced. Key rules by style:

Hexagonal
RuleEnforcement
Domain has zero imports from adapters/infraimport-linter (Python), ArchUnit (Java), ArchUnitTS (TS)
All external communication via port interfacesCode review + architecture tests
No adapter-to-adapter dependenciesPackage dependency check
All dependencies point inward toward domainLayer dependency rule
Modular Monolith
RuleEnforcement
No cross-module database accessSchema ownership tests
Interface-only communication between modulesModule independence contract
No circular dependencies between modulesCycle detection
Module internals inaccessible from outsidePackage/import visibility rules
Vertical Slice
RuleEnforcement
Slices must not import from other slicesIndependence contract
All code for a feature resides within its sliceContainment check
Cross-slice communication via events/contracts onlyImport rules

Architecture Enforcement Tooling

LanguageToolApproach
Java/KotlinArchUnitFluent API unit tests, predefined architecture rules
TypeScript/JSArchUnitTSFile-based dependency rules, Jest/Vitest integration
TypeScript/JSdependency-cruiserComprehensive dependency analysis, JSON/dot/HTML reports, .dependency-cruiser.js config, widely adopted
Pythonimport-linterConfig-based contracts (forbidden, layers, independence)
PythonPyTestArchpytest-based architecture tests
Pythonpytest-archonpytest-native architecture tests, modern alternative to import-linter, decorator-based rules
.NETNetArchTestNUnit/xUnit architecture rules
Gogo-arch-lintYAML-based dependency rules
Python Example (import-linter)
ini
[importlinter:contract:hexagonal-domain]
name = Domain must not import from infrastructure
type = forbidden
source_modules = myapp.domain
forbidden_modules = myapp.infrastructure, myapp.adapters
[importlinter:contract:module-independence]
name = Feature modules must be independent
type = independence
modules =
myapp.modules.orders
myapp.modules.billing
myapp.modules.shipping

Run lint-imports in CI as first-stage fast check (analyzes imports, no I/O).

Common Anti-Patterns

Anti-PatternStyleSignalFix
Shared databaseMicroservicesServices query each other's tablesDatabase per service; API contracts
Distributed monolithMicroservicesServices deploy togetherRe-evaluate boundaries; consider modular monolith
Grains of sandMicroservicesToo-fine-grained services, constant coordinationMerge into coarser services aligned to bounded contexts
Anemic domain modelLayeredEntities are data bags, logic in servicesMove behavior into entities/value objects
Big ball of mudModular MonolithModule boundaries violated, cross-importsAdd architecture tests, enforce with CI
Pass-through layersCleanLayers that add no value, just forward callsRemove unnecessary layers; keep only those adding behavior

Annotating for Software Crafter

When the architecture document specifies an architectural style, include an enforcement annotation so the software-crafter knows which tooling to set up during DELIVER.

What to Include in the Design Document
  1. Style chosen and the key structural rules that apply (from the Enforceable Structural Rules section above)
  2. Recommended enforcement tool appropriate for the project's language (from the Architecture Enforcement Tooling table)
  3. Specific rules to enforce expressed as constraints the tool can verify
Annotation Format
markdown
## Architecture Enforcement
Style: [Hexagonal | Modular Monolith | Vertical Slice | ...]
Language: [Python | Java | TypeScript | ...]
Tool: [tool name from table above]
Rules to enforce:
-[Rule 1 from Enforceable Structural Rules, e.g., "Domain has zero imports from adapters/infra"]
-[Rule 2, e.g., "No cross-module database access"]

This annotation flows through acceptance-designer to software-crafter, who implements the architecture tests during the GREEN phase alongside the first component that establishes the structural boundary.

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
568
Repository forks
57
7-day trend score
32

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/nwave-ai/nwave/nw-architectural-styles-tradeoffs/badge)](https://verified-skill.com/skills/nwave-ai/nwave/nw-architectural-styles-tradeoffs)

Something wrong with this skill or its page? Tell us.