logic-diff
ما الذي تفعله
تقارن هذه المهارة بين نسختين من الكود لتعرف إن كانتا تؤديان الوظيفة نفسها. تحلل الكود خطوة بخطوة لتجد الفروقات المهمة في السلوك.
متى تستخدمها
- ✓عندما تعيد هيكلة الكود وتريد التأكد من أنه لم ينكسر شيء.
- ✓عند نقل الكود إلى إصدار جديد والتحقق من أن النتيجة نفسها.
- ✓بعد اختبار تطبيقين مختلفين (A/B) وتريد معرفة إن كانا يعملان بالطريقة نفسها.
رابط المهارة
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/logic-diff/SKILL.mdانسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.
طريقة الاستخدام
أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.
رسالة جاهزة للصق
لـ Claude Code أو Codex أو Cursor: شغّله داخل مجلد مشروعك وستُثبَّت المهارة.
نزّل ملف SKILL.md وضعه في مجلد مهارات وكيلك.
مثال على ما تطلبه من الذكاء الاصطناعي
“قارن بين هاتين النسختين من الكود لأرى إن كانتا لا تزالان تتصرفان بالطريقة نفسها.”
5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.
كيف تعمل
يحلل الذكاء الاصطناعي النسختين جنبًا إلى جنب، ويتتبع خطوات تنفيذ كل منهما. ويسجّل النقطة التي تبدأ فيها المسارات أو النتائج بالاختلاف.
المحتوى التقني (ملف SKILL.md الأصلي)
النص الأصلي من المؤلف، مباشرة من GitHub.
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.
الأسئلة الشائعة
ماذا يعني «التكافؤ الدلالي» (semantic equivalence)؟
يعني أنه حتى لو بدا الكود مختلفًا أو أُعيدت كتابته، فإنه ينتج النتيجة نفسها أو له الأثر العملي نفسه للمدخلات نفسها.
ما هو «التتبع شبه الرسمي» (semi-formal tracing)؟
هو متابعة منطق الكود خطوة بخطوة، أشبه برسم خريطة لما يحدث، لضمان ألا يُفوَّت أي شيء.
ماذا لو كان الكود يتصرف بشكل مختلف عن قصد؟
إذا أخبرت الذكاء الاصطناعي بتغييرات السلوك المخططة، فسيسجلها ولن يشير إلا إلى الفروقات غير المتوقعة خارج تلك المناطق.
التفاصيل
الوصف الأصلي من المؤلف
Compare two code versions for semantic equivalence via semi-formal tracing of both versions side-by-side.
الشعبية
- نجوم GitHub
- 48k
- الترتيب
- #5096
- الترخيص
- MIT
- آخر تحديث
- 15/10/2026
التعليقات
- …
المزيد من المهارات من هذا المستودع
00-andruia-consultant
48kيساعد وكيلك على بدء مشاريع الذكاء الاصطناعي أو تحسينها. يحلل الكود ويقترح الأدوات ويُعد خطط عمل بالإسبانية.
007
48kيتيح لوكيلك إجراء تدقيقات أمنية ونمذجة التهديدات. مفيد لحماية المشاريع من الهجمات والثغرات الأمنية.
10-andruia-skill-smith
48kيساعد وكيلك على إنشاء أدوات الذكاء الاصطناعي أو تحسينها. يحدد طريقة عملها، ويكتب توثيقها، ويتحقق من بنيتها.
20-andruia-niche-intelligence
48kيتيح لوكيلك إعداد ملخص عن صناعة محددة. مفيد لفهم السياق والقواعد وأنماط الاستخدام والمخاطر لمشروع ما، باستخدام مصادر موثوقة.
مهارات مشابهة
test-driven-development
311kيعلّم وكيلك كتابة اختبار فاشل أولًا، ثم رؤيته يفشل، ثم كتابة أصغر شيفرة تنجحه، قبل بناء أي ميزة أو إصلاح.
verification-before-completion
311kيعلّم وكيلك تشغيل فحوصات حقيقية وقراءة نتائجها قبل أن يقول إن المهمة أو الإصلاح أو البناء مكتمل أو ناجح.
migrate-to-shoehorn
310kيستبدل تأكيدات النوع الخطرة في ملفات الاختبار بمكتبة shoehorn، حتى تتمكن الاختبارات من استخدام بيانات جزئية وتجتاز فحوص الأنواع.