skills/yigegongjiang/jj-skills/code-path-analyzer

code-path-analyzer

SKILL.md

Path Analyzer

Analyze the functional role and dependency relationships of a given path (file or folder) within the current project.

Workflow

1. Determine Path Type

  • If the path is a file: read it directly.
  • If the path is a directory: use Glob to list all files recursively, then read key files (prioritize entry points, index files, and type definitions).

2. Analyze Functional Role

For each file in the path, identify:

  • Core responsibility: What this code does in one sentence.
  • Exports: Key functions, classes, components, types, or constants exported.
  • Side effects: Database operations, API calls, file I/O, global state mutations.

3. Map Dependencies

  • Inbound dependencies (who uses this code): Use Grep to search for imports/references to the path across the project. Summarize which modules depend on this code.
  • Outbound dependencies (what this code uses): Extract import statements from the files. Categorize as internal (project modules) vs external (npm packages, stdlib).

4. Synthesize Report

Compose a clear analysis covering:

  1. 功能概要: One paragraph summarizing what this path does and why it exists.
  2. 核心职责: Bullet list of key responsibilities.
  3. 对外暴露: Exported API surface (functions, components, types).
  4. 依赖关系:
    • 被谁依赖(inbound): Which modules import/use this code.
    • 依赖谁(outbound): What this code imports from elsewhere.
  5. 在工程中的定位: How this path fits into the overall architecture.

Output Guidelines

  • Adapt format to complexity: use structured Markdown for complex paths, concise text for simple files.
  • Use Chinese for explanations; keep code identifiers in original form.
  • For directories with many files, group analysis by sub-module or functional area rather than listing every file.
  • Focus on "what and why", not line-by-line code walkthrough.
Weekly Installs
2
First Seen
1 day ago
Installed on
codex2
claude-code2
cline1