Service Decomposition
claude "Help me decompose this monolith into microservices:- Identify bounded contexts- Suggest service boundaries- Define API contracts- Plan data separation strategy- Create migration roadmap"
Claude Code serves as an excellent architectural consultant, helping you design scalable systems, make technology decisions, and create comprehensive technical documentation. This lesson explores how to leverage Claude Code for architecture work.
Analyze existing architecture
claude "Analyze the current architecture of this project:- Identify architectural patterns- Map service dependencies- Find potential bottlenecks- Suggest improvementsCreate a detailed report with diagrams"
Technology stack evaluation
claude "Evaluate our technology stack:- Assess each technology's fit- Identify outdated dependencies- Find security vulnerabilities- Recommend upgrades or replacementsInclude migration paths"
Performance profiling
claude "Profile this application's architecture for performance:- Identify slow database queries- Find N+1 query problems- Analyze API response times- Check caching effectivenessGenerate optimization recommendations"
Service Decomposition
claude "Help me decompose this monolith into microservices:- Identify bounded contexts- Suggest service boundaries- Define API contracts- Plan data separation strategy- Create migration roadmap"
claude "Design event-driven architecture using RabbitMQ:- Define event schemas- Create publisher/subscriber pattern- Implement dead letter queues- Add retry mechanisms- Generate monitoring setup"
claude "Implement event streaming with Kafka:- Design topic structure- Create producer/consumer code- Implement exactly-once semantics- Add schema registry- Generate performance tuning guide"
claude "Create serverless event architecture:- Use AWS EventBridge/Azure Event Grid- Design event routing rules- Implement fan-out patterns- Add error handling- Calculate cost estimates"
RESTful API design
claude "Design RESTful API for this domain:- Follow REST principles- Create resource models- Define endpoints and methods- Add pagination and filtering- Generate OpenAPI specification"
GraphQL schema
claude "Create GraphQL schema for this application:- Define types and relationships- Create queries and mutations- Add subscriptions for real-time- Implement DataLoader pattern- Generate resolver templates"
gRPC services
claude "Design gRPC service architecture:- Create protocol buffer definitions- Define service methods- Add streaming support- Implement interceptors- Generate client libraries"
Relational Design
claude "Design relational database schema:- Normalize to 3NF- Add appropriate indexes- Create foreign key constraints- Plan partitioning strategy- Generate migration scripts"
NoSQL Modeling
claude "Design NoSQL data model:- Choose between document/key-value/graph- Optimize for query patterns- Plan sharding strategy- Handle consistency requirements- Create sample queries"
# Repository pattern implementationclaude "Implement repository pattern for data access:- Create abstract repository interface- Implement for multiple databases- Add caching layer- Include transaction support- Generate unit tests"
claude "Implement OAuth 2.0 architecture:- Design authorization server- Create resource server- Implement grant types- Add refresh token rotation- Generate security documentation"
claude "Design JWT-based auth system:- Create token structure- Implement signing/verification- Add refresh token mechanism- Handle token revocation- Generate middleware code"
claude "Implement mutual TLS authentication:- Design certificate hierarchy- Create certificate management- Implement client verification- Add certificate rotation- Generate deployment guide"
Zero Trust Architecture
claude "Design zero trust security model:- Implement micro-segmentation- Add identity verification at each layer- Create policy enforcement points- Design audit logging- Generate compliance checklist"
Defense in Depth
claude "Implement defense in depth strategy:- Add multiple security layers- Create WAF rules- Implement rate limiting- Add intrusion detection- Design incident response plan"
claude "Design horizontal scaling architecture:- Implement stateless services- Add load balancing strategy- Design session management- Create auto-scaling policies- Generate deployment manifests"
Multi-Level Cache
claude "Design multi-level caching:- Browser cache headers- CDN configuration- Application-level cache- Database query cache- Generate cache invalidation logic"
Distributed Cache
claude "Implement distributed caching:- Choose Redis/Memcached- Design cache keys- Implement cache-aside pattern- Add cache warming- Monitor hit rates"
claude "Create ADR for [specific decision]:- Context and problem statement- Decision drivers- Considered options with pros/cons- Decision outcome- Consequences and trade-offsFollow ADR template format"
C4 Model diagrams
claude "Create C4 model diagrams for this system:- Context diagram- Container diagram- Component diagram- Code diagram (for critical parts)Use PlantUML or Mermaid syntax"
Sequence diagrams
claude "Generate sequence diagrams for key flows:- User authentication flow- Order processing workflow- Payment transaction flow- Error handling scenariosUse Mermaid syntax"
Architecture overview
claude "Write comprehensive architecture document:- Executive summary- System overview- Component descriptions- Data flow diagrams- Deployment architecture- Security considerations"
claude "Design AWS architecture for this application:- VPC and networking setup- Compute (EC2/ECS/Lambda)- Storage (S3/EFS/RDS)- Message queuing (SQS/SNS)- Generate CloudFormation/CDK"
claude "Create Azure architecture:- Resource group structure- Compute (VMs/AKS/Functions)- Storage accounts and databases- Service Bus messaging- Generate ARM templates/Bicep"
claude "Design GCP architecture:- Project and folder structure- Compute Engine/GKE/Cloud Run- Cloud Storage and databases- Pub/Sub messaging- Generate Terraform configs"
claude "Analyze and optimize cloud costs:- Review current resource usage- Identify overprovisioned resources- Suggest reserved instances- Implement auto-shutdown policies- Create cost monitoring alerts"
Complete Observability
claude "Design observability architecture:- Metrics collection (Prometheus)- Log aggregation (ELK/Loki)- Distributed tracing (Jaeger)- APM integration- Create dashboards and alerts"
Design a new feature
Refactor existing system
Performance optimization
Continue your architectural journey with:
Remember: Good architecture is not about using the latest technologies, but about making informed decisions that balance technical excellence with business needs. Claude Code helps you explore options and understand trade-offs.