code-analysis
A structured methodology for understanding large or complex codebases by mapping entry points, dependencies, and data flow.
Install
mkdir -p .claude/skills/code-analysis && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/15027" && unzip -o skill.zip -d .claude/skills/code-analysis && rm skill.zipInstalls to .claude/skills/code-analysis
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Analyze unfamiliar codebases using a structured 5-phase method: entry points, dependencies, functions, data flow, and integration points.Key capabilities
- →Locate main entry points in codebases
- →Map external and internal dependencies
- →Decompose code into functional components
- →Trace data flow through transformations
- →Analyze integration points for modules
How it works
The skill systematically analyzes code by progressing through five phases: entry point discovery, dependency mapping, functional decomposition, data flow tracing, and integration point analysis. It uses tools like grep_search, read_file, and semantic_search to gather information at each stage.
Inputs & outputs
When to use code-analysis
- →Analyze an unfamiliar module
- →Reverse-engineer data flows
- →Map dependencies in a new project
About this skill
Code Analysis Skill
Purpose
Systematic methodology for understanding unfamiliar code bases and complex modules. Used by Code-Reader Agent.
When to Apply
- Analyzing A1111 postprocessing-for-training module
- Exploring waifuc, gradio, or other core dependencies
- Understanding existing dataset-cat components
- Reverse-engineering data flow in complex pipelines
5-Phase Analysis Process
Phase 1: Entry Point Discovery (10-15 min)
Goal: Find where code execution starts and understand high-level flow
- Locate main entry point (check
__main__.py,main(),if __name__ == '__main__') - Read function signatures at the top level
- Identify primary classes and their relationships
- Note major data structures and their purpose
- Create a 30,000-foot view mental model
Tools: grep_search (find entry points), read_file (top 50 lines)
Output: "This module's main entry is X, it does Y by calling Z components"
Phase 2: Dependency Mapping (10-20 min)
Goal: Understand external dependencies and their roles
- List all imports at top of file
- For each third-party import, note its purpose:
- image processing: pillow, opencv-python, etc.
- ML/models: torch, torchvision, basicsr, realesrgan
- data: waifuc, gallery-dl
- UI: gradio
- Identify which dependencies are critical vs. optional
- Check versions if available (requirements.txt, setup.py)
Tools: read_file (imports section), grep_search (import usage)
Output: "This uses X library for Y, and Z library for W"
Phase 3: Functional Decomposition (15-30 min)
Goal: Understand what each major component does
For each significant function/class:
- Read docstring (purpose, inputs, outputs)
- Scan implementation (max 100 lines scan initially)
- Note if it's:
- Data loading
- Data transformation
- Configuration handling
- UI interaction
- File I/O
- External API calls
- Document key parameters and return values
Tools: semantic_search (find related functions), read_file (function bodies)
Output: Bulleted list of "Function X: Does Y with inputs A, B and returns C"
Phase 4: Data Flow Tracing (20-40 min)
Goal: Understand how data moves through the system
- Start from input (file, user input, API call)
- Follow data through transformations:
- What format is it in at each stage?
- What operations change it?
- Where are branch points (different code paths)?
- End at output (file, return value, UI display)
- Note any state mutations or side effects
Tools: grep_search (variable tracking), read_file (transformation code), semantic_search (related operations)
Output: Diagram or text flow like "Input image → Resize → Crop → Save"
Phase 5: Integration Point Analysis (10-20 min)
Goal: Determine how to connect this code to dataset-cat
- What are expected inputs? (data types, formats, sizes)
- What are outputs? (data types, formats, where stored)
- Are there configuration/parameter interfaces?
- Are there any callbacks or event hooks?
- What's the error handling strategy?
- Are there any assumptions about the environment?
Tools: grep_search (look for config handlers, error handlers), read_file (parameter definitions)
Output: "Integration requires: X format input, Y format output, Z configuration options"
Documentation Template
Create a markdown file with:
# [Module Name] Analysis
## High-Level Purpose
[1-2 sentences about what it does]
## Entry Point(s)
- `function_name()` in file.py
## Key Components
- **Class/Function Name**: Brief purpose
- Inputs: Type and format
- Outputs: Type and format
- Key parameters: What they control
## Dependencies
- `library_name`: Purpose and critical operations
## Data Flow
[Text or ASCII diagram showing transformation pipeline]
## Integration Points
- Input format: [description]
- Output format: [description]
- Configuration: [parameters and defaults]
- Error handling: [strategy]
- Environment assumptions: [any special setup needed]
## Lessons for Implementation
- [Potential pitfalls]
- [Design patterns used]
- [Reusable components]
Common Pitfalls to Avoid
- Over-reading: Don't read every line. Skim, then deep-dive only on critical functions
- Missing dependencies: Always check what imports a function uses
- Assuming flow: Trace actual code paths, don't assume linear execution
- Ignoring config: Look for configuration systems that affect behavior
- Missing side effects: Watch for mutations, file I/O, or network calls
Tools Usage Tips
- grep_search: Find function definitions and usages quickly
- semantic_search: When you need "find all code that handles X"
- read_file: Study logic, not just browse; read with context (50+ line ranges)
- file_search: Locate files when you only know partial names
Time Budgets
- Small file/function: 10-15 minutes total
- Medium module: 30-45 minutes total
- Large codebase: 60-90 minutes (might need multiple session focus areas)
Memory Archiving
Always end analysis with stored findings:
- Save to
/memories/repo/code-analysis-[module-name].md - Include all sections from documentation template
- Add "Integration Recommendations" section for Code-Migrator
- Keep findings readable and scannable (short bullets, examples)
When not to use it
- →When a codebase is already familiar
- →When only a high-level overview is needed without detailed understanding
- →When time budgets are extremely limited for analysis
Limitations
- →The skill is designed for understanding unfamiliar codebases and complex modules.
- →Analysis time budgets range from 10-15 minutes for small files to 60-90 minutes for large codebases.
- →The output is a markdown file following a specific documentation template.
How it compares
This skill provides a structured, phased approach to understanding code, unlike a manual review that might lack a systematic process for identifying key components and interactions.
Compared to similar skills
code-analysis side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| code-analysis (this skill) | 0 | 4mo | No flags | Intermediate |
| architect-review | 109 | 4mo | No flags | Advanced |
| solid-principles | 57 | 9mo | No flags | Intermediate |
| codex | 32 | 2mo | Review | Advanced |
Try saying
Example prompts that trigger this skill in your AI assistant.
You might also like
architect-review
sickn33
Master software architect specializing in modern architecture patterns, clean architecture, microservices, event-driven systems, and DDD. Reviews system designs and code changes for architectural integrity, scalability, and maintainability. Use PROACTIVELY for architectural decisions.
solid-principles
SmidigStorm
Enforce SOLID principles (Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, Dependency Inversion) in object-oriented design. Use when writing or reviewing classes and modules.
codex
Lucklyric
Invoke Codex CLI for complex coding tasks requiring high reasoning capabilities. This skill should be invoked when users explicitly mention "Codex", request complex implementation challenges, advanced reasoning, or need high-reasoning model assistance. Automatically triggers on codex-related requests and supports session continuation for iterative development.
error-handling-patterns
wshobson
Master error handling patterns across languages including exceptions, Result types, error propagation, and graceful degradation to build resilient applications. Use when implementing error handling, designing APIs, or improving application reliability.
deepwiki-rs
sopaco
AI-powered Rust documentation generation engine for comprehensive codebase analysis, C4 architecture diagrams, and automated technical documentation. Use when Claude needs to analyze source code, understand software architecture, generate technical specs, or create professional documentation from any programming language.
senior-fullstack
davila7
Comprehensive fullstack development skill for building complete web applications with React, Next.js, Node.js, GraphQL, and PostgreSQL. Includes project scaffolding, code quality analysis, architecture patterns, and complete tech stack guidance. Use when building new projects, analyzing code quality, implementing design patterns, or setting up development workflows.