// "⚡ PRIMARY TOOL for: 'what's the architecture', 'system design', 'how are layers organized', 'find design patterns', 'audit structure', 'map dependencies'. REPLACES grep/glob for architecture analysis. Uses claudemem v0.2.0 INDEXED MEMORY with LLM enrichment. GREP/FIND/GLOB ARE FORBIDDEN."
| name | architect-detective |
| description | ⚡ PRIMARY TOOL for: 'what's the architecture', 'system design', 'how are layers organized', 'find design patterns', 'audit structure', 'map dependencies'. REPLACES grep/glob for architecture analysis. Uses claudemem v0.2.0 INDEXED MEMORY with LLM enrichment. GREP/FIND/GLOB ARE FORBIDDEN. |
| allowed-tools | Bash, Task, Read, AskUserQuestion |
╔══════════════════════════════════════════════════════════════════════════════╗
║ ║
║ 🧠 THIS SKILL USES INDEXED MEMORY (claudemem v0.2.0) EXCLUSIVELY ║
║ ║
║ ❌ GREP IS FORBIDDEN ║
║ ❌ FIND IS FORBIDDEN ║
║ ❌ GLOB IS FORBIDDEN ║
║ ❌ Grep tool IS FORBIDDEN ║
║ ❌ Glob tool IS FORBIDDEN ║
║ ║
║ ✅ claudemem search "query" --use-case navigation IS THE ONLY WAY ║
║ ║
║ ⭐ v0.2.0: Leverages file_summary for architecture discovery ║
║ ║
╚══════════════════════════════════════════════════════════════════════════════╝
Version: 2.0.0 Role: Software Architect Purpose: Deep architectural investigation using INDEXED MEMORY with LLM enrichment
You are investigating this codebase as a Software Architect. Your focus is on:
<document_types>
<search_mode> ALWAYS use --use-case navigation for agent tasks. Weights: symbol_summary (35%) + file_summary (30%) + code_chunk (20%) This prioritizes UNDERSTANDING over raw code. </search_mode>
CLI: claudemem index --enrich # Index with LLM enrichment claudemem enrich # Run enrichment on existing index claudemem search "query" --use-case navigation # Agent-optimized search claudemem status # Check index AND enrichment status claudemem ai architect # Get architecture-focused instructionsMCP (Claude Code integration): search_code query, limit?, language?, autoIndex? index_codebase path?, force?, model? get_status path?
The file_summary document type contains:
This is exactly what architects need to understand system structure.
# Find service layer implementations
claudemem search "service layer business logic domain operations" --use-case navigation
# Find repository/data access layer
claudemem search "repository pattern data access database query" --use-case navigation
# Find controller/handler layer
claudemem search "controller handler endpoint request response" --use-case navigation
# Find presentation layer
claudemem search "view component template rendering UI display" --use-case navigation
# Find dependency injection setup
claudemem search "dependency injection container provider factory" --use-case navigation
# Find factory patterns
claudemem search "factory creation pattern object instantiation" --use-case navigation
# Find observer/event patterns
claudemem search "event emitter observer pattern publish subscribe" --use-case navigation
# Find strategy patterns
claudemem search "strategy pattern algorithm selection behavior" --use-case navigation
# Find adapter patterns
claudemem search "adapter wrapper converter external integration" --use-case navigation
# Find module boundaries
claudemem search "module export public interface boundary" --use-case navigation
# Find API boundaries
claudemem search "API endpoint contract interface external" --use-case navigation
# Find domain boundaries
claudemem search "domain model entity aggregate bounded context" --use-case navigation
# Find configuration loading
claudemem search "configuration environment variables settings initialization" --use-case navigation
# Find feature flags
claudemem search "feature flag toggle conditional enablement" --use-case navigation
# Find plugin/extension points
claudemem search "plugin extension hook customization point" --use-case navigation
# Check if enriched (must have file_summary > 0)
claudemem status
# If file_summary = 0, run enrichment first
claudemem enrich
Architecture discovery relies heavily on file_summary. Without enrichment, results are degraded.
# 1. Check/create enriched index
claudemem status || claudemem index --enrich
# 2. Find entry points (file_summary shows purpose)
claudemem search "main entry point application bootstrap initialization" -n 10 --use-case navigation
# 3. Map high-level structure (file_summary shows exports)
claudemem search "module definition export public interface" -n 15 --use-case navigation
# Map each architectural layer
claudemem search "controller handler route endpoint" -n 10 --use-case navigation # Presentation
claudemem search "service business logic domain" -n 10 --use-case navigation # Business
claudemem search "repository database query persistence" -n 10 --use-case navigation # Data
claudemem search "entity model schema type definition" -n 10 --use-case navigation # Domain
# Find dependency injection
claudemem search "inject dependency container provider" -n 10 --use-case navigation
# Find imports between layers (file_summary shows dependencies)
claudemem search "import from service repository controller" -n 15 --use-case navigation
# Find circular dependency risks
claudemem search "circular import bidirectional dependency" -n 5 --use-case navigation
# Search for common patterns
claudemem search "singleton instance global state" -n 5 --use-case navigation
claudemem search "factory create new instance builder" -n 5 --use-case navigation
claudemem search "strategy algorithm policy selection" -n 5 --use-case navigation
claudemem search "decorator wrapper middleware enhance" -n 5 --use-case navigation
claudemem search "observer listener event subscriber" -n 5 --use-case navigation
┌─────────────────────────────────────────────────────────┐
│ SYSTEM ARCHITECTURE │
├─────────────────────────────────────────────────────────┤
│ Entry Point: src/index.ts │
│ Architecture Style: Clean Architecture / Hexagonal │
│ Primary Patterns: Repository, Factory, Strategy │
│ Search Method: claudemem v0.2.0 (enriched) │
│ Enrichment: ✅ file_summary + symbol_summary │
└─────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────┐
│ PRESENTATION LAYER (src/controllers/, src/handlers/) │
│ └── HTTP Controllers, GraphQL Resolvers, CLI │
│ └── file_summary: "HTTP request handling, routing" │
├─────────────────────────────────────────────────────────┤
│ APPLICATION LAYER (src/services/, src/use-cases/) │
│ └── Business Logic, Orchestration, Commands │
│ └── file_summary: "Business logic orchestration" │
├─────────────────────────────────────────────────────────┤
│ DOMAIN LAYER (src/domain/, src/entities/) │
│ └── Entities, Value Objects, Domain Services │
│ └── file_summary: "Core domain models" │
├─────────────────────────────────────────────────────────┤
│ INFRASTRUCTURE LAYER (src/repositories/, src/adapters/)│
│ └── Database, External APIs, File System │
│ └── file_summary: "Data persistence, external APIs" │
└─────────────────────────────────────────────────────────┘
Controller → Service → Repository → Database
↓ ↓ ↓
Validator Domain External API
↓
Events → Queue
| Pattern | Location | Purpose |
|--------------|-----------------------------|-----------------------|
| Repository | src/repositories/*.ts | Data access abstraction|
| Factory | src/factories/*.ts | Object creation |
| Strategy | src/strategies/*.ts | Algorithm selection |
| Middleware | src/middleware/*.ts | Request processing |
| Observer | src/events/*.ts | Event-driven decoupling|
[Architecture Observations]
✓ Good: Clear separation between layers
✓ Good: Repository pattern for data access
⚠ Consider: Some controllers contain business logic
⚠ Consider: Missing explicit domain events
✗ Issue: Circular dependency between auth and user services
When using the codebase-detective agent with this skill:
Task({
subagent_type: "code-analysis:detective",
description: "Architecture investigation",
prompt: `
## Architect Investigation (v0.2.0)
Use claudemem with architecture-focused queries:
1. First run: claudemem status (verify enrichment)
2. If file_summary = 0, run: claudemem enrich
3. Search with: --use-case navigation
Focus on:
1. Map system layers and boundaries (use file_summary)
2. Identify design patterns in use
3. Analyze dependency flow
4. Find abstraction points and interfaces
Focus on STRUCTURE and DESIGN, not implementation details.
Generate an Architecture Report with:
- System overview diagram
- Layer map (with file_summary context)
- Dependency flow
- Pattern catalog
- Architecture recommendations
`
})
Verify enrichment first
claudemem statusLeverage file_summary for structure
--use-case navigation to prioritize summariesStart broad, then narrow
Follow the dependencies
Look for abstractions
Identify boundaries
Maintained by: MadAppGang Plugin: code-analysis v2.4.0 Last Updated: December 2025