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。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 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:
- Read
../_shared/common.mdonly for language, report header variants, scope routing, and loading budget. - Read only the relevant step in
logic-explain-guide.mdas you reach it. - Load
../_shared/semiformal-guide.md,../_shared/semiformal-checklist.md, and../_shared/report-template.mdon 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).
热度
- GitHub 星标
- 48k
- 排名
- #5097
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
00-andruia-consultant
48k帮你的智能体启动或改进 AI 项目。它可以分析代码、推荐工具,并用西班牙语制定行动计划。
007
48k让你的智能体执行安全审计和威胁建模。它有助于保护项目免受攻击和漏洞的威胁。
10-andruia-skill-smith
48k帮你的智能体创建或改进 AI 工具。它可以定义工具的工作方式、编写文档,并验证其结构。
20-andruia-niche-intelligence
48k让你的智能体创建某个特定行业的摘要。它有助于借助可靠的信息来源,了解项目的背景、规则、使用模式和风险。