Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问许可证需确认审计通过

code-analyzer代码分析器

Agent Skill

code-analyzer 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

1,639

周安装

69

GitHub Stars

6

下载量

574
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:code-analyzer(代码分析器)
来源仓库:https://github.com/synapsync/synapse_registry
仓库路径:skills/code-analyzer
安装命令:
npx skills add https://github.com/synapsync/synapse_registry --skill code-analyzer
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/synapsync/synapse_registry --skill code-analyzer

简介

code-analyzer 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词快速定位候选结果时使用。

  • 适用于代码质量检测、性能瓶颈识别或架构合规性检查等研究检索类任务场景。
  • 通过关键词、任务描述或来源线索触发检索,返回结构化候选信息供进一步核验。
  • 安装命令为 npx skills add https://github.com/synapsync/synapse_registry --skill code-analyzer。
  • 使用前建议确认权限范围、维护状态,以及是否会触发联网或文件读写操作。

SKILL.md

Purpose

Act as a Senior Software Architect + Tech Lead to analyze code modules and produce structured technical reports that explain internal behavior, module communication, architectural patterns, and system relationships — with Mermaid diagrams.

CRITICAL RULES 1. Never assume context that doesn't exist. Only report what the code explicitly shows. 2. Never invent dependencies. If a dependency isn't visible in imports, configs, or code, don't add it. 3. If information is missing, say so explicitly. Document unknowns as unknowns, not guesses. 4. Never copy full source code into the report. Explain how the code works — don't reproduce it.

When to Use This Skill

  • Onboarding: New team members need to understand how a module works
  • Technical audit: Reviewing module responsibilities, dependencies, and communication patterns
  • Refactoring preparation: Understanding the current state before making architectural changes
  • Living documentation: Generating reusable technical docs from actual code
  • Code review context: Understanding the bigger picture around a set of changes
  • Incident analysis: Tracing how a module interacts with others to debug systemic issues

Capabilities

Code Analysis

  • Internal module behavior and execution flow
  • Function/class responsibility mapping
  • State management and error handling patterns
  • Dependency identification (internal and external)

Architecture Assessment

  • Architectural pattern detection (MVC, Clean Architecture, Hexagonal, etc.)
  • Module boundary and responsibility analysis
  • Coupling and cohesion evaluation
  • Design principle adherence (SOLID, DRY, etc.)

Communication Mapping

  • Inter-module communication (sync/async)
  • API surface analysis (what a module exposes and consumes)
  • Event-driven patterns (pub/sub, event emitters, message queues)
  • Shared state and data flow analysis

Technical Documentation

  • Structured markdown reports
  • Mermaid diagrams (flowcharts, sequence, class, C4)
  • Executive summaries for non-technical stakeholders
  • Detailed technical breakdowns for engineers

Input Expected

The user provides:

InputRequiredDescription
Module/file pathYesPath to the code to analyze (e.g., /src/modules/orders)
Code fragmentsOptionalPartial or complete code snippets if not accessible via filesystem
Language/frameworkOptionalIf not detectable from code (e.g., "NestJS", "Next.js", "FastAPI")
Additional contextOptionalBusiness context, known constraints, specific questions
Analysis depthOptionalv1 (explanation), v2 (+ diagrams), v3 (+ refactor recommendations)

Example prompts:

  • "Analyze the module at /src/modules/payments"
  • "Explain how /apps/core/auth works and how it connects to other modules"
  • "Do a v3 analysis of /src/services/notification-service.ts"

Configuration Resolution

{output_dir} is the directory where code-analyzer stores generated reports. Resolve it once at the start:

  1. User message context — If the user's message contains file paths, extract {output_dir} from those paths
  2. Auto-discover — Scan for .agents/code-analyzer/ in {cwd}
  3. Ask the user — If nothing found, ask where to save reports. Default suggestion: .agents/code-analyzer/{scope}/ (where {scope} is the topic, e.g., auth-module, api-layer)

No AGENTS.md. No branded blocks. The output directory is resolved at runtime.

Obsidian Output Standard

All documents generated by this skill MUST follow these Obsidian output rules:

  1. Frontmatter: Every .md file includes the universal frontmatter schema (title, date, updated, project, type, status, version, tags, changelog, related)
  2. Types: Use technical-report for REPORT.md, refactor-plan for REFACTOR.md
  3. Wiki-links: When both REPORT.md and REFACTOR.md exist, cross-reference with [[REPORT]] / [[REFACTOR]]
  4. Referencias: Every document ends with ## Referencias listing related analysis documents
  5. Metrics: Use | Metric | Before | After | Delta | Status | format for code quality metrics, complexity scores, and coverage data
  6. IDs: Use D- for debt items in refactor plans
  7. Bidirectional: If REFACTOR.md references REPORT.md, REPORT.md must reference REFACTOR.md

See assets/templates/ for complete frontmatter schemas and document structures.

Workflow

Step 1: Discovery

Read and explore the target module/file to understand its structure.

Actions:

  1. Read the target path — identify all files, directories, and entry points
  2. Detect the language and framework from file extensions, imports, and config files
  3. Identify the module boundary (what's inside vs. outside the module)
  4. List all files that belong to the module

Output: Internal understanding of the module's file structure and technology stack.

Step 2: Deep Analysis

Analyze the code to understand internal behavior.

Actions:

  1. Identify the module's main responsibilities — what does it do?
  2. Map key functions/classes and their roles
  3. Trace the primary execution flow — entry point to output
  4. Analyze state management — how data flows and transforms
  5. Analyze error handling — how failures are managed
  6. List internal dependencies (other modules in the same project)
  7. List external dependencies (third-party libraries, APIs, services)

Output: Deep understanding of behavior, responsibilities, and dependencies.

Step 3: Communication Mapping

Understand how the module talks to the rest of the system.

Actions:

  1. Identify what the module consumes (imports, API calls, events listened to)
  2. Identify what the module exposes (exports, API endpoints, events emitted)
  3. Classify communication types: synchronous (function calls, HTTP) vs. asynchronous (events, queues, WebSockets)
  4. Identify shared state (global stores, shared databases, caches)

Output: Clear map of module boundaries and communication channels.

Step 4: Report Generation

Produce the structured technical report with all findings.

Actions:

  1. Write the report following the Output Structure (see below)
  2. Generate Mermaid diagrams for visual understanding
  3. Save the report to {output_dir}/technical/module-analysis/{module-name}/
  4. Add ## Referencias section at the end of the report (link to REFACTOR.md if v3, link to any other analysis documents for the same module)

Output: Complete markdown report with diagrams.

Step 5: Refactor Recommendations (v3 only)

If the user requests a v3 analysis, add improvement suggestions.

Actions:

  1. Identify code smells and architectural issues
  2. Suggest specific, actionable improvements
  3. Rate each recommendation by impact and effort
  4. Prioritize recommendations
  5. Add ## Referencias section linking back to [[REPORT]] and any related analysis documents

Output: Actionable refactoring roadmap appended to the report.

Output Location

All reports are saved to a central technical documentation directory:

{output_dir}/technical/module-analysis/
└── {module-name}/
    ├── REPORT.md              # Main technical report
    └── REFACTOR.md            # Refactoring recommendations (v3 only)

Naming convention: Use the module's folder name in kebab-case.

  • /src/modules/OrderService{output_dir}/technical/module-analysis/order-service/
  • /apps/core/payments{output_dir}/technical/module-analysis/payments/
  • /src/services/notification-service.ts{output_dir}/technical/module-analysis/notification-service/

Output Structure

See assets/templates/ for complete document structures:

  • REPORT.md — Technical analysis report template with Executive Summary, Technical Analysis, Module Communication, Technical Diagrams, Metrics, and Referencias sections
  • REFACTOR.md — Refactoring recommendations template (v3 only) with Code Smells, Recommendations, Priority Matrix, Implementation Plan, Impact Analysis, Testing Strategy, and Referencias sections

Key Sections Overview

REPORT.md includes:

  1. Executive Summary (module overview, purpose, criticality, technology)
  2. Technical Analysis (responsibilities, key functions, execution flow, state management, error handling, dependencies)
  3. Module Communication (consumes, exposes, communication types, shared state)
  4. Technical Diagrams (Mermaid diagrams based on complexity)
  5. Metrics (code quality metrics using standard format)
  6. Referencias (bidirectional links to related documents)

REFACTOR.md (v3 only) includes:

  1. Code Smells (issues with severity ratings)
  2. Recommendations (actionable improvements with priority, impact, effort)
  3. Priority Matrix (visual representation of recommendations)
  4. Implementation Plan (phased refactoring roadmap)
  5. Impact Analysis (affected components, risk assessment, expected benefits)
  6. Testing Strategy (validation approach)
  7. Referencias (link back to REPORT.md)

Analysis Depth Levels

LevelNameIncludesUse When
v1ExplanationExecutive Summary + Technical Analysis + CommunicationQuick understanding of a module
v2Explanation + DiagramsEverything in v1 + Mermaid DiagramsDocumentation or onboarding (default)
v3Full AnalysisEverything in v2 + Refactoring RecommendationsPre-refactoring audit or technical review

Default: If the user doesn't specify a level, use v2.

Critical Patterns

Pattern 1: Read Before You Write

Always read the actual code before generating any analysis. Never produce a report based on file names, folder structure, or assumptions alone. If a file can't be read, document it as "inaccessible" rather than guessing its contents.

Pattern 2: Explain, Don't Copy

The report explains how code works — it does not reproduce it. Use short inline snippets (1-3 lines) only when necessary to illustrate a specific pattern or behavior. Never paste full functions, classes, or files.

Bad: Pasting a 50-line function into the report Good: "The processPayment() function validates the input, calls the payment gateway via gateway.charge(), and emits a payment.completed event on success."

Pattern 3: Explicit Unknowns

When information is not available or cannot be determined from the code:

Bad: Making assumptions about what a module probably does Good: "The module imports @core/events but the event handler implementations are not visible in this scope. The specific events consumed could not be determined."

Pattern 4: Dependency Honesty

Only list dependencies that are explicitly visible in the code (imports, require statements, config files, dependency injection). If a dependency is suspected but not confirmed, mark it as "suspected" with reasoning.

Pattern 5: Context-Appropriate Diagrams

See assets/helpers/diagram-guidelines.md for detailed Mermaid diagram selection criteria, syntax examples, and best practices. Match diagram complexity to module complexity (simple = flowchart only, medium = flowchart + sequence, complex = flowchart + sequence + class/C4).

Pattern 6: Technology-Agnostic Analysis

The analysis framework works for any language or framework. Adapt terminology to match the technology:

ConceptJavaScript/TypeScriptPythonGoJava
ModuleModule/PackageModule/PackagePackagePackage
Entry pointindex.ts / export__init__.pymain.goApplication.java
InterfaceType/InterfaceProtocol/ABCInterfaceInterface
Dependency injectionConstructor/Provider__init__ paramsStruct fields@Inject

Best Practices

Before Analysis

  1. Confirm the target path exists — verify the module path before starting
  2. Identify the project type — monorepo, single app, microservice, library
  3. Check for existing documentation — READMEs, JSDoc, docstrings, OpenAPI specs
  4. Ask for context if needed — don't guess business requirements

During Analysis

  1. Start from entry points — find the main export, router, or handler first
  2. Trace the happy path first — understand the normal flow before edge cases
  3. Map dependencies as you go — build the dependency graph incrementally
  4. Note patterns as you see them — architectural patterns emerge from reading, not guessing
  5. Check test files — tests reveal intended behavior and edge cases

After Analysis

  1. Review the report for accuracy — every statement must be backed by code you read
  2. Verify diagram correctness — ensure diagrams match the textual analysis
  3. Check for missing sections — all required output sections must be present
  4. Save to the correct location{output_dir}/technical/module-analysis/{module-name}/

Integration with Other Skills

With universal-planner

Use code-analyzer during the Analysis Phase (Step 1) of universal-planner to understand the current state of modules that will be affected by the planned work.

With universal-planner (EXECUTE mode)

Before executing a sprint that modifies a module, run code-analyzer to document the "before" state for comparison.

Limitations

  1. Requires file access: Cannot analyze code that isn't readable via the filesystem. If the user provides code fragments, analysis is limited to what's visible
  2. No runtime analysis: Analyzes static code only — cannot detect runtime behavior, performance characteristics, or dynamic dispatch patterns
  3. Single module focus: Analyzes one module at a time. Cross-module analysis requires separate runs and manual correlation
  4. No automated testing: Does not execute tests or verify that the code works — only analyzes structure and patterns
  5. Framework detection: May not recognize custom or obscure frameworks. The user can provide framework context to compensate

Post-Production Delivery

After generating the technical report (and refactoring recommendations if v3), offer the user delivery options:

  1. Sync to Obsidian vault — invoke the obsidian skill in SYNC mode (see invocation below)
  2. Move to custom path — user specifies a destination and files are moved there
  3. Keep in staging — leave files in {output_dir} for later use

Ask the user which option they prefer.

Obsidian invocation (option 1):

  • Preferred: Skill("obsidian"), then say "sync the files in {output_dir} to the vault"
  • Alternative: Say "sync the output to obsidian" (triggers auto_invoke)
  • Subagent fallback: Read the obsidian SKILL.md and follow SYNC mode workflow

Troubleshooting

IssueSolution
Module path doesn't existVerify path with user, check for typos, case sensitivity, or moved files
Can't determine frameworkAsk user to specify, check config files (package.json, requirements.txt, etc.)
Module too largeBreak into sub-modules, analyze separately, create top-level summary
Dependencies unclearMark as "suspected" with reasoning, check DI containers and config files
Report seems incompleteVerify all files read, check for dynamic imports or config-driven behavior

Example Output

See assets/templates/REPORT.md and assets/templates/REFACTOR.md for complete examples including Executive Summary, Communication Maps, Mermaid diagrams, and all other sections.

Future Enhancements

Multi-module analysis, dependency graph visualization, automated change detection, test coverage integration, and export to Confluence/Notion.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

38.02%
按下载量换算218

Claude

27.87%
按下载量换算160

Cursor

17.91%
按下载量换算103

Gemini CLI

9.89%
按下载量换算57

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills