architecture-design
Guide architectural and structural decisions using Architecture Decision Records (ADRs) — new services, pattern choices, database selection, component boundaries, state management, costly-to-reverse decisions. Triggers: how should I architect, which pattern, design decision, should I use X or Y, system design, ADR, component design, architectural trade-off. Owns internal-structure decisions — build vs buy/adopt a vendor or OSS capability → build-vs-buy.
- License 许可
- MIT
- 最近更新
- 2026-11-12
- Stars
- ★ 1
- Forks
- 1
01 前言 Front Matter
- name
- architecture-design
- description
- Guide architectural and structural decisions using Architecture Decision Records (ADRs) — new services, pattern choices, database selection, component boundaries, state management, costly-to-reverse decisions. Triggers: how should I architect, which pattern, design decision, should I use X or Y, system design, ADR, component design, architectural trade-off. Owns internal-structure decisions — build vs buy/adopt a vendor or OSS capability → build-vs-buy.
02 资源文件 6
- 参考文档evals/evals.json3.2 KB
- 参考文档references/clean-architecture.md8.2 KB
- 参考文档references/component-principles.md6.8 KB
- 参考文档references/principles.md3.8 KB
- 参考文档references/solid-principles.md6.1 KB
- 参考文档templates/adr.md1.3 KB
03 SKILL.md 正文
Architecture Design
Help the user make well-reasoned architectural decisions and document them in Architecture Decision Records (ADRs). Good architecture is about managing trade-offs explicitly, not finding perfect solutions.
Workflow
Step 0: Inventory What Already Exists
If a system is already running, establish what it already provides before proposing a new service, module, boundary, or pattern. Map the current state directly from the codebase — don't infer it from the requirements, the docs, or memory. Docs describe the system someone intended; the code is the one you have.
Cover both:
- Artifacts — existing services, modules, and seams that already own, or could own, the responsibility in question. Search by capability, not just by name: the component that does this may be called something else entirely.
- Written decisions — the ADR log, established conventions, and prior audit findings. A decision already made and recorded is not yours to re-litigate silently; supersede it explicitly or work within it.
Exit condition — one line, then keep going in the same response:
"<existing component> already handles <responsibility>; it does / does not
serve this because <reason>."
This step is not a gate on delivering. Greenfield — nothing built yet, or nothing you can reach — closes it in one line: say so and go straight to Step 1. When you can't inspect, name what you would check and continue under stated assumptions. Never answer a design question with inventory and questions alone; carry the options, the recommendation, and the trade-offs in the same reply.
This constrains the input, not the choice. A new component is a fine outcome; an unexamined one isn't.
Step 1: Frame the Decision
Identify the exact decision to be made. A good architectural question is specific and scoped:
- Too broad: "How should I design the backend?"
- Right scope: "Should user authentication be a separate microservice or a module within the monolith?"
If the user's question is too broad, help narrow it by asking:
- What triggered this decision? (new feature, scaling issue, tech debt)
- What are the constraints? (team size, timeline, existing stack)
- What's the blast radius? (which parts of the system are affected)
Step 2: Explore the Context
Understand the current state before proposing changes:
- Current architecture: the Step 0 finding — what exists today, established from the code rather than assumed. If you can't state it, Step 0 isn't done.
- Quality attributes that matter: Performance? Scalability? Developer experience? Maintainability? Deployment simplicity?
- Team context: Team size, expertise, on-call burden
- Growth trajectory: Expected scale in 6-12 months (not 5 years — YAGNI)
Step 3: Generate Options
Present 2-4 viable options. For each option:
- Name it clearly (e.g., "Separate Auth Service" vs "Auth Module in Monolith")
- Describe the approach in 2-3 sentences
- Analyze trade-offs against the quality attributes identified in Step 2
- Estimate complexity (implementation effort, operational overhead)
- Identify reversibility — how hard is it to change this decision later?
- Name any new library it brings in, with
dependency-management's Step 1 verdict (own module, adopt, or ask the user) in the option itself. The ADR records why each library is worth the coupling.
Avoid presenting a straw-man option just to make the preferred one look better.
Step 4: Apply Design Principles
Evaluate each option through these lenses:
- KISS: Which option is simplest to implement and operate?
- YAGNI: Which avoids building for hypothetical future needs?
- Functional Independence: Which gives the cleanest boundaries and lowest coupling?
- Separation of Concerns: Which isolates responsibilities clearly?
- DRY: Which avoids duplication of logic or data?
- SOLID: Does the design respect Open/Closed, Liskov Substitution, Interface Segregation, and Dependency Inversion? See references/solid-principles.md.
- Clean Architecture: Does the dependency direction point inward? Are business rules protected from infrastructure details? See references/clean-architecture.md.
- Component boundaries: Are components cohesive (CCP, CRP) and acyclic (ADP)? Do dependencies flow toward stability (SDP)? See references/component-principles.md.
Document which principles favor which option. Conflict between principles is expected — that's why it's a decision, not a formula.
See references/principles.md for deeper guidance on applying KISS, YAGNI, coupling, and separation of concerns to architecture decisions.
Step 5: Make a Recommendation
State the recommended option clearly, with reasoning. Structure it as:
- Recommendation: Option X
- Primary reason: The most compelling argument (one sentence)
- Key trade-off accepted: What you're giving up and why it's acceptable
- Conditions that would change this decision: Future triggers to revisit
Step 6: Document the ADR
Produce an ADR using the template at templates/adr.md. Save it in the project's decision log (e.g., docs/decisions/NNN-decision-title.md).
ADRs are immutable records. If a decision is superseded, create a new ADR that references the old one — don't edit the original.
For visual architecture documentation (system diagrams, runtime flows, infrastructure topology), see the architecture-documentation skill.
When the decision is whether a capability should be built at all versus bought or adopted (vendor/SaaS/OSS, TCO, lock-in, exit costs), use build-vs-buy — it produces the same ADR-style record, but for sourcing rather than structure.
When to Split Decisions
If the analysis reveals multiple independent decisions bundled together, split them into separate ADRs. For example, "How should we handle caching?" might split into:
- ADR-001: Cache invalidation strategy
- ADR-002: Cache storage technology
- ADR-003: Cache warming approach
04 同仓库更多 Skills
writing-skills
Use when authoring, editing, or reviewing a skill in this library — a new SKILL.md, one that under-triggers, or hardening an existing one. Covers description and listing-budget rules, frontmatter, progressive disclosure, the 3-eval rule, and pressure-testing against rationalizations.
working-agreement
Define and validate how a multi-session project is run — where plans, status and decisions live, session routines, new work, milestone close. README/CONTRIBUTING → project-documentation.
verification-before-completion
Evidence gate before any claim that work is done, fixed, passing, or deployed. Route here when a message declares the work finished or asks to commit, push, merge, ship, or close it out, including a brief sign-off, and before git-workflow or release-management act on it. Writing the commit message or PR text itself → git-workflow.
ui-ux-design
Design user experiences from an engineer's perspective — user flows, wireframes, interaction patterns, responsive strategy, navigation, loading/error/empty states. Triggers: design the UI, user flow, wireframe, how should this screen look, loading state, error state, empty state, responsive design, navigation, page layout, form design, mockup.
threat-modeling
Design-time security analysis of a system or feature before it's built — trust boundaries, attack surface, STRIDE per element, abuse cases, prioritized mitigations that become security requirements. Triggers: threat model, STRIDE, trust boundary, attack surface, what could go wrong security-wise, security design review, abuse case, secure this design, security requirements. Reviewing EXISTING code/config for vulnerabilities → security-audit; use this skill while the design is still on the whiteboard.
test-suite-design
Design comprehensive test suites for existing code — strategy across unit/integration/e2e, fixtures, factories, helpers. Triggers: add tests, write tests for, increase coverage, test this module, testing strategy, test plan, what tests do I need, test infrastructure, test helpers, this has no tests. Not for TDD — use tdd-workflow.