xarchitecture
Design, analyze, and evolve system architecture using Domain-Driven Design, 12-Factor App, and proven patterns
Generate specifications and code from visual artifacts — diagrams, mockups, and screenshots
How it fires
How this command gets triggered: by you, by Claude, or both.
/ximagespecContext preview
What this command does when you run it.
Generate specifications and code from visual artifacts — diagrams, mockups, and screenshots
description: Generate specifications and code from visual artifacts — diagrams, mockups, and screenshots tags: [image, spec, visual, diagram, mockup, screenshot, ui, architecture]
Use diagrams, mockups, and screenshots as primary specifications for code generation. Iterate with annotated visuals. Aligns with the Image Spec pattern from ai-development-patterns.
**Generate code from an architecture diagram:**
/ximagespec architecture.png
**Generate UI from a mockup:**
/ximagespec mockup.png --stack react
**Iterate on a screenshot with annotations:**
/ximagespec screenshot.png --iterate
**Generate spec document from a flow diagram:**
/ximagespec flow.png --spec-only
**Help and options:**
/ximagespec help /ximagespec --help
If $ARGUMENTS contains "help" or "--help": Display this usage information and exit.
Parse $ARGUMENTS for the image path. If not provided, check for common image files: !find . -maxdepth 2 -name "*.png" -o -name "*.jpg" -o -name "*.svg" -o -name "*.webp" | grep -iE "(arch|mock|design|flow|diagram|wireframe|spec|ui)" | head -10
Read the provided image file to understand its content.
Determine what kind of visual artifact this is:
Examine the codebase to align generated code with existing patterns: !ls -la | grep -E "(pyproject.toml|package.json|go.mod|Cargo.toml|docker-compose.yml)" !find . -type f -name "*.py" -o -name "*.js" -o -name "*.ts" -o -name "*.go" | grep -v node_modules | head -10
Identify:
**Architecture Diagrams**: From the image, extract:
Generate:
**UI Mockups/Wireframes**: From the image, extract:
Generate:
**Data Model Diagrams**: From the image, extract:
Generate:
**Flow/Sequence Diagrams**: From the image, extract:
Generate:
If $ARGUMENTS contains "--spec-only": Generate a written specification document (no code) capturing everything the image communicates.
If $ARGUMENTS contains "--iterate": Compare the screenshot against the current codebase. Identify:
Suggest specific changes one slice at a time.
Otherwise, generate code + tests + a brief implementation summary.
Per ai-development-patterns Image Spec pattern, a complete visual spec includes:
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!
Design, analyze, and evolve system architecture using Domain-Driven Design, 12-Factor App, and proven patterns
Manage project configuration files, environment variables, and application settings
Continue an execution plan from where it left off across sessions
Interactive debugging support with error analysis and fix suggestions - integrates with Debug Specialist sub-agent for complex…