logic-diff
Skill này làm gì
So sánh hai phiên bản code để xem chúng có làm cùng một việc không. Nó phân tích code từng bước để tìm các khác biệt quan trọng trong hành vi.
Khi nào nên dùng
- ✓Khi bạn tái cấu trúc code và muốn chắc không có gì bị hỏng.
- ✓Khi chuyển code sang phiên bản mới và kiểm tra kết quả có giống không.
- ✓Khi bạn kiểm thử hai cách triển khai khác nhau (A/B) và muốn biết chúng có hoạt động giống hệt nhau không.
Liên kết skill
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/logic-diff/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“So sánh hai phiên bản code này để xem chúng còn hoạt động giống nhau không.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
AI phân tích cả hai phiên bản code song song, theo dõi các bước thực thi của từng bản. Nó ghi lại chỗ đường đi hoặc kết quả bắt đầu khác nhau.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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.
Câu hỏi thường gặp
'Semantic equivalence' nghĩa là gì?
Nghĩa là dù code trông khác hoặc đã được viết lại, nó vẫn tạo ra cùng kết quả hoặc có cùng tác dụng thực tế với cùng đầu vào.
'Semi-formal tracing' là gì?
Đây là cách theo dõi logic code từng bước, như vẽ bản đồ những gì xảy ra, để đảm bảo không bỏ sót điều gì.
Nếu code cố ý có hành vi khác thì sao?
Nếu bạn thông báo cho AI về các thay đổi hành vi có chủ đích, nó sẽ ghi nhận và chỉ chỉ ra những khác biệt bất ngờ nằm ngoài các phần đó.
Chi tiết
Mô tả gốc của tác giả
Compare two code versions for semantic equivalence via semi-formal tracing of both versions side-by-side.
Độ phổ biến
- Sao GitHub
- 48k
- Vị trí xếp hạng
- #5096
- Giấy phép
- MIT
- Cập nhật
- 15/10/2026
Bình luận
- …
Thêm skill từ kho mã này
00-andruia-consultant
48kGiúp agent của bạn bắt đầu hoặc cải thiện các dự án AI. Phân tích mã, gợi ý công cụ và lập kế hoạch hành động bằng tiếng Tây Ban Nha.
007
48kCho phép agent của bạn thực hiện kiểm toán bảo mật và mô hình hóa mối đe dọa. Hữu ích để bảo vệ dự án khỏi các cuộc tấn công và lỗ hổng.
10-andruia-skill-smith
48kGiúp agent của bạn tạo hoặc cải thiện các công cụ AI. Xác định cách công cụ hoạt động, viết tài liệu và kiểm tra cấu trúc.
20-andruia-niche-intelligence
48kGiúp agent của bạn tạo bản tóm tắt về một ngành cụ thể. Hữu ích để hiểu bối cảnh, quy tắc, cách người dùng tương tác và rủi ro của dự án.
Skill tương tự
test-driven-development
311kDạy agent của bạn viết kiểm thử thất bại trước, xem nó thất bại, rồi viết đoạn mã ngắn nhất để vượt qua trước khi làm bất kỳ tính năng hay bản sửa nào.
verification-before-completion
311kDạy agent của bạn chạy kiểm tra thực tế và đọc kết quả đầu ra trước khi khẳng định một việc, bản sửa hoặc bản build đã hoàn thành hay vượt qua.
migrate-to-shoehorn
310kThay các ép kiểu rủi ro trong tệp kiểm thử bằng thư viện shoehorn, để các bài kiểm thử dùng dữ liệu một phần vẫn qua được kiểm tra kiểu.