logic-diff
Compare two code versions for semantic equivalence via semi-formal tracing of both versions side-by-side.
它会碰到什么
这一栏是扫描器报的事实,不是结论。命中多不等于有毒(安全工具、规则库、示例脚本本来就会包含危险写法),命中少也不等于干净。它和你手上的凭据、文件、网络有什么关系,需要你自己看。
技能内容
Logic-Lens — Semantic Diff
When to Use
Use this skill when you need compare two code versions for semantic equivalence via semi-formal tracing of both versions side-by-side. Trigger when the user shares a refactor, rewrite, migration, or A/B implementation and wants to confirm behavior is unchanged — "did I break anything", "is this equivalent", "are...
Setup
Use lazy loading per ../_shared/common.md §13:
- Read
../_shared/common.mdonly for language, Iron Law, Verdict header, scope routing, Remedy discipline, config fields, and loading budget. - Read only the relevant step in
logic-diff-guide.mdas you reach it. - Load
../_shared/logic-risks.md,../_shared/semiformal-guide.md,../_shared/semiformal-checklist.md, and../_shared/report-template.mdon demand when the current step needs them.
Process
Step 0. Language + scope routing. Detect language per common.md §1. Confirm two versions are provided. If only one version, switch to logic-review.
Step 1. Identify the shared specification (guide Step 1) — what inputs should both versions handle; what outputs/side effects are expected. If the user states the refactor intentionally changed behavior in a specific area (e.g., "I changed the error path to raise instead of returning None"), record that as a declared spec change and treat divergences within that area as expected. Flag only divergences outside the declared change as findings.
Step 2. Build independent premises for each version (guide Step 2) — apply the Premises Construction Checklist to Version A and Version B separately.
Step 3. Trace both versions for the common case (guide Step 3) — parallel trace, same input, note the first divergence if any.
Step 4. Trace boundary cases (guide Step 4) — empty/null/zero, max/min, error inputs, first/last of collections. Start with at most three highest-risk boundary scenarios unless the user asks for exhaustive equivalence or the shared specification requires more.
Step 5. Identify and classify semantic divergences (guide Step 5) — each divergence is a finding with Premises → Trace → Divergence → Trigger → Remedy and an L-code.
Step 6. Equivalence verdict (guide Step 6) — one of: ✅ Semantically Equivalent, ⚠️ Conditionally Equivalent (state the condition precisely), ❌ Semantically Divergent.
Step 7. Output (guide Step 7) — Report Template with the Verdict header per common.md §5; localize headers if the user wrote in Chinese. Format is mandatory even for trivially short snippets: every divergence finding MUST use the five labeled fields (Premises / Trace / Divergence / Trigger / Remedy); never substitute with a plain paragraph or table.
Mode line in report: Semantic Diff (Chinese: 语义对比).
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.
想直接用这个技能?
本站把开放许可(MIT / Apache 等)的技能按仓库打包整理到网盘,点一下转存到你自己的网盘,不用一个个从 GitHub 拉。许可未声明的技能只给原始仓库链接,不打包。
它属于哪个仓库
plugins/agentic-awesome-skills/skills/logic-diff/SKILL.md同一个仓库里的其他技能
同名技能的其他版本
有 3 个不同仓库或目录里都有叫 logic-diff 的技能。它们内容并不相同,别混用:
- sickn33/agentic-awesome-skills — Compare two code versions for semantic equivalence via semi-formal tracing of both version
- sickn33/agentic-awesome-skills — Compare two code versions for semantic equivalence via semi-formal tracing of both version