codebase-context-extractor

17
1
Source

This skill provides a comprehensive context extraction system for large codebases. It intelligently analyzes code structure, dependencies, and relationships to extract relevant context for understanding, debugging, or modifying code.

Install

mkdir -p .claude/skills/codebase-context-extractor && curl -L -o skill.zip "https://mcp.directory/api/skills/download/1822" && unzip -o skill.zip -d .claude/skills/codebase-context-extractor && rm skill.zip

Installs to .claude/skills/codebase-context-extractor

About this skill

Codebase Context Extractor Skill

Overview

This skill provides a comprehensive context extraction system for large codebases. It intelligently analyzes code structure, dependencies, and relationships to extract relevant context for understanding, debugging, or modifying code.

Trigger Words

  • "extract context"
  • "codebase context"
  • "code context"
  • "analyze codebase"
  • "codebase analysis"
  • "code structure"
  • "dependency analysis"
  • "code relationships"
  • "understand codebase"
  • "map codebase"

When to Use This Skill

Use this skill when you need to:

  • Understand the structure and organization of a large codebase
  • Extract relevant context for a specific function, class, or module
  • Analyze dependencies and relationships between code components
  • Generate documentation or summaries of code sections
  • Prepare context for code modifications or debugging
  • Identify entry points and execution flows
  • Map out API surfaces and public interfaces
  • Understand data flow and state management

Instructions

When this skill is triggered, execute the context_extractor.py script with appropriate parameters.

Basic Usage

python /projects/workspace/codebase-context-extractor/context_extractor.py \
  --target-path <path_to_codebase> \
  --mode <extraction_mode> \
  --output <output_file>

Extraction Modes

  1. full - Complete codebase analysis with all components
  2. targeted - Focus on specific files, functions, or classes
  3. dependency - Map dependencies and imports
  4. flow - Trace execution flows and call chains
  5. api - Extract public interfaces and API surfaces
  6. data - Analyze data structures and models
  7. hierarchy - Show class hierarchies and inheritance
  8. summary - Generate high-level overview

Parameters

  • --target-path (required): Path to the codebase to analyze
  • --mode (required): Extraction mode (see above)
  • --output (optional): Output file path (default: stdout)
  • --focus (optional): Specific file, class, or function to focus on
  • --depth (optional): Maximum depth for traversal (default: unlimited)
  • --include-tests (optional): Include test files in analysis (default: false)
  • --language (optional): Programming language (auto-detected if not specified)
  • --format (optional): Output format (markdown, json, yaml, text) (default: markdown)
  • --exclude (optional): Patterns to exclude (comma-separated)

Examples

  1. Full codebase analysis:
python context_extractor.py --target-path ./my-project --mode full --output context.md
  1. Targeted analysis of a specific class:
python context_extractor.py --target-path ./my-project --mode targeted --focus "UserService" --output user_service_context.md
  1. Dependency mapping:
python context_extractor.py --target-path ./my-project --mode dependency --format json --output dependencies.json
  1. Execution flow analysis:
python context_extractor.py --target-path ./my-project --mode flow --focus "main" --depth 5

Output Structure

The extractor generates structured output including:

For Full/Targeted Mode

  • Project Overview: Language, structure, entry points
  • File Organization: Directory structure and file purposes
  • Key Components: Important classes, functions, modules
  • Dependencies: External and internal dependencies
  • Code Metrics: Lines of code, complexity estimates
  • Context Summary: High-level understanding

For Dependency Mode

  • Dependency Graph: Visual representation of dependencies
  • Import Analysis: All imports and their usage
  • Circular Dependencies: Detection and reporting
  • Unused Dependencies: Potential cleanup targets

For Flow Mode

  • Call Chains: Function call sequences
  • Entry Points: Main execution paths
  • Exit Points: Return and error handling
  • Branch Analysis: Conditional execution paths

For API Mode

  • Public Interfaces: Exported functions and classes
  • API Documentation: Signatures and docstrings
  • Usage Examples: How to use the API
  • Versioning Info: API version and compatibility

Advanced Features

Smart Context Window Management

The extractor automatically manages context size to fit within LLM token limits:

  • Prioritizes most relevant code sections
  • Provides summaries for less critical parts
  • Includes breadcrumb navigation for context

Multi-Language Support

Supports analysis of:

  • Python
  • JavaScript/TypeScript
  • Java
  • C#
  • Go
  • Rust
  • C/C++
  • Ruby
  • PHP
  • And more (extensible)

Intelligent Filtering

  • Excludes generated code, build artifacts, and vendor directories
  • Focuses on business logic and core functionality
  • Configurable exclusion patterns

Integration with Other Tools

The context extractor output can be used with:

  • Documentation generators
  • Code review tools
  • Refactoring assistants
  • Bug tracking systems
  • Development environments

Best Practices

  1. Start with Summary Mode: Get a high-level overview before diving deep
  2. Use Targeted Mode for Specific Tasks: Focus on relevant code sections
  3. Combine with Dependency Analysis: Understand impact of changes
  4. Leverage Flow Analysis for Debugging: Trace execution paths
  5. Regular Updates: Re-run analysis as codebase evolves

Notes

  • Large codebases may take time to analyze
  • Consider using depth limits for very large projects
  • JSON output is best for programmatic processing
  • Markdown output is best for human reading
  • The tool respects .gitignore patterns by default

You might also like

flutter-development

aj-geddes

Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.

286790

drawio-diagrams-enhanced

jgtolentino

Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.

212415

godot

bfollington

This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.

206291

nano-banana-pro

garg-aayush

Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.

217234

ui-ux-pro-max

nextlevelbuilder

"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."

171200

rust-coding-skill

UtakataKyosui

Guides Claude in writing idiomatic, efficient, well-structured Rust code using proper data modeling, traits, impl organization, macros, and build-speed best practices.

165173

Stay ahead of the MCP ecosystem

Get weekly updates on new skills and servers.