From cpm
Facilitated architecture exploration. Takes a product brief as input, identifies key architectural decisions derived from the product, explores trade-offs per decision, captures dependencies between decisions, and produces Architecture Decision Records (ADRs). Triggers on "/cpm:architect".
How this skill is triggered — by the user, by Claude, or both
Slash command
/cpm:architectThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Explore architectural decisions through guided conversation. Each decision is derived from the product's actual needs — not boilerplate. The skill produces Architecture Decision Records (ADRs) that capture context, options, trade-offs, and rationale for each key decision.
Explore architectural decisions through guided conversation. Each decision is derived from the product's actual needs — not boilerplate. The skill produces Architecture Decision Records (ADRs) that capture context, options, trade-offs, and rationale for each key decision.
Check for input in this order:
$ARGUMENTS references a file path, read that file as the starting context.$ARGUMENTS contains a description, use that as the starting context.docs/briefs/:
a. Glob docs/briefs/[0-9]*-brief-*.md to find all product briefs.
b. If only one exists, ask the user if they want to use it.
c. If multiple exist, present them with AskUserQuestion — show each brief's title and date.
d. If none exist, fall back to problem briefs in docs/plans/:
docs/plans/[0-9]*-plan-*.md.Work through these phases one at a time. Complete each phase before moving to the next. Use AskUserQuestion for every gate — never dump multiple phases of questions at once.
State tracking: Before starting Phase 1, create the progress file (see State Management below). Each phase below ends with a mandatory progress file update — do not skip it. After saving the final ADRs, delete the file.
Before beginning Phase 1, check for recent retro files using Glob: docs/retros/[0-9]*-retro-*.md. If one or more retro files exist:
If no retro files exist, skip this check silently and proceed to the Library Check.
Follow the shared Roster Loading procedure (from the CPM Shared Skill Conventions loaded at session start). The roster is needed for Perspectives in Phase 2.
Follow the shared Library Check procedure with scope keyword architect. Deep-read selectively during exploration phases — especially architecture docs, infrastructure docs, or coding standards that constrain decisions.
After startup checks and before Phase 1, display the template hint:
Using default template. To customise, place your template at
docs/templates/architect.md.
If a project-level override exists at docs/templates/architect.md, read it and use that format for the output ADRs instead of the embedded default. Full replacement — no merging.
Before proposing any architecture, understand what already exists. If there's an existing codebase:
If there's no existing codebase (greenfield), note that and move on.
Also summarise the product context from the input (product brief or description) — the vision, key features, and constraints that will drive architectural decisions.
Confirm understanding with the user.
Update progress file now — write the full .cpm-progress-{session_id}.md with Phase 1 summary before continuing.
Analyse the product brief and codebase findings to identify the key architectural decisions that need to be made. Each decision should be derived from the product's actual needs — not generic boilerplate like "should we use microservices?"
For each decision, capture:
Present the decision list to the user with AskUserQuestion. Refine — they may add decisions you missed or remove ones that don't apply. Aim for 3-8 decisions for a typical product. Don't force decisions that aren't genuinely needed.
Anti-pattern: Decisions like "choose a database" or "pick a framework" without product-specific context are boilerplate. Instead: "How to handle booking availability with concurrent access" or "Where to run image processing given the latency requirements."
Perspectives: After identifying decisions, follow the shared Perspectives procedure. Select 2-3 agents from the loaded roster whose expertise is relevant — e.g. the Software Architect on missing structural decisions, the DevOps Engineer on operational concerns, or the Senior Developer on whether a decision is premature.
Update progress file now — write the full .cpm-progress-{session_id}.md with Phase 2 summary before continuing.
For each identified decision, explore options and trade-offs. This phase iterates — work through one decision at a time with the user.
For each decision:
Use AskUserQuestion after each decision to confirm the chosen option and rationale before moving to the next.
Update progress file now — write the full .cpm-progress-{session_id}.md after each decision is resolved.
Give operational concerns first-class treatment rather than treating them as an afterthought. Explore:
Not every concern applies to every product. Skip what's not relevant. The goal is to surface operational decisions that would otherwise be discovered late in implementation.
Present findings with AskUserQuestion. Some of these may produce additional ADRs; others are just context that informs existing decisions.
Perspectives: Have the DevOps engineer and QA engineer weigh in on operational concerns they see. Keep each perspective to 1-2 sentences. Format: {icon} **{name}**: {perspective}.
Update progress file now — write the full .cpm-progress-{session_id}.md with Phase 4 summary before continuing.
Present a summary of all decisions and their dependencies. Show how decisions relate to each other — which constrain others, which must be made first, which are independent.
If any circular dependencies or conflicts emerge, flag them and work through resolution with the user.
Use AskUserQuestion for confirmation before proceeding to output.
Update progress file now — write the full .cpm-progress-{session_id}.md with Phase 5 summary before continuing.
Generate one ADR per architectural decision. Present each ADR to the user for confirmation using AskUserQuestion before saving.
After all ADRs are saved, suggest next steps:
/cpm:spec to build requirements using these ADRs as architectural context/cpm:epics if a spec already exists and needs architectural alignmentSave each ADR to docs/architecture/{nn}-adr-{slug}.md in the current project.
{nn} is a zero-padded auto-incrementing number. Use the Glob tool to list existing docs/architecture/[0-9]*-adr-*.md files, find the highest number, and increment by 1. If none exist, start at 01.{slug} is a short kebab-case name derived from the decision (e.g., session-storage, image-processing-pipeline).Create the docs/architecture/ directory if it doesn't exist.
Use this format:
# ADR: {Decision Title}
**Date**: {today's date}
**Status**: Proposed
**Source**: {path to product brief or input used}
## Context
{Why this decision needs to be made. What product requirements, features, or constraints drive it. Reference specific aspects of the product brief.}
## Options Considered
### Option 1: {Name}
{Description of the approach}
**Trade-offs**:
- **Complexity**: {assessment}
- **Scalability**: {assessment}
- **Team capability**: {assessment}
- **Operational cost**: {assessment}
- **Time to market**: {assessment}
### Option 2: {Name}
{Description and trade-offs in same format}
## Decision
{Which option was chosen}
## Rationale
{Why this option was chosen over alternatives. What trade-offs were accepted and why.}
## Consequences
{What this decision means for the system. What it enables, what it constrains, what follow-on decisions it creates.}
## Dependencies
{Other ADRs this decision depends on or constrains. Use format: "Depends on ADR {nn}: {title}" or "Constrains ADR {nn}: {title}". Leave as "None" if independent.}
After saving each ADR, tell the user the document path.
If $ARGUMENTS is provided, use it as the starting context for Phase 1 instead of asking from scratch. Still confirm understanding with the user before proceeding.
Maintain docs/plans/.cpm-progress-{session_id}.md throughout the session for compaction resilience. This allows seamless continuation if context compaction fires mid-conversation.
Path resolution: All paths in this skill are relative to the current Claude Code session's working directory. When calling Write, Glob, Read, or any file tool, construct the absolute path by prepending the session's primary working directory. Never write to a different project's directory or reuse paths from other sessions.
Session ID: The {session_id} in the filename comes from CPM_SESSION_ID — a unique identifier for the current Claude Code session, injected into context by the CPM hooks on startup and after compaction. Use this value verbatim when constructing the progress file path. If CPM_SESSION_ID is not present in context (e.g. hooks not installed), fall back to .cpm-progress.md (no session suffix) for backwards compatibility.
Resume adoption: When a session is resumed (--resume) or context is cleared (/clear), CPM_SESSION_ID changes to a new value while the old progress file remains on disk. The hooks inject all existing progress files into context — if one matches this skill's **Skill**: field but has a different session ID in its filename, adopt it:
docs/plans/.cpm-progress-{current_session_id}.md with the same contents.rm docs/plans/.cpm-progress-{old_session_id}.md.
Do not attempt adoption if CPM_SESSION_ID is absent from context — the fallback path handles that case.Create the file before starting Phase 1 (ensure docs/plans/ exists). Update it after each phase completes. Delete it only after the final ADRs have been saved and confirmed written — never before. If compaction fires between deletion and a pending write, all session state is lost.
Also delete docs/plans/.cpm-compact-summary-{session_id}.md if it exists — this companion file is written by the PostCompact hook and should be cleaned up alongside the progress file.
Use the Write tool to write the full file each time (not Edit — the file is replaced wholesale). Format:
# CPM Session State
**Skill**: cpm:architect
**Phase**: {N} of 6 — {Phase Name}
**Output target**: docs/architecture/{nn}-adr-{slug}.md (one per decision)
## Completed Phases
### Phase 1: Context & Codebase Exploration
{Concise summary — existing stack, patterns found, product context}
### Phase 2: Identify Architectural Decisions
{List of decisions identified — label and driving requirement for each}
### Phase 3: Explore Trade-offs
{Per-decision summary — chosen option, key trade-off accepted, dependencies noted}
### Phase 4: Operational Architecture
{Operational concerns explored, any additional ADRs identified}
### Phase 5: Decision Dependencies
{Dependency map summary — which decisions constrain others}
{...include only completed phases...}
## Next Action
{What to ask or do next in the facilitation}
The "Completed Phases" section grows as phases complete. Each summary should capture the user's key decisions in 2-4 sentences — enough for seamless continuation, not a transcript.
The "Next Action" field tells the post-compaction context exactly where to pick up.
Provides UI/UX resources: 50+ styles, color palettes, font pairings, guidelines, charts for web/mobile across React, Next.js, Vue, Svelte, Tailwind, React Native, Flutter. Aids planning, building, reviewing interfaces.
Fetches up-to-date documentation from Context7 for libraries and frameworks like React, Next.js, Prisma. Use for setup questions, API references, and code examples.
npx claudepluginhub ninthspace/claude-code-marketplace --plugin cpm