This skill should be used when the user asks to "design the target architecture", "propose the to-be state", "create an architecture proposal", "plan the future architecture", "define the end-state system", or needs to produce a target architecture that addresses identified gaps and risks from a brownfield codebase analysis.
From pm-architect-brownfieldnpx claudepluginhub nbkm8y5/claude-plugins --plugin pm-architect-brownfieldThis skill uses the workspace's default tool permissions.
Guides Next.js Cache Components and Partial Prerendering (PPR) with cacheComponents enabled. Implements 'use cache', cacheLife(), cacheTag(), revalidateTag(), static/dynamic optimization, and cache debugging.
Migrates code, prompts, and API calls from Claude Sonnet 4.0/4.5 or Opus 4.1 to Opus 4.5, updating model strings on Anthropic, AWS, GCP, Azure platforms.
Details PluginEval's skill quality evaluation: 3 layers (static, LLM judge), 10 dimensions, rubrics, formulas, anti-patterns, badges. Use to interpret scores, improve triggering, calibrate thresholds.
Design a target (to-be) architecture that systematically addresses every gap and risk identified in the gap analysis while preserving the working parts of the existing system. This skill produces an evidence-backed architecture proposal with migration deltas, technology decisions, component diagrams, and interface contracts.
[ARCH_GAPS_AND_RISKS.md + AS_IS_SYSTEM_MODEL.md + Codebase] --> **TARGET ARCHITECTURE** --> [TO_BE_ARCHITECTURE.md] --> Migration Strategy --> ...
Input: ARCH_GAPS_AND_RISKS.md, AS_IS_SYSTEM_MODEL.md, actual codebase (for verification)
Output: TO_BE_ARCHITECTURE.md written to artifacts directory
The output artifact follows the standard artifact template:
# [ARTIFACT TITLE]
## Summary
## Inputs
## Outputs
## Assumptions
## Open Questions
## Main Content
## Acceptance Criteria
ARCH_GAPS_AND_RISKS.md to understand:
AS_IS_SYSTEM_MODEL.md to understand:
Establish guiding principles for the target architecture design.
Extract principles from gap analysis: Each category of gaps implies a principle
Assign PRINC-NNNN IDs: Sort alphabetically by principle title, assign sequentially
Principle format:
### PRINC-0001: [Title]
- **Category**: Architecture | Security | Performance | Maintainability | Reliability | Observability
- **Statement**: [One-sentence principle]
- **Rationale**: [Why this principle matters, citing gaps that motivate it]
- **Addresses**: [GAP-NNNN, RISK-NNNN list]
Define the desired component structure.
Retain components that work well (no associated gaps/risks or only P2 issues)
Refactor components that have P1 gaps (improve but preserve)
Replace components that have P0 gaps or critical risks (redesign)
Add new components that are missing from the as-is state (e.g., missing middleware layer, missing caching layer)
For each target component, record:
### TCOMP-0001: [Name]
- **Origin**: Retained from COMP-NNNN | Refactored from COMP-NNNN | New
- **Type**: Service | Library | Module | Package | Worker | CLI | UI | Middleware | Gateway
- **Responsibility**: [Single-sentence description of what this component does]
- **Interfaces**:
- **Inbound**: [What it accepts and from whom]
- **Outbound**: [What it produces and for whom]
- **Technology**: [Language, framework, key libraries]
- **Addresses**: [GAP-NNNN, RISK-NNNN list that this component resolves]
- **Design Notes**: [Key design decisions for this component]
Create a comprehensive comparison of as-is vs to-be states.
| AS-IS (COMP) | TO-BE (TCOMP) | Change Type | Rationale | Gaps Addressed |
|-------------|--------------|-------------|-----------|----------------|
| COMP-0001: API Server | TCOMP-0002: API Gateway | Refactor | Add middleware layer, rate limiting | GAP-0003, GAP-0007 |
| COMP-0003: DB Direct | TCOMP-0004: Data Access Layer | Replace | Abstract database access, add repository pattern | GAP-0001, RISK-0002 |
| (none) | TCOMP-0005: Cache Layer | Add | No caching exists; needed for performance | GAP-0012 |
| COMP-0006: Legacy Auth | (removed) | Remove | Replaced by TCOMP-0003 | GAP-0005, RISK-0001 |
Document technology choices with alternatives considered.
### TDEC-0001: [Decision Title]
- **Category**: Language | Framework | Database | Infrastructure | Library | Pattern
- **Decision**: [What was chosen]
- **Alternatives Considered**:
| Alternative | Pros | Cons | Rejected Because |
|------------|------|------|-----------------|
| [Option A] | [Pros] | [Cons] | [Reason] |
| [Option B] | [Pros] | [Cons] | [Reason] |
- **Rationale**: [Why this choice best addresses the gaps/risks]
- **Trade-offs**: [What this decision gives up]
- **Addresses**: [GAP-NNNN, RISK-NNNN list]
- **Constraints**: [CON-NNNN from review brief that influenced this decision]
- **Reversibility**: High | Medium | Low
Assign TDEC-NNNN IDs: Sort alphabetically by decision title, assign sequentially
Decision criteria:
Specify the interfaces between target components.
### IFACE-0001: [Component A] -> [Component B]
- **Protocol**: HTTP/REST | gRPC | Message Queue | Function Call | Event Bus
- **Data Format**: JSON | Protobuf | Avro | Plain Text
- **Authentication**: [How the caller authenticates]
- **Key Operations**:
| Operation | Method/Action | Input | Output | Error Cases |
|-----------|--------------|-------|--------|-------------|
| Create User | POST /users | UserCreateDTO | UserResponseDTO | 400, 409, 500 |
- **SLA**: [Latency, throughput, availability expectations]
- **Contract Evolution**: [Versioning strategy]
Assign IFACE-NNNN IDs: Sort by source component TCOMP ID, then by target component TCOMP ID
Data format specifications:
Produce Mermaid diagrams showing the target state.
```mermaid
graph TD
subgraph External
Client[Client Applications]
ExtAPI[External APIs]
end
subgraph Target System
GW[TCOMP-0001: API Gateway]
Auth[TCOMP-0002: Auth Service]
Core[TCOMP-0003: Core Service]
Data[TCOMP-0004: Data Layer]
Cache[TCOMP-0005: Cache]
Queue[TCOMP-0006: Message Queue]
Worker[TCOMP-0007: Worker]
end
subgraph Data Stores
DB[(Database)]
ObjStore[(Object Storage)]
end
Client --> GW
GW --> Auth
GW --> Core
Core --> Data
Core --> Cache
Core --> Queue
Queue --> Worker
Data --> DB
Worker --> ObjStore
Core --> ExtAPI
2. **Data Flow Diagram** (for primary path):
```markdown
```mermaid
flowchart LR
Request -->|HTTPS| Gateway
Gateway -->|Validate| Auth
Auth -->|Token| Gateway
Gateway -->|Route| Service
Service -->|Check| Cache
Cache -.->|Miss| DB[(Database)]
Service -->|Response| Gateway
Gateway -->|HTTPS| Response
3. **Deployment Diagram** (if infrastructure changes proposed):
- Container/pod layout
- Network boundaries
- Load balancer placement
### Step 8: Map Gap/Risk Resolution
Create an explicit mapping showing how each gap and risk is addressed.
1. **Resolution table**:
```markdown
| Gap/Risk ID | Title | Resolution Strategy | Target Component | Status |
|------------|-------|-------------------|-----------------|--------|
| GAP-0001 | Missing data abstraction | TCOMP-0004 introduces repository pattern | TCOMP-0004 | Resolved |
| GAP-0005 | Hardcoded secrets | TCOMP-0002 + vault integration | TCOMP-0002 | Resolved |
| RISK-0003 | Database single point of failure | Accepted risk with monitoring | N/A | Accepted |
Resolution statuses:
Verify completeness: Every GAP-NNNN and RISK-NNNN from the gap analysis must appear in this table
Assemble all findings into the final artifact.
TO_BE_ARCHITECTURE.md following the template# Target Architecture: [Project Name]
## Summary
[3-5 sentence overview: architecture vision, key changes from as-is, number of components, major technology decisions]
## Inputs
- ARCH_GAPS_AND_RISKS.md
- AS_IS_SYSTEM_MODEL.md
- Codebase at: [path]
## Outputs
- TO_BE_ARCHITECTURE.md (this document)
## Assumptions
- [ASM-NNNN]: [Assumption with rationale]
## Open Questions
- [OQ-NNNN]: [Architecture questions requiring stakeholder input]
## Main Content
### Architecture Principles
[PRINC-NNNN entries]
### Target Component Architecture
[TCOMP-NNNN entries with full detail]
#### Component Diagram
```mermaid
[Target component diagram]
| AS-IS | TO-BE | Change Type | Rationale | Gaps Addressed |
|---|
[TDEC-NNNN entries with alternatives]
[IFACE-NNNN entries with operation tables]
[Target data flow diagram]
| ID | Title | Strategy | Target Component | Status |
|---|
[Items with status Accepted or Deferred, with rationale]
**Output path**: `artifacts/brownfield/<project_name>/TO_BE_ARCHITECTURE.md`
**Template**: `${CLAUDE_PLUGIN_ROOT}/reference/templates/TO_BE_ARCHITECTURE.template.md`
## Determinism Rules
These rules ensure reproducible output regardless of when or how many times the skill is invoked on the same inputs.
1. **TCOMP-NNNN IDs**: Sort all target components alphabetically by name (case-insensitive), assign sequentially starting at 0001
2. **PRINC-NNNN IDs**: Sort all principles alphabetically by title, assign sequentially starting at 0001
3. **TDEC-NNNN IDs**: Sort all technology decisions alphabetically by title, assign sequentially starting at 0001
4. **IFACE-NNNN IDs**: Sort by source TCOMP ID, then by target TCOMP ID, assign sequentially starting at 0001
5. **Migration delta rows**: Sort by AS-IS COMP-NNNN ID numerically; new components (Add) sorted alphabetically at the end
6. **Resolution map rows**: Sort by Gap/Risk ID (GAP first, then RISK, numerically within each)
7. **Alternatives table rows**: Sort alphabetically by alternative name
8. **Sections**: Always in template order, never reordered
9. **No timestamps**: Do not include generation timestamps in artifact body
10. **Diagram node IDs**: Use TCOMP-NNNN as node identifiers in Mermaid diagrams
## Evidence Citation Rules
Target architecture claims reference both upstream artifacts and codebase evidence.
**Format for upstream references**: `[ARTIFACT_NAME: ID]` (e.g., `[ARCH_GAPS: GAP-0003]`, `[AS_IS: COMP-0001]`)
**Format for codebase references**: `> Claim text [relative/path/to/file.ext:line_number]`
**Examples**:
```markdown
> Current API handler lacks input validation, motivating the Gateway component [src/routes/api.ts:15-30]
> This decision addresses the missing abstraction layer identified in [ARCH_GAPS: GAP-0001]
> The existing authentication module will be retained and enhanced [AS_IS: COMP-0002]
Rules:
Before finalizing the artifact, verify: