AgentSkillsCN

code-explainer

以高屋建瓴的方式讲解代码,并揭示其中的潜在陷阱。

SKILL.md
--- frontmatter
name: "code-explainer"
description: "Explain code at a high level and surface gotchas"

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

INPUTS

  • Code - the code to explain
  • (optional) File path

INSTRUCTIONS

  1. Read the provided code.
  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)

...