From sd0x-dev-flow
Generates 3-architecture.md with component diagrams, data flows, integration points, and architecture decisions from tech-spec or code. For designing and documenting system architecture.
npx claudepluginhub sd0xdev/sd0x-dev-flow --plugin sd0x-dev-flowThis skill is limited to using the following tools:
- Keywords: architecture, architecture design, architecture doc, component diagram, 3-architecture, system design, document architecture
Documents system architecture with component diagrams, data flows, ADRs, deployment views, and templates. Analyzes patterns and maintains living docs for team communication.
Advanced — End-to-end architectural design flow: ADR → spec → plan. Best for significant technical decisions that require a formal specification and an implementation plan. For a decision without a spec, use /archcore:decide. For codifying standards, use /archcore:standard-track.
Translates PRDs into system architecture via interactive workflow: loads product specs.md, iterates decisions with options/discussion, outputs documented architecture.md. Handles Groundwork monorepos.
Share bugs, ideas, or general feedback.
/tech-spec)/feature-dev)/codex-architect)/deep-analyze)/architecture # Auto-detect feature, create/update
/architecture <feature-keyword> # Specify feature
/architecture --skip-debate # Skip Phase 3 adversarial debate
sequenceDiagram
participant U as User
participant C as Claude
participant E as Explore Agent
participant X as Codex
participant D as Architecture Designer
participant B as /codex-brainstorm
C->>C: Phase 0: Context Resolution
par Phase 1: Research
C->>E: Track A: Code pattern analysis (background)
C->>C: Track B: Read tech-spec (inline)
end
E-->>C: Component list + dependencies
C->>X: Track C: Architecture advice
X-->>C: Independent recommendations
C->>D: Phase 2: Architecture Design
D-->>C: Component + flow + decisions
C->>B: Phase 3: Verification (debate)
B-->>C: Equilibrium conclusion
C->>C: Phase 4: Write 3-architecture.md
C->>U: Auto-trigger /codex-review-doc
Detect the target feature using the 5-level cascade.
See @skills/tech-spec/references/feature-context-resolution.md for the full algorithm.
node scripts/resolve-feature-cli.js 2>/dev/null || echo '{}'
| State | Mode |
|---|---|
3-architecture.md exists | Update (incremental) |
3-architecture.md absent + 2-tech-spec.md exists | Create (tech-spec-informed) |
3-architecture.md absent + no tech-spec | Create (code-only research) |
| Feature not resolved | Gate: Need Human |
For small features (tech-spec WBS has only 1 task, or no tech-spec and < 3 related files), suggest keeping architecture in tech-spec Section 3 instead of creating a separate document. Use AskUserQuestion to confirm.
Launch research tracks. Tracks A and B run in parallel; Track C runs after both complete.
Agent({
description: "Analyze architecture patterns for <feature>",
subagent_type: "Explore",
run_in_background: true,
prompt: "Analyze the codebase architecture for feature <key>:
1. Trace execution paths of related modules
2. Map component dependencies (imports, calls)
3. Identify integration points with other features
4. Read docs/architecture.md for global context
Output: component list + dependency graph + integration points"
})
Fallback: subagent_type: "general-purpose" if Explore unavailable.
If 2-tech-spec.md exists:
If no tech-spec: skip (code-only mode).
mcp__codex__codex({
prompt: <from references/codex-prompt.md>,
sandbox: 'read-only',
'approval-policy': 'never',
})
Provide feature context metadata only — never feed Claude's conclusions (per @rules/codex-invocation.md).
Save threadId for potential follow-up.
Graceful degradation: Codex unavailable → proceed without (warn in output).
Dispatch architecture-designer agent with merged research results:
Agent({
description: "Design architecture for <feature>",
subagent_type: "architecture-designer",
prompt: `Design the architecture for <feature>.
## Input Context
${TECH_SPEC_SUMMARY}
${CODE_ANALYSIS}
${CODEX_ADVICE}
## Required Output
Follow the output template at @skills/architecture/references/template.md:
1. Component diagram (Mermaid flowchart)
2. Component responsibility table
3. Data flow (Mermaid sequence diagram)
4. Integration points with existing systems
5. Architecture decisions (AD-N: context → options → decision → rationale)
6. Deployment considerations (if applicable)
## Constraints
- Follow @rules/docs-writing.md conventions
- Reference actual code (file:line, not invented)
- Mark assumptions explicitly
- Redact credentials/secrets per @rules/security.md`
})
Fallback: if architecture-designer agent unavailable, use solution-architect agent.
Invoke /codex-brainstorm via Skill tool:
Skill("codex-brainstorm", `Evaluate the proposed architecture for <feature>.
Focus: scalability, maintainability, integration complexity, testability.
Constraints:
- Component diagram from Phase 2
- Tech-spec constraints from Phase 1
- Known risks`)
Must produce: threadId + equilibrium conclusion.
| Condition | Action |
|---|---|
--skip-debate flag | Skip Phase 3 |
| Scope gate triggered (small feature) | Skip Phase 3 |
| Update mode (incremental change) | Skip Phase 3 |
Graceful degradation: /codex-brainstorm timeout → record timeout in Verification section, still output document.
Write docs/features/<key>/3-architecture.md using the output template.
See references/template.md for the full template.
Auto-insert links:
> **Source**: [Tech Spec](./2-tech-spec.md) (if exists)> **Request**: [Request](./requests/YYYY-MM-DD-*.md) (if active request found)After Write completes, auto-trigger /codex-review-doc per @rules/auto-loop.md.
| Argument | Default | Description |
|---|---|---|
<feature-keyword> | auto-detect | Target feature |
--skip-debate | false | Skip Phase 3 adversarial debate |
/codex-review-doc passed (auto-triggered)git add/commit/push executedreferences/template.md — Output template for 3-architecture.mdreferences/codex-prompt.md — Codex independent architecture research prompt@skills/tech-spec/references/feature-context-resolution.md — 5-level feature detectionInput: /architecture
Action: Auto-detect feature → research (code + spec + Codex) → design → debate → write 3-architecture.md → /codex-review-doc
Input: /architecture statusline-config
Action: Resolve "statusline-config" → read tech-spec → research code → design → write → review
Input: /architecture --skip-debate
Action: Auto-detect → research → design → skip debate → write → review