Guides choosing a repository's architecture — topology (monolith, modular monolith, microservices, serverless) or code organization (layered, by-domain, hexagonal, clean/onion). Use when picking or restructuring either, not for generic project setup.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Architecture Pattern Advisor?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/fabiandistler-architecture-pattern-advisor)
---
name: architecture-pattern-advisor
category: architecture
environments: coding
description: Guides choosing a repository's architecture — topology (monolith, modular monolith, microservices, serverless) or code organization (layered, by-domain, hexagonal, clean/onion). Use when picking or restructuring either, not for generic project setup.
---
# Architecture Pattern Advisor
## When to Use
Help the user pick the architecture that fits *their* project, then help implement it. The decision spans two independent axes — **system topology** (how many deployable units) and **code organization** (how one unit is structured internally). They compose: a system is, for example, a *modular monolith + by-domain + hexagonal boundaries*.
- "Which architecture / pattern should I use for this project?"
- "How should I structure this repo?" / "organize the code?"
- "Monolith or microservices?" / "should I split this into services?"
- "by-domain vs by-layer", "hexagonal / ports & adapters", "clean architecture", "onion"
- Restructuring an existing repo whose layout has become hard to maintain
**Not for:** generic project bootstrapping with no shape decision ("run `uv init`", "create a new file", "set up CI").
## Workflow
Follow the steps in order.
### 1. Establish context: new or existing repo
- **Existing repo:** inspect it read-only first — main language, build system, current layout. Name the current pattern and any smells (God-modules, circular dependencies, technical-only layering, business logic in transport/ORM code). Read [references/decision-drivers.md](references/decision-drivers.md) for what to look for.
- **New repo:** go straight to diagnosis.
### 2. Diagnose — ask before recommending
Ask a short, focused set of the diagnostic questions in [references/decision-drivers.md](references/decision-drivers.md): project type and language, team size, domain complexity, scaling and deployment needs, independent deployability, data-consistency needs, testability and external integrations, expected lifetime and rate of change, operational maturity (CI/CD, observability).
Ask only the questions that discriminate for this project, preferably one
multiple-choice question at a time. Wait for the answers before recommending.
### 3. Recommend — up to three candidates per axis, topology first
Work the two axes independently and in sequence: topology first, code organization second. For each axis, use this exact shape:
- For every candidate, including the recommendation, give a one-line definition and honest **Pros** and **Cons**.
- Put the **recommended option first** and label it as recommended; in addition to its pros/cons, give it one "fits you because …" line grounded in the diagnosis answers.
- Include only candidates that genuinely fit the project's context. When there is no genuine topology choice, as with many small libraries and R packages, skip that axis and explain why.
- Close by stating how the chosen topology and code organization compose.
Pull the candidate set, their pros/cons, and "when it fits / when to avoid" from [references/pattern-catalog.md](references/pattern-catalog.md). Map diagnosis answers to candidates using the heuristic table in [references/decision-drivers.md](references/decision-drivers.md).
Let the user choose. If they pick against the recommendation, accept it and note any consequence worth flagging.
### 4. Record the decision as an ADR
Once chosen, document it. Write an ADR capturing context, the decision drivers from step 2, the considered options from step 3 (the real candidates, not strawmen), and the consequences — including the downsides of the chosen option.
### 5. Implement — scaffold or migrate
- **New repo:** generate the folder/file skeleton from the annotated example tree for the chosen pattern in [references/pattern-catalog.md](references/pattern-catalog.md), adapted to the repo name and language.
- **Existing repo:** produce an **incremental migration plan** (strangler-fig): smallest first move, what moves where, keeping the build green at every step. Never a big-bang rewrite.
- Apply deep-module thinking when shaping boundaries: narrow interface, deep implementation (Ousterhout) — small interfaces hiding complexity.
- Make the new boundaries enforceable: read `members/fitness-functions/SKILL.md` (via the `architecture` router) and add one check that fails CI when a module reaches into another module's internals. That skill picks the tool for the ecosystem and proves the check can fail; do not choose the tool here.
### 6. Verify
Sanity-check the result: the project's build/test command passes and the boundary check from step 5 passes. For a migration, confirm the first step is green before listing the rest.
## Trade-off Analysis
When step 3's candidates are close or the choice is contentious, weigh the real alternatives (two is fine; for an existing repo always include the status quo) against the 3–7 characteristics that actually matter, separating short-term effects from long-run ones. Use a weighted matrix as a discussion aid, not a verdict, and record the choice with a review date in the ADR (step 4).
## Once topology lands on microservices
Stop here for boundary work: find bounded contexts with `members/ddd/SKILL.md`, then cut and wire services with `members/microservices-design/SKILL.md` (both read via the `architecture` router). This skill's only rule: extract from a modular monolith along module seams already proven by change-locality. Never cut along technical layers.
## Related skills
Sibling sub-skills, each read via the `architecture` router:
- `members/ddd/SKILL.md` — use when domain boundaries are unclear and bounded contexts must be found first.
- `members/microservices-design/SKILL.md` — use when services exist and their boundaries, communication, or contracts need design or review.
- `members/logical-component-design/SKILL.md` — use when decomposing a new system or feature into named logical components.
- `members/c4-modeling/SKILL.md` — use when the chosen architecture must be drawn as Context, Container, or Component diagrams.
- `members/coupling-cohesion/SKILL.md` — use when measuring whether an existing decomposition is sound.