From citadel
Given a PRD, produces an implementation architecture: file tree, component breakdown, data model, and a phased build plan with end conditions that Archon can execute directly. Multi-candidate evaluation for key decisions.
How this skill is triggered — by the user, by Claude, or both
Slash command
/citadel:architectThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
/architect converts a PRD into a buildable plan. It decides HOW to implement
/architect converts a PRD into a buildable plan. It decides HOW to implement what the PRD describes. Its output is a campaign-ready architecture document that Archon reads and executes.
One of:
Greenfield mode: PRD exists with Mode: greenfield, or no existing source files.
Produces a complete architecture from scratch.
Feature mode: PRD exists with Mode: feature, OR the user describes a feature
and the project has existing source files. The architecture describes changes to
existing code, not a standalone system.
In feature mode:
If PRD exists, read it. Extract:
If no PRD, read the codebase instead:
For any architectural decision where multiple valid approaches exist:
This is based on AlphaCodium's finding that multi-candidate evaluation outperforms single-candidate refinement. Don't commit to the first idea.
Key decisions that warrant multi-candidate evaluation:
Simple decisions (file naming, folder structure, CSS approach) don't need this. Use the PRD's stack choices and move on.
Write to .planning/architecture-{slug}.md:
# Architecture: {App Name}
> PRD: .planning/prd-{slug}.md
> Date: {ISO date}
## File Tree
{Greenfield: The complete file tree of the finished v1. Every file listed.
Feature mode: ONLY new and modified files. Prefix modified files with ~.
Example: ~ src/routes/index.ts (modified), + src/auth/middleware.ts (new)}
## Component Breakdown
{For each core feature from the PRD:}
### Feature: {name}
- Files: {list of files this feature touches}
- Dependencies: {what must exist before this can be built}
- Complexity: {low/medium/high}
## Data Model
{If the app has a database:}
### {Entity name}
- Fields: {name: type}
- Relationships: {how it connects to other entities}
{If no database: skip this section}
## Key Decisions
{Architecture decisions that were evaluated:}
### {Decision}: {What was chosen}
- **Chosen**: {approach} — because {reasoning}
- **Rejected**: {alternative} — because {why not}
## Build Phases
{Ordered phases that Archon will execute. Each phase has:}
### Phase 1: {name}
- **Goal**: {one sentence}
- **Files**: {files created or modified}
- **Dependencies**: {what must exist first, or "none"}
- **End Conditions**:
- [ ] {machine-verifiable condition}
- [ ] {machine-verifiable condition}
### Phase 2: {name}
...
## Phase Dependency Graph
{Which phases depend on which. Simple text format:}
Phase 1 → Phase 2 → Phase 3
→ Phase 4 (parallel with 3)
Phase 3 + 4 → Phase 5
## Risk Register
{Top 3 things most likely to go wrong:}
1. {risk}: {mitigation}
2. {risk}: {mitigation}
3. {risk}: {mitigation}
## Deployment Strategy
{If the PRD specifies a deployment target. Skip if "deploy later" or static-only.}
- **Platform**: {from PRD Technical Decisions — see .planning/_templates/deploy/}
- **Method**: {deployment command}
- **Environment variables**: {list required env vars, reference .env.example}
- **Pre-deploy checks**: {typecheck, test, build all pass}
{The final build phase should be "Deploy" when a platform is specified:}
### Phase N (Final): Deploy
- **Goal**: Deploy the verified app to {platform}
- **Dependencies**: All previous phases complete and verified
- **End Conditions**:
- [ ] App deployed successfully (no build errors)
- [ ] Production URL accessible and returns expected content
{A failed deploy does NOT fail the campaign. The app works locally. Deploy is bonus.
If the user says "don't deploy" or "I'll deploy later", omit this phase entirely.}
Convert the architecture into a campaign-ready format:
Present the architecture summary to the user:
Ask: "Ready to build? This will create an Archon campaign."
If approved: write the campaign file using the architecture as the direction.
---HANDOFF---
- Architecture: {app name}
- Document: .planning/architecture-{slug}.md
- Phases: {count}
- Estimated complexity: {low/medium/high}
- Next: Archon campaign ready to execute
---
No PRD exists: Treat the user's description + the existing codebase as the spec. Read the file tree and package.json to infer context. Proceed without requiring a PRD — see "If no PRD" in Step 1.
Project already has code: Use feature mode. Read the existing architecture first. The file tree shows only new/modified files. Phase 0 must record the baseline typecheck and test state.
Vague description: If the user's description is too vague to produce verifiable end conditions, ask at most 2 clarifying questions before proceeding. Don't block on perfect clarity.
If .planning/ does not exist: Create it before writing the architecture document. If creation is not possible, present the architecture document inline and instruct the user to save it.
---HANDOFF---
- Architecture: {app name}
- Document: .planning/architecture-{slug}.md
- Phases: {count}
- Estimated complexity: {low/medium/high}
- Next: Archon campaign ready to execute
---
Scans a codebase for architectural friction, presents candidates as a visual HTML report with before/after diagrams, and guides you through deepening refactors.
npx claudepluginhub roseonlineownz-lab/citadel