Skip to main content
ClaudeWave
ES, Spanish
Skill286 estrellas del repoactualizado 7mo ago

deep-analysis

Deep-analysis launches the codebase-detective agent with indexed semantic memory to investigate code functionality, architecture, and implementation patterns across multiple files. Use this skill when analyzing how features work, tracing code flow, finding where functionality is implemented, or understanding component dependencies, but only after validating tool selection with code-search-selector first.

Instalar en Claude Code
Copiar
git clone --depth 1 https://github.com/MadAppGang/claude-code /tmp/deep-analysis && cp -r /tmp/deep-analysis/plugins/code-analysis/skills/deep-analysis ~/.claude/skills/deep-analysis
Después abre una sesión nueva de Claude Code; el skill carga automáticamente.

SKILL.md

# Deep Code Analysis

This Skill provides comprehensive codebase investigation capabilities using the codebase-detective agent with semantic search and pattern matching.

## Prerequisites (MANDATORY)

```
╔══════════════════════════════════════════════════════════════════════════════╗
║                        BEFORE INVOKING THIS SKILL                             ║
╠══════════════════════════════════════════════════════════════════════════════╣
║                                                                              ║
║  1. INVOKE code-search-selector skill FIRST                                  ║
║     → Validates tool selection (claudemem vs grep)                           ║
║     → Checks if claudemem is indexed                                         ║
║     → Prevents tool familiarity bias                                         ║
║                                                                              ║
║  2. VERIFY claudemem status                                                  ║
║     → Run: claudemem status                                                  ║
║     → If not indexed: claudemem index -y                                     ║
║                                                                              ║
║  3. DO NOT start with Read/Glob                                              ║
║     → Even if file paths are mentioned in the prompt                         ║
║     → Semantic search first, Read specific lines after                       ║
║                                                                              ║
╚══════════════════════════════════════════════════════════════════════════════╝
```

## When to use this Skill

Claude should invoke this Skill when:

- User asks "how does [feature] work?"
- User wants to understand code architecture or patterns
- User is debugging and needs to trace code flow
- User asks "where is [functionality] implemented?"
- User needs to find all usages of a component/service
- User wants to understand dependencies between files
- User mentions: "investigate", "analyze", "find", "trace", "understand"
- User is exploring an unfamiliar codebase
- User needs to understand complex multi-file functionality

## Instructions

### Phase 1: Determine Investigation Scope

Understand what the user wants to investigate:

1. **Specific Feature**: "How does user authentication work?"
2. **Find Implementation**: "Where is the payment processing logic?"
3. **Trace Flow**: "What happens when I click the submit button?"
4. **Debug Issue**: "Why is the profile page showing undefined?"
5. **Find Patterns**: "Where are all the API calls made?"
6. **Analyze Architecture**: "What's the structure of the data layer?"

### Phase 2: Invoke codebase-detective Agent

Use the Task tool to launch the codebase-detective agent with comprehensive instructions:

```
Use Task tool with:
- subagent_type: "code-analysis:detective"
- description: "Investigate [brief summary]"
- prompt: [Detailed investigation instructions]
```

**Prompt structure for codebase-detective**:

```markdown
# Code Investigation Task

## Investigation Target
[What needs to be investigated - be specific]

## Context
- Working Directory: [current working directory]
- Purpose: [debugging/learning/refactoring/etc]
- User's Question: [original user question]

## Investigation Steps

1. **Initial Search** (CLAUDEMEM REQUIRED):
   - FIRST: Check `claudemem status` - is index available?
   - ALWAYS: Use `claudemem search "semantic query"` for investigation
   - NEVER: Use grep/glob for semantic understanding tasks
   - Search for: [concepts, functionality, patterns by meaning]

2. **Code Location**:
   - Find exact file paths and line numbers
   - Identify entry points and main implementations
   - Note related files and dependencies

3. **Code Flow Analysis**:
   - Trace how data/control flows through the code
   - Identify key functions and their roles
   - Map out component/service relationships

4. **Pattern Recognition**:
   - Identify architectural patterns used
   - Note code conventions and styles
   - Find similar implementations for reference

## Deliverables

Provide a comprehensive report including:

1. **📍 Primary Locations**:
   - Main implementation files with line numbers
   - Entry points and key functions
   - Configuration and setup files

2. **🔍 Code Flow**:
   - Step-by-step flow explanation
   - How components interact
   - Data transformation points

3. **🗺️ Architecture Map**:
   - High-level structure diagram
   - Component relationships
   - Dependency graph

4. **📝 Code Snippets**:
   - Key implementations (show important code)
   - Patterns and conventions used
   - Notable details or gotchas

5. **🚀 Navigation Guide**:
   - How to explore the code further
   - Related files to examine
   - Commands to run for testing

6. **💡 Insights**:
   - Why the code is structured this way
   - Potential issues or improvements
   - Best practices observed

## Search Strategy

### ⚠️ CRITICAL: Tool Selection

**BEFORE ANY SEARCH, CHECK CLAUDEMEM STATUS:**
```bash
claudemem status
```

### ✅ PRIMARY METHOD: claudemem (Indexed Memory)

```bash
# Index if needed
claudemem index -y

# Semantic search (ALWAYS use this for investigation)
claudemem search "authentication login session" -n 15
claudemem search "API endpoint handler route" -n 20
claudemem search "data transformation pipeline" -n 10
```

**Why claudemem is REQUIRED for investigation:**
- Understands code MEANING, not just text patterns
- Finds related code even with different terminology
- Returns ranked, relevant results
- AST-aware (understands code structure)

### ❌ WHEN NOT TO USE GREP

| User Request | ❌ DON'T | ✅ DO |
|-------------|----------|-------|
| "How does auth work?" | `grep -r "auth" src/` | `claudemem search "authentication flow"` |
| "Find API endpoints" | `grep -r "router" src/` | `claudemem search "API endpoint handler"` |
| "Trace data flow" | `grep -r "transform" src/` | `claudemem
adr-documentationSkill

Architecture Decision Records (ADR) documentation practice. Use when documenting architectural decisions, recording technical trade-offs, creating decision logs, or establishing architectural patterns. Trigger keywords - "ADR", "architecture decision", "decision record", "trade-offs", "architectural decision", "decision log".

agent-coordination-disciplineSkill

Use when deciding whether to launch an agent, selecting which agent to use, or coordinating multiple agents. Covers delegation criteria, external-model patterns, task isolation, and agent selection strategies.

api-designSkill

Use when designing REST or GraphQL APIs, defining endpoints, implementing pagination/filtering, handling API versioning, or establishing API documentation with OpenAPI/Swagger.

api-integrationSkill

Use when integrating Apidog + OpenAPI specifications with your React app. Covers MCP server setup, type generation, and query layer integration. Use when setting up API clients, generating types from OpenAPI, or integrating with Apidog MCP.

api-spec-analyzerSkill

Analyzes API documentation from OpenAPI specs to provide TypeScript interfaces, request/response formats, and implementation guidance. Use when implementing API integrations, debugging API errors (400, 401, 404), replacing mock APIs, verifying data types, or when user mentions endpoints, API calls, or backend integration.

architect-detectiveSkill

Use when analyzing architecture and system design. Find design patterns, map layers, identify core abstractions via PageRank. Uses claudemem AST structural analysis for efficient architecture investigation.

auditSkill

On-demand security and code quality audit. Use when checking for vulnerabilities, security issues, code smells, or compliance problems. Trigger keywords - "audit", "security check", "vulnerability scan", "code quality", "compliance", "security audit".

auth-patternsSkill

Use when implementing authentication (JWT, sessions, OAuth), authorization (RBAC, ABAC), password hashing, MFA, or security best practices for backend services.