Skip to content

ahmadhasan2k8/ai-architecture-advisor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

35 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AI Architecture Advisor πŸ€–πŸ—οΈ

Python Version Claude Code License: MIT AI Powered

Stop guessing about architecture decisions. Get AI-powered recommendations for your actual code.

The AI Architecture Advisor analyzes your codebase and provides expert recommendations on design patterns, architectural decisions, and refactoring opportunities. Powered by sequential thinking AI and trained on comprehensive pattern knowledge.

🎯 What This Tool Does

  • 🧠 Analyzes your actual code - Not just theory, real analysis of your projects
  • 🎯 Recommends specific patterns - With confidence levels and reasoning
  • πŸ›‘οΈ Prevents anti-patterns - Catches overengineering before it happens
  • πŸ” Finds refactoring opportunities - Identifies code that would benefit from patterns
  • πŸ“Š Provides implementation guidance - Step-by-step pattern application

⚑ Quick Start (5 Minutes)

Prerequisites: Claude Code CLI installed

# 1. Clone and setup
git clone https://github.com/ahmadhasan2k8/ai-architecture-advisor.git
cd ai-architecture-advisor
./setup.sh  # Installs commands globally

# 2. Use from ANY directory - no need to stay in ai-architecture-advisor!
cd /path/to/your/project
claude .

# 3. Start getting AI recommendations
/dp::analyze Your architectural challenge description here

# 4. Analyze your existing code  
/dp::refactor main.py

# 5. Validate pattern decisions
/dp::check singleton for database connection pool

β†’ Full Quick Start Guide ← Start here!

πŸš€ Core AI Commands

🧠 Deep Analysis: /dp::analyze

For complex architectural decisions

/dp::analyze Payment system with multiple providers, different validation rules, and varying processing times

Get 8-step AI analysis with pattern recommendations, alternatives, and implementation roadmap

⚑ Quick Validation: /dp::check

For specific pattern decisions

/dp::check factory for creating different database connections

Fast βœ…/❌ validation with clear reasoning

πŸ” Code Analysis: /dp::refactor

For existing code improvement

/dp::refactor /path/to/your/codebase/

Identifies pattern opportunities with priority scores

πŸ›‘οΈ Anti-Pattern Prevention: /dp::validate

For avoiding architectural mistakes

/dp::validate Making all service classes singletons for consistency

Prevents overengineering and common mistakes

🌟 What Makes This Unique

Other Architecture Resources:

❌ Generic advice and theoretical examples
❌ "Here's how to implement X pattern"
❌ No analysis of your specific code
❌ No guidance on when NOT to use patterns

AI Architecture Advisor:

βœ… Analyzes YOUR specific code and problems
βœ… Tells you WHEN to use patterns (and when not to)
βœ… Prevents anti-patterns and overengineering
βœ… Provides confidence levels and reasoning
βœ… Sequential thinking for complex decisions

🎯 Real-World Example

Your Problem:

/dp::analyze E-commerce platform with user auth, product catalog, shopping cart, order processing, payment handling, inventory management. Team of 8 developers.

AI Analysis:

🧠 Pattern Analysis: E-commerce Platform Architecture

## Problem Assessment
- Complexity: High (6+ domains, team coordination)
- Scale: Multi-domain system requiring modularity
- Growth Potential: High (e-commerce evolves rapidly)

## Primary Recommendations:

### 1. Repository Pattern (Confidence: HIGH) 
βœ“ 6+ data domains justify separate repositories
βœ“ Team of 8 needs independent development paths
βœ“ Testing isolation critical for this complexity

### 2. Strategy Pattern for Payments (Confidence: HIGH)
βœ“ Multiple payment methods with different logic  
βœ“ Runtime selection based on user/region
βœ“ Expected growth (crypto, BNPL, etc.)

### 3. Observer Pattern for Order Events (Confidence: MEDIUM)
βœ“ Inventory updates, notifications, analytics
βœ“ Decoupled event handling across domains

## Anti-Pattern Warnings:
🚨 Avoid generic repository (IRepository<T>)
🚨 Don't make everything singleton
⚠️ Watch for god objects in order processing

## Implementation Priority:
1. Repository pattern (foundational)
2. Payment strategies (business critical)
3. Event system (quality improvement)

[... detailed implementation steps ...]

πŸ—οΈ Project Structure

ai-architecture-advisor/
β”œβ”€β”€ πŸ“‹ README.md                    # You are here
β”œβ”€β”€ ⚑ QUICK_START.md               # Get started in 5 minutes
β”œβ”€β”€ πŸ€– commands/                    # Primary AI interface
β”‚   β”œβ”€β”€ analyze.md                  # Deep architectural analysis
β”‚   β”œβ”€β”€ check.md                    # Quick pattern validation
β”‚   β”œβ”€β”€ refactor.md                 # Code improvement analysis
β”‚   └── validate.md                 # Anti-pattern prevention
β”œβ”€β”€ 🧠 ai-engine/                   # Intelligence core
β”‚   β”œβ”€β”€ pattern_knowledge.py        # Comprehensive pattern database
β”‚   β”œβ”€β”€ code_analyzer.py            # AST-based code analysis
β”‚   β”œβ”€β”€ repo_analyzer.py            # Repository-wide insights
β”‚   └── refactoring_templates.py    # Implementation guidance
β”œβ”€β”€ πŸ“š learning-resources/          # Educational materials
β”‚   β”œβ”€β”€ notebooks/                  # Interactive pattern tutorials
β”‚   β”œβ”€β”€ guides/                     # Documentation and decision trees
β”‚   └── examples/                   # Implementation examples & tests
β”œβ”€β”€ πŸ”§ .claude/                     # AI command configuration
└── πŸ“„ CLAUDE.md                    # AI assistant guidelines

πŸŽ“ Learning Paths

πŸ€– AI-First Approach (Recommended)

For developers with real projects

  1. Start with /dp::analyze on your current architectural challenges
  2. Use /dp::refactor to improve existing code
  3. Learn patterns through AI recommendations and targeted study
  4. Validate understanding with /dp::check

πŸ“š Traditional Learning

For systematic pattern education

  1. Study interactive notebooks in learning-resources/notebooks/
  2. Practice with implementation examples
  3. Apply patterns to real projects
  4. Use AI commands to validate your decisions

🧠 AI Technology

Sequential Thinking Integration

The AI uses advanced sequential thinking to:

  • Break down complex architectural problems into steps
  • Consider multiple pattern options systematically
  • Evaluate trade-offs and alternatives
  • Provide reasoning for recommendations

Pattern Knowledge Base

  • Extracted from 10 comprehensive pattern tutorials
  • Threshold-based recommendations (e.g., Strategy for 3+ algorithms)
  • Anti-pattern detection with specific warnings
  • Context-aware analysis (team size, complexity, growth)

Code Analysis Engine

  • AST-based Python code analysis
  • Pattern opportunity detection
  • Complexity metrics and thresholds
  • Priority scoring for refactoring suggestions

πŸš€ Installation & Setup

Prerequisites

  • Python 3.11+ (optional, for notebooks)
  • Claude Code CLI (required for dp:: commands)

Quick Setup (2 minutes)

# Clone the repository
git clone https://github.com/ahmadhasan2k8/ai-architecture-advisor.git
cd ai-architecture-advisor

# Run the setup script to enable dp:: commands
./setup.sh

# Or manually copy commands
mkdir -p .claude/commands
cp commands/*.md .claude/commands/

Verify Installation

# Open Claude Code
claude .

# Test a command
/dp::analyze I need a payment processing system

That's it! The dp:: commands are now available in Claude Code.

β†’ Detailed Setup Guide for troubleshooting and manual setup.

πŸ“Š Capabilities

AI-Powered Features

  • 4 Smart Commands for comprehensive architecture guidance
  • Sequential Thinking for complex decision analysis
  • Anti-Pattern Detection with risk assessment
  • Code Analysis with refactoring recommendations
  • Confidence Scoring for all recommendations

Learning Resources

  • 10 Design Patterns with interactive tutorials
  • Real-world Examples and implementation guides
  • Decision Trees and visual guides
  • Comprehensive Test Suites with >90% coverage

Supported Patterns

Creational: Singleton, Factory, Builder
Structural: Adapter, Decorator
Behavioral: Observer, Strategy, Command, State
Architectural: Repository

🀝 Contributing

We welcome contributions to improve the AI recommendations and expand pattern coverage!

Areas for Contribution:

  • Pattern knowledge enhancement - Add more advanced scenarios
  • Code analysis improvements - Better pattern detection algorithms
  • New language support - Extend beyond Python
  • AI prompt refinement - Improve recommendation quality

See CONTRIBUTING.md for guidelines.

πŸ“„ License

MIT License - See LICENSE for details.


🎯 Ready to Transform Your Architecture Decisions?

For Immediate AI Help:

β†’ Quick Start Guide - Get recommendations in 5 minutes

For Learning:

β†’ Interactive Tutorials - Comprehensive pattern education

For Your Team:

The AI Architecture Advisor helps teams make consistent, well-reasoned architectural decisions. No more endless debates about whether to use a pattern - get expert AI analysis instead.


🌟 If this helps you write better code, please give it a ⭐

Questions? Open an issue or check the documentation.

Stop wondering. Start knowing. πŸš€

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors