|
| 1 | +# AI Architecture Advisor - Setup Guide |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +This guide explains how to properly set up the AI Architecture Advisor's design pattern commands (`dp::` commands) for use with Claude Code. |
| 6 | + |
| 7 | +## Quick Setup (2 minutes) |
| 8 | + |
| 9 | +```bash |
| 10 | +# 1. Clone the repository |
| 11 | +git clone https://github.com/ahmadhasan2k8/ai-architecture-advisor.git |
| 12 | +cd ai-architecture-advisor |
| 13 | + |
| 14 | +# 2. Make dp commands available to Claude Code |
| 15 | +cp -r commands .claude/ |
| 16 | + |
| 17 | +# 3. Open Claude Code in the project directory |
| 18 | +claude . |
| 19 | + |
| 20 | +# 4. Test that commands work |
| 21 | +# Try: /dp::analyze I need a system to handle multiple payment methods |
| 22 | +``` |
| 23 | + |
| 24 | +## How the dp Commands Work |
| 25 | + |
| 26 | +### Command Structure |
| 27 | +The repository contains four design pattern commands in the `commands/` directory: |
| 28 | +- `analyze.md` - Comprehensive pattern analysis using sequential thinking |
| 29 | +- `check.md` - Quick pattern validation |
| 30 | +- `refactor.md` - Code analysis for pattern opportunities |
| 31 | +- `validate.md` - Anti-pattern detection |
| 32 | + |
| 33 | +**Important**: These are instruction files for Claude AI, not executable scripts. They tell Claude how to analyze your code using AI reasoning. |
| 34 | + |
| 35 | +### Claude Code Integration |
| 36 | +Claude Code automatically detects and loads commands from: |
| 37 | +- `.claude/commands/` directory in the project root |
| 38 | +- Each `.md` file becomes a callable command |
| 39 | +- Commands use the `/dp::` namespace |
| 40 | + |
| 41 | +### How Analysis Works |
| 42 | +When you run a dp command: |
| 43 | +1. Claude reads the instructions from the command file |
| 44 | +2. Claude uses its AI capabilities to analyze your code/problem |
| 45 | +3. Claude applies the pattern knowledge embedded in the instructions |
| 46 | +4. You get AI-powered recommendations based on best practices |
| 47 | + |
| 48 | +**Note**: The Python files in `ai-engine/` are separate analysis tools that can be run independently. The dp commands don't call these Python files - they work entirely through Claude's AI. |
| 49 | + |
| 50 | +### Command Flow |
| 51 | +``` |
| 52 | +Repository Structure β Claude Code Structure |
| 53 | +commands/ .claude/commands/ |
| 54 | +βββ analyze.md βββ analyze.md β /dp::analyze |
| 55 | +βββ check.md βββ check.md β /dp::check |
| 56 | +βββ refactor.md βββ refactor.md β /dp::refactor |
| 57 | +βββ validate.md βββ validate.md β /dp::validate |
| 58 | +``` |
| 59 | + |
| 60 | +## Manual Setup Steps |
| 61 | + |
| 62 | +If the quick setup doesn't work, follow these steps: |
| 63 | + |
| 64 | +### 1. Verify Prerequisites |
| 65 | +```bash |
| 66 | +# Check Claude Code is installed |
| 67 | +claude --version |
| 68 | + |
| 69 | +# Should output version number |
| 70 | +# If not, install from: https://claude.ai/code |
| 71 | +``` |
| 72 | + |
| 73 | +### 2. Set Up Command Directory |
| 74 | +```bash |
| 75 | +# From the ai-architecture-advisor directory |
| 76 | +mkdir -p .claude/commands |
| 77 | + |
| 78 | +# Copy the dp commands |
| 79 | +cp commands/*.md .claude/commands/ |
| 80 | +``` |
| 81 | + |
| 82 | +### 3. Verify Setup |
| 83 | +```bash |
| 84 | +# List the commands |
| 85 | +ls -la .claude/commands/ |
| 86 | + |
| 87 | +# Should show: |
| 88 | +# analyze.md |
| 89 | +# check.md |
| 90 | +# refactor.md |
| 91 | +# validate.md |
| 92 | +``` |
| 93 | + |
| 94 | +### 4. Test Commands |
| 95 | +Open Claude Code in the project directory: |
| 96 | +```bash |
| 97 | +claude . |
| 98 | +``` |
| 99 | + |
| 100 | +Then test each command: |
| 101 | +```bash |
| 102 | +# Test analyze |
| 103 | +/dp::analyze I need to manage user sessions |
| 104 | + |
| 105 | +# Test check |
| 106 | +/dp::check singleton for database connection |
| 107 | + |
| 108 | +# Test refactor |
| 109 | +/dp::refactor src/main.py |
| 110 | + |
| 111 | +# Test validate |
| 112 | +/dp::validate making all classes singleton |
| 113 | +``` |
| 114 | + |
| 115 | +## Troubleshooting |
| 116 | + |
| 117 | +### "Command not found" |
| 118 | +1. Ensure you're in the project root directory |
| 119 | +2. Check `.claude/commands/` exists and contains the `.md` files |
| 120 | +3. Restart Claude Code |
| 121 | + |
| 122 | +### "Commands not working properly" |
| 123 | +1. Verify the command files were copied correctly |
| 124 | +2. Check file permissions: `chmod 644 .claude/commands/*.md` |
| 125 | +3. Ensure no syntax errors in command files |
| 126 | + |
| 127 | +### "Can't find .claude directory" |
| 128 | +The `.claude` directory might be hidden. Use: |
| 129 | +```bash |
| 130 | +ls -la | grep .claude |
| 131 | +``` |
| 132 | + |
| 133 | +## Command Reference |
| 134 | + |
| 135 | +### `/dp::analyze <problem description>` |
| 136 | +Performs deep architectural analysis using sequential thinking AI to evaluate pattern options. |
| 137 | + |
| 138 | +**Example:** |
| 139 | +``` |
| 140 | +/dp::analyze Payment processing system with credit cards, PayPal, and crypto |
| 141 | +``` |
| 142 | + |
| 143 | +### `/dp::check <pattern> for <scenario>` |
| 144 | +Quick validation of whether a specific pattern fits your use case. |
| 145 | + |
| 146 | +**Example:** |
| 147 | +``` |
| 148 | +/dp::check strategy for handling 2 export formats |
| 149 | +``` |
| 150 | + |
| 151 | +### `/dp::refactor <file or directory>` |
| 152 | +Analyzes existing code to find pattern opportunities and anti-patterns. |
| 153 | + |
| 154 | +**Example:** |
| 155 | +``` |
| 156 | +/dp::refactor src/services/payment_handler.py |
| 157 | +``` |
| 158 | + |
| 159 | +### `/dp::validate <pattern usage description>` |
| 160 | +Checks for overengineering and pattern misuse. |
| 161 | + |
| 162 | +**Example:** |
| 163 | +``` |
| 164 | +/dp::validate using factory pattern for creating user objects |
| 165 | +``` |
| 166 | + |
| 167 | +## For Repository Maintainers |
| 168 | + |
| 169 | +To ensure the commands work for all users: |
| 170 | + |
| 171 | +1. Keep commands in the `commands/` directory as the source of truth |
| 172 | +2. Add `.claude/` to `.gitignore` (users create it locally) |
| 173 | +3. Document the setup process in README.md |
| 174 | +4. Consider adding a setup script: |
| 175 | + |
| 176 | +```bash |
| 177 | +#!/bin/bash |
| 178 | +# setup.sh - Set up dp commands for Claude Code |
| 179 | + |
| 180 | +echo "Setting up AI Architecture Advisor..." |
| 181 | + |
| 182 | +# Create .claude directory structure |
| 183 | +mkdir -p .claude/commands |
| 184 | + |
| 185 | +# Copy commands |
| 186 | +cp commands/*.md .claude/commands/ |
| 187 | + |
| 188 | +echo "β
Setup complete! You can now use dp:: commands in Claude Code" |
| 189 | +echo "Try: /dp::analyze your architecture problem" |
| 190 | +``` |
| 191 | + |
| 192 | +## Next Steps |
| 193 | + |
| 194 | +After setup, see: |
| 195 | +- [QUICK_START.md](QUICK_START.md) - Learn how to use the commands effectively |
| 196 | +- [dp_commands_guide.md](learning-resources/guides/dp_commands_guide.md) - Detailed command documentation |
| 197 | +- [README.md](README.md) - Project overview and capabilities |
0 commit comments