// Universal methodology for discovering and adapting to any codebase's patterns, conventions, and architectural decisions. Automatically detects technology stack, learns project structure, and identifies coding standards. Use when encountering unfamiliar code, unknown frameworks, need to understand project patterns. Triggers: 'architecture', 'structure', 'conventions', 'tech stack', 'patterns', 'how is organized', '구조', '아키텍처', '패턴', '컨벤션', '기술스택', '어떻게 구성', '분석', analyzing package.json, go.mod, flake.nix, Cargo.toml, .gitignore files.
| name | codebase-analysis |
| description | Universal methodology for discovering and adapting to any codebase's patterns, conventions, and architectural decisions. Automatically detects technology stack, learns project structure, and identifies coding standards. Use when encountering unfamiliar code, unknown frameworks, need to understand project patterns. Triggers: 'architecture', 'structure', 'conventions', 'tech stack', 'patterns', 'how is organized', '구조', '아키텍처', '패턴', '컨벤션', '기술스택', '어떻게 구성', '분석', analyzing package.json, go.mod, flake.nix, Cargo.toml, .gitignore files. |
This skill provides a systematic methodology for analyzing any codebase regardless of language, framework, or architectural style.
Every analysis must begin with systematic discovery:
Before analyzing the codebase, evaluate if external knowledge is required.
Quick decision:
Detailed guidance: See ../shared/mcp-decision-guide.md for comprehensive MCP selection criteria, usage examples, and decision flows.
# Use Glob and LS to understand organization
1. Identify root directory structure
2. Locate source code directories (src/, lib/, pkg/, etc.)
3. Find configuration files (any naming pattern)
4. Discover build/dependency management files
5. Identify test directories and patterns
# Detect from file extensions and content:
- Source files: *.ext → Analyze content for language/framework
- Build files: *build*, *make*, package.*, *.gradle, go.*, Cargo.*, etc.
- Dependencies: Parse imports, includes, require statements
- Frameworks: Identify from import patterns and directory structure
# Study existing code for patterns:
1. Naming conventions (camelCase, snake_case, PascalCase)
2. File organization (by feature, by layer, by component)
3. Code structure (class-based, functional, procedural)
4. Error handling patterns
5. Logging and debugging approaches
6. Documentation style
# Identify how the project builds:
- Build commands from scripts, Makefiles, justfiles
- Dependency management approach
- Test execution commands
- Deployment/packaging methods
For ANY project, systematically ask:
# Universal detection patterns (not hardcoded):
# Imports/Dependencies
import, require, include, use, using, from, #include
# Build systems (find by pattern matching)
*build*, *make*, *.toml, *.yaml, *.json, *file
package.*, project.*, cargo.*, go.*, pom.*, *.gradle
# Testing (discover from any naming)
*test*, *spec*, test_*, Test*, *_test.*, *Spec.*
test/, tests/, spec/, __tests__/
After discovery, synthesize project conventions:
This base skill provides the foundation for specialized skills:
❌ Wrong: "I'll add a React component..."
✅ Right: "Let me first analyze the project structure...
[Discovers it's Vue, not React]
I'll add a Vue component following the existing patterns..."
❌ Wrong: "Best practice is to use TypeScript strict mode"
✅ Right: "This project uses JavaScript without type checking.
I'll follow the existing approach for consistency."
✅ Always cite existing code as justification:
"Following the pattern from UserService.java, I'll structure
OrderService with the same dependency injection approach."
User: "Add authentication"
Claude:
1. [Scans directory structure]
2. [Finds *.rs files, Cargo.toml]
3. "Detected Rust project with Actix-web framework"
4. [Analyzes existing auth middleware patterns]
5. "I'll implement authentication following your existing
middleware pattern in src/middleware/auth.rs"
User: "Implement data pipeline"
Claude:
1. [Discovers Python scripts/, Go services/, K8s configs/]
2. "Multi-language project: Python for data processing,
Go for microservices, Kubernetes for orchestration"
3. [Analyzes integration patterns between components]
4. "I'll create a pipeline that integrates with your existing
Python processors and Go service mesh..."
❌ Never:
✅ Always:
For detailed strategies, see:
pattern-recognition.md - Deep dive into pattern matchinglanguage-detection.md - Technology identification guidesconvention-mapping.md - Common convention patterns across languagesRemember: Every codebase has its own personality. This skill teaches you to discover and respect that personality rather than imposing external standards.