plugins/cc10x/skills/architecture-patterns/SKILL.md
Internal skill. Use cc10x-router for all development tasks.
npx skillsauth add romiluz13/cc10x architecture-patternsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Architecture exists to support functionality. Every architectural decision should trace back to a functionality requirement.
Core principle: Design architecture FROM functionality, not TO functionality.
This skill is advisory in v10. It frames decisions and tradeoffs; it does not outrank explicit user requirements, repo standards, or an approved plan/design doc.
NO ARCHITECTURE DESIGN BEFORE FUNCTIONALITY FLOWS ARE MAPPED
If you haven't documented user flows, admin flows, and system flows, you cannot design architecture.
First, determine what kind of architectural work is needed:
| Request Type | Route To | |--------------|----------| | "Design API endpoints" | API Design section | | "Plan system architecture" | Full Architecture Design | | "Design data models" | Data Model section | | "Plan integrations" | Integration Patterns section | | "Make decisions" | Decision Framework section |
ALWAYS answer before designing:
Before any architecture:
User Flow (example):
1. User opens upload page
2. User selects file
3. System validates file type/size
4. System uploads to storage
5. System shows success message
Admin Flow (example):
1. Admin opens dashboard
2. Admin views all uploads
3. Admin can delete uploads
4. System logs admin action
System Flow (example):
1. Request received at API
2. Auth middleware validates token
3. Service processes request
4. Database stores data
5. Response returned
Each flow maps to components:
| Flow Step | Architecture Component | |-----------|----------------------| | User opens page | Frontend route + component | | User submits data | API endpoint | | System validates | Validation service | | System processes | Business logic service | | System stores | Database + repository | | System integrates | External client/adapter |
For each component, define:
┌─────────────────────────────────────────────┐
│ SYSTEM │
│ ┌─────────┐ ┌─────────┐ ┌─────────┐ │
│ │ Web │ │ API │ │Database │ │
│ │ App │──│ Service │──│ │ │
│ └─────────┘ └─────────┘ └─────────┘ │
└─────────────────────────────────────────────┘
│ │ │
┌──┴──┐ ┌──┴──┐ ┌──┴──┐
│User │ │Admin│ │ Ext │
└─────┘ └─────┘ └─────┘
Use LSP to map actual code dependencies:
| Architecture Task | LSP Tool | Output |
|-------------------|----------|--------|
| Map component dependencies | lspCallHierarchy(outgoing) | What each component uses |
| Find all consumers of a service | lspCallHierarchy(incoming) | Impact analysis |
| Verify interface implementations | lspFindReferences | All implementers |
| Trace data flow | Chain lspCallHierarchy calls | Full flow map |
Mapping Actual Architecture:
1. localSearchCode("ServiceName") → find entry points
2. lspCallHierarchy(outgoing) → map dependencies
3. For each dependency: repeat step 2
4. Build dependency graph from results
Use LSP BEFORE drawing architecture diagrams - verify assumptions with code.
CRITICAL: Always get lineHint from localSearchCode first. Never guess line numbers.
Map user flows to endpoints:
User Flow: Upload file
→ POST /api/files
Request: { file: binary, metadata: {...} }
Response: { id: string, url: string }
Errors: 400 (invalid), 413 (too large), 500 (storage failed)
User Flow: View file
→ GET /api/files/:id
Response: { id, url, metadata, createdAt }
Errors: 404 (not found), 403 (not authorized)
Admin Flow: Delete file
→ DELETE /api/files/:id
Response: { success: true }
Errors: 404, 403
API Design Checklist:
Map integration requirements to patterns:
| Requirement | Pattern | |-------------|---------| | Flaky external service | Retry with exponential backoff | | Slow external service | Circuit breaker + timeout | | Async processing needed | Message queue | | Real-time updates needed | WebSocket/SSE | | Data sync needed | Event sourcing |
For each integration:
### [Integration Name]
**Functionality**: What user flow depends on this?
**Pattern**: [Retry/Circuit breaker/Queue/etc]
**Error handling**: What happens when it fails?
**Fallback**: What's the degraded experience?
Before choosing a pattern, classify the dependency:
| Category | Examples | Testing Strategy | |----------|----------|-----------------| | In-process | Pure computation, in-memory state | Test directly — merge modules and verify | | Local-substitutable | Database (PGLite), filesystem (in-memory FS) | Test with local stand-in in test suite | | Remote but owned | Your own microservices, internal APIs | Define port (interface), inject transport. Test with in-memory adapter | | True external | Stripe, Twilio, third-party APIs | Mock at boundary. Inject dependency as port |
The category determines the pattern. In-process needs nothing. True external needs mocks. The middle two need ports and adapters.
Implementation ordering — build from leaves inward:
Level 0 (no deps): [Pure utils] [Config]
↓
Level 1 (Level 0 only): [Repositories] [External clients]
↓
Level 2 (Level 0-1): [Services]
↓
Level 3 (Level 0-2): [Controllers] [API routes]
Level 0 components are testable immediately. Each subsequent level depends only on predecessors. This ordering eliminates mock-heavy tests in early phases and matches the planner's DAG constraint (phases depend only on predecessors, never on future phases).
For each component, define:
| Aspect | Questions | |--------|-----------| | Logging | What events? What level? Structured format? | | Metrics | What to measure? Counters, gauges, histograms? | | Alerts | What thresholds? Who gets notified? | | Tracing | Span boundaries? Correlation IDs? |
Minimum observability:
For each architectural decision:
### Decision: [Title]
**Context**: What functionality requirement drives this?
**Options**:
1. [Option A] - [Brief description]
2. [Option B] - [Brief description]
3. [Option C] - [Brief description]
**Trade-offs**:
| Criterion | Option A | Option B | Option C |
|-----------|----------|----------|----------|
| Performance | Good | Better | Best |
| Complexity | Low | Medium | High |
| Cost | Low | Medium | High |
**Decision**: [Option chosen]
**Rationale**: [Why this option best supports functionality]
If you find yourself:
STOP. Go back to functionality flows.
Approach for backend architecture:
Architecture Output Checklist:
Always provide concrete examples. Focus on practical implementation over theory.
| Excuse | Reality | |--------|---------| | "This pattern is industry standard" | Does it support THIS functionality? | | "We might need it later" | YAGNI. Design for now. | | "Microservices are better" | For this functionality? Justify it. | | "Everyone uses this" | That's not a trade-off analysis. | | "It's more flexible" | Flexibility without need = complexity. |
# Architecture Design: [Feature/System Name]
## Functionality Summary
[What this architecture supports - trace to user value]
## Flows Mapped
### User Flows
1. [Flow 1 steps]
2. [Flow 2 steps]
### System Flows
1. [Flow 1 steps]
2. [Flow 2 steps]
## Architecture
### System Context
[Diagram or description of actors and system boundaries]
### Components
| Component | Purpose (Functionality) | Dependencies |
|-----------|------------------------|--------------|
| [Name] | [What flow it supports] | [What it needs] |
### API Endpoints
| Endpoint | Flow | Request | Response |
|----------|------|---------|----------|
| POST /api/x | User uploads | {...} | {...} |
## Key Decisions
### Decision 1: [Title]
- Context: [Functionality driver]
- Options: [List]
- Trade-offs: [Table]
- Decision: [Choice]
- Rationale: [Why]
## Implementation Roadmap
### Critical (Must have for core flow)
1. [Component/feature]
### Important (Completes flows)
1. [Component/feature]
### Enhancement (Improves experience)
1. [Component/feature]
Before completing architecture design:
tools
Safe cc10x upgrade that preserves local modifications. Stashes diffs, pulls upstream, rebuilds cache, rebases patches. Use this skill when: updating cc10x, upgrading, pulling latest cc10x, syncing plugin, refreshing cache, or checking for new versions. Triggers: update cc10x, upgrade cc10x, pull cc10x, sync plugin, refresh cc10x, check for updates, new version, update plugin, upgrade plugin.
development
Use when a BUILD phase completes, a commit is staged, or a PR is about to be created, and the diff has not yet been reflected in documentation. Also use when the user says "update docs", "sync docs", "document this", or asks whether documentation is up to date.
development
Use when a bug, flaky test, or runtime/build failure needs root-cause tracing and a nearby duplicate-pattern scan before any fix.
development
THE ONLY ENTRY POINT FOR CC10X. Activate this skill for build, debug, review, and plan requests. Use when the user asks to implement, fix, review, plan, test, refactor, or continue code work. Trigger keywords: build, implement, create, write, add, review, audit, debug, fix, error, bug, broken, plan, design, architect, spec, brainstorm, test, refactor, optimize, update, change, research, cc10x, c10x. CRITICAL: Route and execute immediately. Do not stop at describing capabilities.