跳到正文
Skillpedia
通用编程48k · #5097

logic-explain

它能做什么

这个工具会一步一步解释一段代码是如何运行的,展示当代码接收某个特定输入时,信息会发生怎样的变化。

适用场景

  • ✓当你不明白代码为什么会产生意外结果时。
  • ✓当你想看清代码运行过程中信息是如何变化的时。
  • ✓当你需要一份详细的代码执行说明时。

技能链接

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/logic-explain/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/logic-explain/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请用这个输入解释下面的代码:[代码],输入为:[输入]”

每周 5 个新技能,1 分钟读完。

工作原理

工具会分析代码和你提供的输入,然后详细列出每一个执行步骤,解释变量如何变化,以及代码如何在不同部分之间流转。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Logic-Lens — Execution Explain

When to Use

Use this skill when you need explain what a specific piece of code actually does for a given input by producing a step-by-step execution trace (interprocedural, with name resolution and type transitions). Trigger when the user is confused about behavior or asks why code produces X instead of Y — "walk me through...

Setup

Use lazy loading per ../_shared/common.md §13:

  1. Read ../_shared/common.md only for language, report header variants, scope routing, and loading budget.
  2. Read only the relevant step in logic-explain-guide.md as you reach it.
  3. Load ../_shared/semiformal-guide.md, ../_shared/semiformal-checklist.md, and ../_shared/report-template.md on demand when the current step needs them.

Note: logic-risks.md is intentionally skipped — logic-explain does not produce L-code findings, and Remedy is intentionally out of scope for this mode. If the trace reveals a bug, stop and recommend logic-review or logic-locate. When handing off, do not discard work already done — present the premises established and trace steps completed under a "Partial trace context (carry into next skill):" heading so the user can pass them directly to the follow-on skill.

Process

Step 0. Language + scope routing. Detect language per common.md §1. Confirm a single function + a single input scenario. If the user wants bug-finding without a scenario, hand off to logic-review.

Step 1. Entry point and scenario (guide Step 1) — name the function, the input scenario, and what the user is trying to understand.

Step 2. Build premises (guide Step 2) — resolve every non-obvious name, state the types of key variables at entry, note global/module state accessed.

Step 3. Produce step-by-step trace (guide Step 3) — numbered, interprocedural, active voice; cross function boundaries whenever relevant to the user's scenario. Keep the trace scenario-bound; do not branch into alternative paths unless they explain the user's confusion.

Step 4. Highlight non-obvious behavior (guide Step 4) — name resolutions, implicit coercions, hidden side effects; the "gotchas" the casual reader would miss.

Step 5. Summarize actual vs. assumed (guide Step 5) — one sentence each; this is the core value for the user.

Mode line in report: Execution Explain (Chinese: 执行解释).

Note: Execution Explain is descriptive, not evaluative. Omit the Logic Score / Fault Confidence / Verdict line from the report header.

Example

User request:

Explain what a specific piece of code actually does for a given input by producing a step-by-step execution trace (interprocedural, with name resolution and type transitions).

Limitations

  • Use this skill only when the task clearly matches its upstream source and local project context.
  • Verify commands, generated code, dependencies, credentials, and external service behavior before applying changes.
  • Do not treat examples as a substitute for environment-specific tests, security review, or user approval for destructive or costly actions.
常见问题

什么是“执行追踪”?

可以把它理解为一本日志,记录代码执行的每一步操作,以及每个时刻信息的状态。

“名称解析和类型转换”是什么意思?

意思是工具会说明每个名称(变量、函数)指向什么,以及在执行过程中数据类型(如数字、文本)是如何变化的。

这个工具会修复代码错误吗?

不会,它只解释代码是如何运行的。如果发现错误,它可能会建议你使用其他工具来修复。

详情

作者的原始描述

Explain what a specific piece of code actually does for a given input by producing a step-by-step execution trace (interprocedural, with name resolution and type transitions).

repo: sickn33/agentic-awesome-skills

热度

GitHub 星标
48k
排名
#5097
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能