一键导入
analyze-code
Analyze and explain how a specific file, class, or feature works — trace data flow, logic, and dependencies with file paths and line numbers
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Analyze and explain how a specific file, class, or feature works — trace data flow, logic, and dependencies with file paths and line numbers
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | analyze-code |
| description | Analyze and explain how a specific file, class, or feature works — trace data flow, logic, and dependencies with file paths and line numbers |
| metadata | {"phase":"orient","input":"file path, class name, or feature name","output":"structured analysis covering entry points, core logic flow, key methods, data flow, dependencies, and error handling","dependencies":"codebase-memory-mcp, graphify"} |
Analyze HOW a component or feature works — trace data flow, explain logic, and map dependencies. Read code thoroughly before explaining.
Use this skill when the user:
target: $ARGUMENTS — file path, class name, or feature name
Load context per # WORKSPACE → Context Loading, matching Tier 1 on Files if target is a path, or on Keywords if it's a class/feature name. Existing docs may already answer part of the analysis and save re-deriving it from scratch.
This skill only reads indexes — it never builds them. Building is the codebase-indexing
skill's job. If an index is missing, fall back immediately; don't block on a build.
Try codebase-memory-mcp first (structural analysis):
index_status, then search_graph() / trace_path()index_repository)Step 0.5b: Try graphify (semantic context):
.docs/indexing/graphify/ exists and try a graph querycodebase-indexing)search_graph(name_pattern, qn_pattern) to find the target function/classget_architecture() to understand how it fits in the system layerstrace_path(function_name, mode=calls) to find who calls this componenttrace_path(function_name, mode=calls) to map the full call chaintrace_path(function_name, mode=data_flow) to trace data transformations through the call stackget_code_snippet(qualified_name, range) to extract exact code with line numbers## Analysis: [Component/Feature Name]
### Overview
High-level description of what this component does and its role in the system.
### Entry Points
- `path/to/file.rb:45` — description
### Core Logic Flow
1. Step one at `file.rb:12`
2. Step two at `file.rb:34`
3. ...
### Key Methods
- `method_name` (`file.rb:56`) — what it does
### Data Flow
Input → Step → Step → Output
### Dependencies
- External: gem names, APIs
- Internal: other lib/app classes
### Error Handling
- What raises, what rescues, what gets logged
Create GitHub pull requests — picks the most token-efficient available method (gh CLI, GitHub MCP, or git push), and sources the PR body from an existing spec/plan instead of re-analyzing the diff
Prime — load project context by reading docs, the docs_context layer, core docs, and TODO before starting any task
Feature planning — research codebase, design options, write a structured spec/implementation plan to the project specs directory
Generate feature documentation by analyzing code changes and specifications — creates markdown docs in docs/core/ with conditional context
Bootstrap any project's AI workspace — detect the current tool, extract hardcoded paths from skill/command/agent files, write a central workspace.md, update all files to use config keys
Build or refresh the codebase graph indexes (codebase-memory-mcp structural index + graphify semantic graph) that other skills read from. The single writer — idempotent, incremental, safe to call repeatedly.