CO

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.zip

Installs 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.
137 charsno explicit “when” trigger
Intermediate

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

You give it
unfamiliar codebases or complex modules
You get back
a markdown file documenting the analysis

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

  1. Locate main entry point (check __main__.py, main(), if __name__ == '__main__')
  2. Read function signatures at the top level
  3. Identify primary classes and their relationships
  4. Note major data structures and their purpose
  5. 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

  1. List all imports at top of file
  2. 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
  3. Identify which dependencies are critical vs. optional
  4. 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:

  1. Read docstring (purpose, inputs, outputs)
  2. Scan implementation (max 100 lines scan initially)
  3. Note if it's:
    • Data loading
    • Data transformation
    • Configuration handling
    • UI interaction
    • File I/O
    • External API calls
  4. 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

  1. Start from input (file, user input, API call)
  2. Follow data through transformations:
    • What format is it in at each stage?
    • What operations change it?
    • Where are branch points (different code paths)?
  3. End at output (file, return value, UI display)
  4. 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

  1. What are expected inputs? (data types, formats, sizes)
  2. What are outputs? (data types, formats, where stored)
  3. Are there configuration/parameter interfaces?
  4. Are there any callbacks or event hooks?
  5. What's the error handling strategy?
  6. 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

  1. Over-reading: Don't read every line. Skim, then deep-dive only on critical functions
  2. Missing dependencies: Always check what imports a function uses
  3. Assuming flow: Trace actual code paths, don't assume linear execution
  4. Ignoring config: Look for configuration systems that affect behavior
  5. 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:

  1. Save to /memories/repo/code-analysis-[module-name].md
  2. Include all sections from documentation template
  3. Add "Integration Recommendations" section for Code-Migrator
  4. 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.

SkillInstallsUpdatedSafetyDifficulty
code-analysis (this skill)04moNo flagsIntermediate
architect-review1094moNo flagsAdvanced
solid-principles579moNo flagsIntermediate
codex322moReviewAdvanced

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.

109320

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.

57236

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.

32238

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.

35170

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.

25170

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.

35110

Search skills

Search the agent skills registry