Plan and document system-level architecture from requirement documents for MVP delivery. Use when a user asks Archi to produce architecture outputs (e.g., ARCH-*.md) with C4 context, deployment topology, NFR strategy, cost/complexity tradeoffs, and explicit software-delivery (SD) handoff boundaries.
Produce a system-level architecture document that is decision-ready for SD and PG. The architecture must explain how the system is controlled, operated, traced, secured, and evolved across the selected environment profiles. Do not treat observability as a single checklist item; make each operational control an explicit architecture decision or an explicit deferred decision.
This skill is self-contained. Do not depend on role-agent configuration files
or require any file under .codex/agents/ as an input.
Read, when present:
README.mdAGENTS.mddocs/scenarios/docs/workflows/docs/requirements/Identify the target domain and sequence, the business scope, in-scope and out-of-scope capabilities, users and external systems, data boundaries, and the environments requested. If a workflow state or requirement artifact is missing, report that as a readiness issue rather than silently inventing it.
Before finalizing architecture decisions, inspect whether the requirement
answers the following questions. Mark every answer as Confirmed, Assumed,
TBD, or Not applicable.
| Decision area | Minimum information required | | --- | --- | | Environment | Which environment profiles are in scope; purpose, isolation, data, deployment and release expectations of each | | Users and access | Human/service actors, authentication source, roles, least-privilege expectations, privileged/admin access, and trust boundaries | | Data protection | Data classification, secrets/PII, encryption requirements, residency, retention, deletion, and audit obligations | | Availability | Business criticality, SLO/SLA, maintenance tolerance, failure impact, RTO, RPO, backup and disaster-recovery expectations | | Load and efficiency | Normal/peak traffic, concurrency, growth, latency target, throughput, large payloads, and likely bottlenecks | | Consistency and cache | Freshness tolerance, consistency requirement, cacheable data, invalidation owner, and acceptable stale/failure behavior | | Dependencies | External services, dependency SLA, timeout/retry/rate-limit expectations, sandbox/mock policy, and dependency failure behavior | | Operations | Metrics, logs, traces, audit events, retention, dashboard consumers, alert owners, escalation path, and runbook expectations | | Delivery and cost | Hosting/region constraints, budget, release frequency, rollback strategy, migration/cutover, and support/on-call model |
If material information is missing, interview the user with Socratic, decision-oriented questions before completing the architecture. Start with the fewest questions that remove the highest-risk ambiguity. For each question, state why the answer changes the architecture and offer concrete answer examples where helpful. Prefer questions such as:
test intended for
functional/regression testing, while SIT is reserved for system
integration? Is POC a temporary feasibility exercise or a maintained
environment?Do not silently choose critical security, availability, compliance, data-loss, or operational assumptions. If the user authorizes assumptions, record each one with its rationale, impact if wrong, confidence, owner, and validation point. Block a final architecture when a missing answer would materially change access control, environment isolation, availability/DR, data handling, or operating responsibility. A clearly labelled preliminary option may be provided while waiting for those answers.
Use the canonical profile definitions in the architecture template, section 1.1 標準環境 profile 對應表. Keep that table as the unique source of standard profile meaning; do not copy or redefine it in this skill or another support file.
Separate the environment name from its purpose. Select only the profiles justified by the requirement, following the purpose, lifecycle, and promotion rules in the canonical table. Do not make every project create every profile.
Create a project environment matrix with one row for every actual environment, mapping its name to one profile from the canonical table. If a profile is out of scope, say so and explain the promotion path or future trigger. Do not copy PROD topology into lower environments without a reason.
For each selected profile and actual environment, decide at system level:
Keep the deployment matrix focused on deployment-specific differences. Put the detailed security, data protection, recovery, logging, tracing, monitoring, and alerting decisions in the corresponding NFR sections, and reference those sections from the deployment matrix instead of repeating the same content.
At minimum, prevent production data and production credentials from leaking into any non-PROD environment. Keep identities, secrets, telemetry access, and destructive operations isolated by environment. Apply the purpose, data, availability, dependency, observability, and promotion expectations from the canonical profile table, then document any project-specific deviation. PROD must satisfy the agreed SLO, resilience, security, backup, and operational ownership. These are defaults, not substitutes for user confirmation.
Use the smallest architecture that satisfies the confirmed requirements. Cover all of the following:
For every material technology choice, record the selected technology and
version, version-pinning and upgrade policy, alternatives considered, reason,
NFR impact, operational cost, licensing, and ownership. For this repository's
Java backend baseline, explicitly address Java/Spring, Maven Wrapper and
pom.xml, the OpenAPI Generator Maven plugin, persistence, Liquibase formatted
SQL migrations, and MQ only when messaging is in scope.
The architecture must require a pinned OpenAPI Generator Maven plugin version and a separately versioned OpenAPI contract. Generated API code is committed to Git and is never manually edited. Database migration policy is Liquibase formatted SQL only; Liquibase XML changelogs are not an option. These are technology and governance decisions, not API schema or migration SQL design.
Explicitly choose the smallest suitable application architecture and record the complexity signals behind the choice:
controller, service, dao;MQ alone does not require a large redesign when it is only a trivial side effect. Document dependency direction and integration boundaries at a level BE can implement, but do not define internal package layouts, API fields, schema, or transaction steps. When comparing styles, use the reference projects as evidence rather than copying an entire project's stack.
The document must have an explicit decision, requirement reference, or user-confirmed deferral for each control below. A generic statement such as “enable monitoring” is insufficient.
Define the system-level approach for human and service identity, authentication, authorization (RBAC/ABAC as appropriate), least privilege, tenant/environment isolation, network boundaries, secrets and key ownership, privileged/admin access, break-glass access, and deny-by-default behavior. State where policy is enforced and how access changes are reviewed and revoked. Do not prescribe API fields or implementation code.
Define propagation of correlation/request and distributed trace identifiers across system boundaries. Define which security and business actions are audited, including actor/service identity, target, action, timestamp, outcome, reason or source, and environment. Decide storage, immutability/tamper resistance, access, retention, privacy, clock synchronization, and how an event can be linked back to a requirement or incident.
Define structured centralized logs, minimum event categories, severity, timestamp and correlation fields, collection path, retention, search/access control, redaction of secrets/PII, sampling, clock standards, and behavior when the logging pipeline is unavailable. Distinguish operational logs from audit records; neither should expose credentials or unnecessary sensitive payloads.
Map business criticality to availability target, RTO, and RPO. Decide the required failure domains, redundancy, health/readiness checks, failover, timeouts, retry/backoff, rate limiting, graceful degradation, dependency isolation, backup/restore, disaster recovery, maintenance, and recovery test frequency. State explicitly when a lower-tier profile intentionally has weaker HA and what must be proven before PROD.
Define latency/throughput objectives and the system-level bottleneck strategy. Use caching only when justified by the requirement. For each cache decision, state data eligibility, scope, TTL/freshness, invalidation or versioning, consistency trade-off, stampede/poisoning protection, sensitive-data policy, capacity/eviction, behavior on cache outage, and cache hit/miss metrics. If no cache is needed, record why and what measurement would trigger one.
Define the telemetry model across metrics, logs, traces, audit events, and synthetic/dependency checks. At minimum cover traffic, latency, errors, saturation, availability/SLO, dependency health, queue/storage capacity, cache behavior when used, security signals, and key business outcomes. Define dashboards by audience, alert condition and severity, owner, routing, on-call hours, escalation, deduplication/noise control, runbook link, and expected response. Prefer SLO/burn-rate or impact-based alerts over arbitrary CPU-only alerts.
Use references/architecture-template.md as the base skeleton. The document must include:
docs/architecture/ARCH-<DOMAIN>-<SEQ>.md;Keep deliverables under docs/ only. Do not output:
If one of these is required, state the system-level constraint and list it in
移交 SD 項目(Archi 不定稿); do not finalize the low-level design.
Run this quality gate and record Pass, Fail, TBD, or N/A with evidence:
If a gate is Fail or a critical item is TBD, do not report the architecture
as complete. Report the blocker and the exact user decision needed.
For scenario-driven delivery, update the existing
docs/workflows/WF-<DOMAIN>-<NNN>.md after the architecture action. Record the
latest S2 Archi status, summary, output path, open questions, blockers or safe
assumptions, the next recommended S3 SD action, and the files the next session
must read first. Do not advance the workflow to SD when the readiness gate or
quality gate is blocked. If the workflow state is missing, use the repository's
workflow-state template only when creating the state is part of the authorized
workflow; otherwise report the missing handoff artifact as a blocker.
When complete, report:
Use references/architecture-template.md as the canonical output skeleton. Use references/architecture-reference-projects.md only when comparing Clean and Hexagonal Architecture options.
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer