Skip to content
Development
Command

/xarchitecture

Design, analyze, and evolve system architecture using Domain-Driven Design, 12-Factor App, and proven patterns

From plugin
claude-code
11045 skills45 commands29 hooks

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/xarchitecture

Context preview

What this command does when you run it.

Design, analyze, and evolve system architecture using Domain-Driven Design, 12-Factor App, and proven patterns

Command definition

xarchitecture.md
description: Design, analyze, and evolve system architecture using Domain-Driven Design, 12-Factor App, and proven patterns
tags: [architecture, design, patterns, ddd, domain-driven-design, bounded-contexts, aggregates, microservices, clean-architecture, 12-factor, cloud-native]

Analyze and design system architecture using Domain-Driven Design, 12-Factor App principles, and proven patterns based on $ARGUMENTS.

Usage Examples

**Basic architecture analysis:**

/xarchitecture

**Analyze Domain-Driven Design patterns:**

/xarchitecture --ddd

**Check 12-Factor App compliance:**

/xarchitecture --12factor

**Design microservices architecture:**

/xarchitecture --microservices

Implementation

If $ARGUMENTS contains "help" or "--help": Display this usage information and exit.

First, examine the current project structure: !find . -type f -name "*.py" -o -name "*.js" -o -name "*.ts" | grep -v node_modules | grep -v __pycache__ | head -20 !ls -la src/ app/ lib/ services/ controllers/ models/ 2>/dev/null || echo "No standard architecture directories found" !find . -name "docker-compose.yml" -o -name "Dockerfile" | head -3 !find . -name "*.md" | xargs grep -l "architecture\|design\|pattern" | head -5 2>/dev/null

Identify existing DDD elements: !find . -name "*Entity*" -o -name "*ValueObject*" -o -name "*Aggregate*" -o -name "*Repository*" | head -10 !grep -r "BoundedContext\|DomainService\|UbiquitousLanguage" . --include="*.py" --include="*.js" --include="*.ts" | head -5 2>/dev/null

Check for domain-driven directory structure: !ls -la domain/ infrastructure/ application/ 2>/dev/null || echo "No DDD layered architecture found"

Check for 12-Factor App compliance: !find . -name ".env*" -o -name "config.*" | head -5 !find . -name "Dockerfile" -o -name "docker-compose.yml" | head -3 !find . -name "Procfile" -o -name "requirements.txt" -o -name "package.json" | head -5 !grep -r "process.env\|os.environ\|System.getenv" . --include="*.py" --include="*.js" --include="*.ts" | wc -l

Based on $ARGUMENTS, perform the appropriate DDD and 12-Factor informed architecture operation:

1. Architecture Analysis (DDD + 12-Factor)

If analyzing current architecture (--analyze, --layers, --dependencies, --ddd, --12factor): !find . -name "*.py" -o -name "*.js" -o -name "*.ts" | xargs grep -l "import\|require" | head -10 !python -c "import ast; print('Python AST analysis available')" 2>/dev/null || echo "Python not available for analysis" !find . -name "package.json" -o -name "requirements.txt" | head -2

**DDD Strategic Design Analysis:** !grep -r "BoundedContext\|Context\|Domain" . --include="*.py" --include="*.js" --include="*.ts" | wc -l !find . -name "*Context*" -o -name "*Domain*" | head -10

**DDD Tactical Design Analysis:** !find . -name "*Entity*" -o -name "*ValueObject*" -o -name "*Aggregate*" -o -name "*Repository*" -o -name "*DomainService*" | wc -l !grep -r "Entity\|ValueObject\|Aggregate\|Repository" . --include="*.py" --include="*.js" --include="*.ts" | head -10

**12-Factor App Compliance Analysis:** !git remote -v | wc -l || echo "No git remote found (Factor I: Codebase)" !find . -name "requirements.txt" -o -name "package.json" -o -name "Pipfile" | wc -l !find . -name ".env*" | wc -l !grep -r "hardcoded.*password\|hardcoded.*key" . --include="*.py" --include="*.js" --include="*.ts" | wc -l !find . -name "Dockerfile" | wc -l !grep -r "console.log\|print\|logging" . --include="*.py" --include="*.js" --include="*.ts" | wc -l

Analyze 12-Factor App compliance:

  • **I. Codebase**: Single codebase in version control with multiple deploys
  • **II. Dependencies**: Explicit dependency declaration and isolation
  • **III. Config**: Configuration stored in environment variables
  • **IV. Backing Services**: External services treated as attached resources
  • **V. Build/Release/Run**: Strict separation of build and run stages
  • **VI. Processes**: Stateless process execution
  • **VII. Port Binding**: Service export via port binding
  • **VIII. Concurrency**: Horizontal scaling via process model
  • **IX. Disposability**: Fast startup and graceful shutdown
  • **X. Dev/Prod Parity**: Environment consistency across stages
  • **XI. Logs**: Logs treated as event streams
  • **XII. Admin Processes**: One-off admin tasks as separate processes

Analyze DDD architectural patterns:

  • **Bounded Context boundaries** and context mapping
  • **Domain model integrity** and ubiquitous language usage
  • **Aggregate design** and consistency boundaries
  • **Entity vs Value Object** modeling decisions
  • **Repository pattern** implementation
  • **Domain Service** vs Application Service separation
  • **Infrastructure layer** isolation from domain
  • **Anti-corruption layer** implementation
  • **Layer separation** following DDD principles
  • **Coupling and cohesion** within domain boundaries

2. Architecture Design (DDD + 12-Factor)

If designing architecture (--design, --microservices, --event-driven, --bounded-contexts, --12factor, --cloud-native): !find . -name "*.yml" -o -name "*.yaml" | xargs grep -l "service\|api" 2>/dev/null | head -5 !docker --version 2>/dev/null || echo "Docker not available for containerization" !kubectl version --client 2>/dev/null || echo "Kubernetes not available for orchestration"

**DDD Strategic Design Patterns:**

If designing bounded contexts (--bounded-contexts): Design context boundaries using:

  • **Partnership**: Mutual dependency between teams
  • **Shared Kernel**: Common code base between contexts
  • **Customer/Supplier**: Upstream/downstream relationship
  • **Conformist**: Downstream conforms to upstream model
  • **Anti-corruption Layer**: Protect downstream from upstream changes
  • **Open-host Service**: Published API for multiple consumers
  • **Published Language**: Well-documented shared protocol

**DDD-Informed Microservices Design:**

  • **Bounded Context = Microservice**: Each service owns its domain
  • **Aggregate-based service boundaries**: Services align with aggregates

-

Read more
Ships withclaude-code

Transform Claude Code into a complete development platform with 45 AI-powered commands that automate your entire software development workflow. Now with improved git identity management!

Get the whole plugin

Other commands on claude-code.