AgentSkillsCN

architecture-c4-modeling

通过 C4 架构建模流程,生成上下文视图、容器视图与组件视图,以一致的方式传达系统结构。当需界定系统边界、模块间关系,以及架构层面的约束时,可选用此流程;但若仅对单个模块进行重构且不涉及架构层面的影响,则不宜使用。

SKILL.md
--- frontmatter
name: architecture-c4-modeling
description: "C4 architecture modeling workflow for producing context, container, and component views that communicate system structure consistently. Use when system boundaries, module relationships, and architecture-level constraints are being defined; do not use for single-module implementation refactors without architecture impact."

Architecture C4 Modeling

Trigger Boundary

  • Use when architecture communication artifacts are missing or outdated.
  • Do not use to decide architecture options; use architecture-tradeoff-analysis.
  • Do not use as decision history storage; use architecture-decision-records.

Goal

Produce accurate and traceable C4 views that align stakeholders on architecture.

Shared Architecture Contract (Canonical)

  • Use skills/architecture-principles/references/architecture-governance-contract.md as the only schema source.
  • Validate all IDs, lifecycle states, and gate rules against the canonical contract.
  • Do not define local ID formats or alternate state machines.

Compliance & Governance Baseline (US, Japan, EU)

  • Mark sensitive data flows and regulated boundaries in relevant diagrams.
  • Avoid exposing credentials or internal secrets in architecture artifacts.
  • Prepare an ARC-CMP-* evidence package for governance review.

Inputs

  • Current architecture and dependency information
  • Target audience and required abstraction level
  • Related ADRs and risks

Outputs

  • Updated C4 context, container, and component views
  • Relationship legend and assumptions list
  • Traceability links to ADRs and key risks

Workflow

  1. Build context view with external actors and systems.
  2. Build container view with runtime responsibilities.
  3. Build component view for high-complexity containers.
  4. Link diagrams to ADR and risk identifiers.
  5. Validate naming and relationship consistency.

Quality Gates

  • Diagram scope matches intended audience.
  • Names and relationships are consistent across views.
  • ARC-CMP-* evidence package is complete and approved.
  • Greenfield designs exclude fallback paths; brownfield rollback requires trigger and runbook.

Failure Handling

  • Stop when source architecture information is stale or conflicting.
  • Stop when canonical contract validation fails.
  • Escalate when critical boundaries cannot be represented clearly.