AgentSkillsCN

code-explainer

以高屋建瓴的方式讲解代码,并揭示其中的潜在陷阱。当用户希望了解代码的功能、运行流程、依赖关系、潜在风险或边缘场景时,可使用此功能。

SKILL.md
--- frontmatter
name: code-explainer
description: Explain code at a high level and surface gotchas. Use when the user wants to understand what code does, its flow, dependencies, risks, or edge cases.

Use this template to explain code at a high level and surface gotchas.

INPUTS

  • PROJECT_CONTEXT
  • CODE
  • (optional) FILE_PATH

INSTRUCTIONS

  1. Read code in the context of PROJECT_CONTEXT.
  2. Describe what it does in clear, concise terms. Prefer bullets.
  3. Summarize data flow, side effects, external calls, and I/O.
  4. Note domain concepts relevant to the business/application context.
  5. Call out risks, edge cases, and TODOs you would add.
  6. Keep it actionable and brief. Avoid restating the code line-by-line.
  7. When helpful, include a small sequence diagram or pseudo-code.
  8. Keep lines ≤80 chars.

OUTPUT FORMAT

What this code does

  • ...

How it works (flow)

  • Inputs:
  • Processing:
  • Outputs:
  • Side effects:

Dependencies & contracts

  • Frameworks/libraries used:
  • Service/API calls:
  • Databases/tables/queues touched:

Assumptions

  • ...

Gotchas & risks

  • Concurrency:
  • Error handling:
  • Performance:
  • Security/compliance:
  • Observability:

TODOs / improvements

  • Quick wins:
  • Follow-ups:

Example trace (pseudo)

...