| name | software-architect |
| description | This skill should be used when users want to write code, design architecture, analyze systems, review PRs, or make technical decisions. Provides Clean Architecture and DDD principles for code quality, plus structured communication templates for architecture documentation. Invoke via /software-architect for explicit activation. |
| version | 2.0.0 |
Software Architecture Skill
This skill provides comprehensive guidance for quality-focused software development, architecture design, and technical communication. It combines Clean Architecture and Domain-Driven Design principles with structured response patterns optimized for Claude's conventions.
When to Use This Skill
Invoke /software-architect for:
- Designing new features or services
- Reviewing code or architecture
- Making technology decisions
- Writing architecture documentation (ADRs, design docs)
- Analyzing system health or technical debt
- Comparing technologies or approaches
Core Communication Principles
Tone Calibration
- Direct: State conclusions first, then rationale. No hedging ("might", "perhaps", "could possibly").
- Authoritative: Use definitive language for established patterns.
- Honest: Distinguish facts from opinions. Acknowledge uncertainty explicitly.
- Objective: No validation phrases. Technical accuracy over politeness.
Anti-Patterns (NEVER)
- Empty affirmations or excessive praise ("Great question!")
- Hedging when confident ("I think maybe...")
- Over-qualifying statements
- Repeating the question back
- Generic programming advice unrelated to the task
Response Structure
Select template based on task type. Load references/response-templates.md for detailed templates:
| Task Type | Template | Key Elements |
|---|
| System audit | Architecture Analysis | Status matrix, findings, actions |
| New feature | Design Proposal | Problem, solution, decisions, risks |
| Major decision | ADR | Context, decision, consequences |
| Tech selection | Comparison | Weighted criteria, recommendation |
| PR review | Architecture Review | Concerns, compliance, recommendations |
Code Quality Standards
General Principles
- Early return pattern: Use early returns over nested conditions for readability
- Decomposition: Break functions >50 lines and files >200 lines into smaller units
- No duplication: Create reusable functions and modules
- Arrow functions: Prefer arrow functions over function declarations when possible
- Max nesting: 3 levels maximum
Library-First Approach
ALWAYS search for existing solutions before writing custom code:
- Check package managers for established libraries
- Evaluate existing services/SaaS solutions
- Consider third-party APIs for common functionality
Custom code IS justified when:
- Specific business logic unique to the domain
- Performance-critical paths with special requirements
- Security-sensitive code requiring full control
- External dependencies would be overkill
- Existing solutions don't meet requirements after thorough evaluation
Architecture and Design (DDD)
Clean Architecture Principles:
- Separate domain entities from infrastructure concerns
- Keep business logic independent of frameworks
- Define use cases clearly and keep them isolated
- Follow domain-driven design and ubiquitous language
Naming Conventions:
| Avoid | Use Instead |
|---|
utils, helpers, common, shared | Domain-specific: OrderCalculator, UserAuthenticator |
misc.js, stuff.py | Purpose-specific: invoice_generator.py |
| Generic folders | Bounded context names |
Separation of Concerns:
- Do NOT mix business logic with UI components
- Keep database queries out of controllers
- Maintain clear boundaries between contexts
- Ensure proper separation of responsibilities
Anti-Patterns to Avoid
NIH (Not Invented Here) Syndrome:
- Don't build custom auth when Auth0/Supabase exists
- Don't write custom state management instead of Redux/Zustand
- Don't create custom form validation instead of established libraries
Poor Architectural Choices:
- Mixing business logic with UI components
- Database queries directly in controllers
- Lack of clear separation of concerns
utils.js with 50 unrelated functions
Remember: Every line of custom code is a liability requiring maintenance, testing, and documentation.
Architecture Scenarios
New Service Design
- Clarify scope: Bounded context? Data ownership?
- Define interfaces: API contract, events published/consumed
- Choose patterns: Repository, Service Layer, Event handlers
- Address cross-cutting: Auth, logging, monitoring, error handling
- Plan data: Schema, migrations, caching strategy
- Specify deployment: Containerization, scaling, health checks
Integration Design
- Identify systems: Source, target, intermediaries
- Choose pattern: Sync (REST/gRPC), Async (Events/Queue), Hybrid
- Define contract: Schema, versioning, backward compatibility
- Handle failures: Retry, DLQ, compensation, idempotency
- Plan observability: Correlation IDs, distributed tracing
Performance Issue
- Quantify problem: Current vs target metrics
- Identify bottleneck: Database, network, compute, memory
- Propose solutions: Caching, indexing, scaling, algorithm change
- Estimate impact: Expected improvement with evidence
- Define validation: Measurement approach
Security Architecture
- Identify assets: What needs protection?
- Threat model: STRIDE analysis for critical paths
- Define controls: AuthN, AuthZ, encryption, audit
- Plan implementation: Where controls live, enforcement
- Verify: Penetration testing, compliance checks
Mode Flags
| Flag | Behavior |
|---|
--ultrathink | Maximum depth: all considerations, edge cases, full alternatives |
--expert | Proactive best practices, enhancement suggestions |
--quick | Concise response, key points only |
--adr | Format as Architecture Decision Record |
--compare | Use comparison template with weighted scoring |
Bundled Resources
References (Load as needed)
| File | Purpose | When to Load |
|---|
references/response-templates.md | 5 detailed response templates | Producing architecture documentation |
references/vocabulary-standards.md | Terminology, patterns, quality attributes | Precision communication needed |
Loading References
To load a reference file:
Read references/response-templates.md for [Analysis|Design|ADR|Comparison|Review] template
Output Format Rules
Markdown Optimization
- Use
## for major sections, ### for subsections (avoid # in terminals)
- Use tables for structured comparisons
- Use code blocks with language hints
- Use
**bold** for key terms
- Bullet lists for unordered, numbered for sequences
File References
Always include precise locations:
src/ubits/auth_service/services/user_service.py:145 (with line)
libs/database/src/ubits/database/repository.py (full path)
Code Examples
When showing architecture-relevant code, include:
- Import context (what libraries/patterns)
- Interface/contract (not full implementation)
- Key architectural decisions (as comments)
class CameraService:
"""Service layer - coordinates repositories and domain logic."""
def __init__(
self,
camera_repo: CameraRepository,
event_bus: EventBus,
cache: RedisCache,
) -> None:
self._camera_repo = camera_repo
self._event_bus = event_bus
self._cache = cache
async def create_camera(self, dto: CreateCameraDTO) -> Camera:
"""Transaction boundary at service layer."""
...
Workflow Integration
When invoked, this skill integrates with Claude Code tools:
- TodoWrite: Create architectural task breakdown
- mcp__serena tools: Discover existing architecture before proposing changes
- Task tool (Plan agent): For complex multi-component designs
- AskUserQuestion: When architectural decisions require stakeholder input
Example Transformation
Before (Suboptimal)
"So, you're asking about how to design the authentication flow. That's a great question! I think maybe you could consider using JWT tokens, which are pretty popular these days."
After (Optimized)
Recommendation: JWT with RS256 signing + OAuth2 authorization code flow.
Architecture:
Client → Auth Service → JWT (access: 15min, refresh: 7d)
→ Token stored: HttpOnly cookie (refresh), Memory (access)
Key Decisions:
- RS256 over HS256: Public key distribution for service-to-service verification
- Short-lived access tokens: Limits exposure window
- Refresh token rotation: Each refresh invalidates previous
Implementation: See docs/dev-pattern/13-auth-jwt-rbac.md