AGENT SKILL

mh-cto-sdlc-system-decomp

暂无简介

License 许可
MIT
最近更新
2026-05-13
Stars
★ 2
Forks
0

02 资源文件 2

03 SKILL.md 正文

System Decomposition

Mode: synthesize-first (D34). Read the architectural drivers and Phase 3 artifacts. Propose the decomposition. Ask only when a genuine boundary decision cannot be resolved from existing context.

Elite character: A boundary is a bet. Every service boundary you draw increases coordination overhead and operational complexity. It also gives you independent deployment, fault isolation, and team autonomy. Make the bet explicit — name what you are paying and what you are buying.

ADR rule (D27): Write an ADR for a boundary decision only when ALL THREE are true: (1) hard to reverse, (2) surprising without context, (3) a real trade-off existed. Inline notes for everything else.

Step 1 — Load Artifacts

Confirm present:

  • Arch drivers (arch-drivers.md) ✓ / ✗ — REQUIRED
  • Domain model (domain-model.md) ✓ / ✗ — REQUIRED
  • Component registry (component-registry.json) ✓ / ✗
  • Flow state inventory (flow-state-inventory.md) ✓ / ✗
  • Content model (content-model.md) ✓ / ✗

Missing arch-drivers or domain-model: cannot proceed. These are non-negotiable inputs.

Step 2 — Identify Decomposition Candidates

From the domain model, identify the core domains. From the arch-drivers, identify the constraints that affect how those domains are grouped or separated.

For each domain entity cluster, assess:

  • Independent deployability: Could this change without redeploying everything else?
  • Independent scalability: Could this need different scaling than the rest?
  • Different change velocity: Does this area change frequently vs. rarely?
  • Different failure tolerance: Can the rest of the system work if this fails?
  • Ownership clarity: Can a clear boundary be drawn around what data this owns?

List candidates: domain clusters that might become separate services/modules.

Step 3 — Evaluate Decomposition Options

For each candidate cluster, evaluate two options:

Option A — Inline (monolith / same module)

  • Cost: tight coupling, harder to scale independently
  • Benefit: simpler operations, no network boundary, easier local dev, no distributed transaction risk

Option B — Separate (service / module boundary)

  • Cost: coordination overhead, network latency, distributed failures, harder to develop locally
  • Benefit: independent deployment, fault isolation, independent scaling, clear ownership boundary

Apply the arch-drivers ranking: if a "Must satisfy" driver forces separation, the trade-off is decided. If no driver forces it, default to keeping things together — complexity is earned.

Step 4 — Propose System Diagram

Draw the system as a text-based diagram (Mermaid or ASCII). Include:

  • Named services/modules with their primary responsibility
  • Data flows between services (arrows with labels: what data flows, in which direction)
  • External systems and integration points (third-party APIs, databases, auth providers)
  • Trust boundaries (which services trust each other, which face the public)
System: {product name}
┌──────────────────────────────────────────────────────────┐
│ Public Boundary                                          │
│  ┌─────────────┐     ┌─────────────────────────────┐    │
│  │  Web/Mobile │────▶│      API Gateway / BFF      │    │
│  │  Client     │     └──────────────┬──────────────┘    │
│  └─────────────┘                   │                    │
│                         ┌──────────┼──────────┐         │
│                    ┌────▼────┐ ┌───▼────┐ ┌──▼────┐    │
│                    │ {svc A} │ │ {svc B}│ │{svc C}│    │
│                    └────┬────┘ └───┬────┘ └───────┘    │
│                         │         │                     │
│              ┌──────────▼─────────▼──────────┐          │
│              │           {Database}           │          │
│              └───────────────────────────────┘          │
└──────────────────────────────────────────────────────────┘

Adapt to actual system shape. Keep it honest — draw what you decided, not what looks impressive.

Step 5 — Document Boundary Decisions

For every boundary in the diagram, write a decision record:

Boundary: {A} ↔ {B}

  • Decision: [separated / co-located, and the specific boundary type: service / module / package]
  • Rationale: [which driver or domain reason forced this choice]
  • Trade-off accepted: [what you're paying for this boundary]
  • ADR required: [Yes — meets D27 three conditions | No — record inline]

For decisions that meet the D27 three-condition gate, write an ADR entry.

Step 6 — Write ADR Entries (D27)

For each boundary decision that qualifies (hard to reverse + surprising without context + real trade-off):

Save to docs/adr/000{N}-{slug}.md:

# {Short title}

{1–3 sentences: context, decision, why.}

**Considered:** {briefly name the rejected alternative and why it lost}
**Consequence:** {one non-obvious downstream effect}

Scan existing docs/adr/ for the highest existing number. Increment by one. Create directory if it does not exist.

Step 7 — Flag Architectural Risks

After decomposition, identify risks introduced by the chosen boundaries:

  • Distributed transaction risk: Writes that span service boundaries without a saga or outbox pattern
  • Circular dependency risk: Two services that call each other
  • Data consistency risk: Two services owning the same data concept
  • Operational complexity spike: A boundary that adds disproportionate deployment overhead relative to its benefit

Each risk: name it, severity (High / Medium / Low), and whether Phase 5 testing or Phase 6 implementation must address it.

Step 8 — Write Output

Save to _mh-output/cto/sdlc/system-decomp/{YYYY-MM-DD}_{r###}_system-diagram.md:

# System Decomposition

**Product:** {name}
**Date:** {date}

---

## System Diagram

{Mermaid or ASCII diagram}

## Services / Modules

| Name   | Responsibility    | Type                   | Owns           |
| ------ | ----------------- | ---------------------- | -------------- |
| {name} | {primary purpose} | service / module / pkg | {data it owns} |

## Boundary Decisions

{For each boundary — decision, rationale, trade-off, ADR reference if applicable}

## ADRs Written

{List of ADR files created, e.g. docs/adr/0001-monorepo.md}

## Architectural Risks

| Risk   | Severity         | Where Addressed         |
| ------ | ---------------- | ----------------------- |
| {risk} | High / Med / Low | Phase 5 / Phase 6 / ADR |

Step 9 — Present Summary

System Decomposition complete. {N} services/modules defined, {N} boundary decisions documented, {N} ADRs written.

Architecture shape: {one sentence describing the overall shape — e.g. "monolith with modular boundaries", "3-service split with shared DB", "event-driven microservices"}

Key trade-offs:

  • {Most important trade-off accepted}

Risks flagged: {N} architectural risks to address in Phase 5/6.

Next steps: Run /mh-cto-sdlc-data-arch and /mh-cto-sdlc-integration-design (can overlap).

04 同仓库更多 Skills

Imad-Oute
Imad-Oute/MicroHard

mh-vo-vault-brief

Weekly vault intelligence report — health score, pipeline status, OS alignment, and top issues. Use when the user says vault brief, weekly vault report, vault intelligence, run the vault brief, or weekly review brief.

★ 2
Imad-Oute
Imad-Oute/MicroHard

mh-vo-output-bridge

Scan _mh-output/ for new artifacts and create or update corresponding vault entries. Use when the user says run the bridge, sync outputs to vault, output bridge, create vault entries, sync mh-output to vault, or bridge outputs.

★ 2
Imad-Oute
Imad-Oute/MicroHard

mh-vo-moc-builder

Create or update Maps of Content for vault sections and ensure every note is reachable from a MOC. Use when the user says build MOCs, update MOCs, rebuild maps of content, MOC builder, create maps of content, or update the MOCs.

★ 2
Imad-Oute
Imad-Oute/MicroHard

mh-vo-link-architect

Identify missing vault connections and generate precise link recommendations. Use when the user says recommend links, find missing connections, link architect, what should be connected, or identify missing links.

★ 2
Imad-Oute
Imad-Oute/MicroHard

mh-vo-base-builder

Generate Obsidian Bases (.base files) for live database views of vault data. Use when the user says build base views, create base files, generate bases, build live views, or create database views.

★ 2
Imad-Oute
Imad-Oute/MicroHard

mh-vo-taxonomy-enforcer

Audit vault tags and frontmatter, find drift, and apply corrections. Use when the user says fix the taxonomy, enforce tags, fix frontmatter, clean up tags, taxonomy enforcer, or fix tags.

★ 2