antfu-simplify
ما الذي تفعله
تراجع هذه المهارة تغييراتك الحالية في الكود، وتزيل كل ما ليس ضروريًا. وهي للمطورين الذين يريدون تغييرًا أصغر وأنظف يبقى صحيحًا.
متى تستخدمها
- ✓عندما يكون طلب السحب أكبر مما يحتاج إليه.
- ✓عندما تريد إزالة كود زائد من التغيير دون تغيير سلوكه.
- ✓عندما تريد نسخة أنظف من عملك قبل طلب المراجعة.
رابط المهارة
https://github.com/antfu/skills/blob/main/skills/antfu-simplify/SKILL.mdانسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.
طريقة الاستخدام
أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.
رسالة جاهزة للصق
لـ Claude Code أو Codex أو Cursor: شغّله داخل مجلد مشروعك وستُثبَّت المهارة.
نزّل ملف SKILL.md وضعه في مجلد مهارات وكيلك.
مثال على ما تطلبه من الذكاء الاصطناعي
“بسّط التغييرات في فرعي الحالي دون أن تغيّر ما يفعله الكود.”
5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.
كيف تعمل
يزيل الوكيل جزءًا واحدًا من التغيير في كل مرة، ويشغّل اختبارات المشروع وفحوصه، ويحتفظ فقط بالأجزاء الضرورية. ويبقى السلوك كما هو.
المحتوى التقني (ملف SKILL.md الأصلي)
النص الأصلي من المؤلف، مباشرة من GitHub.
Simplify Changes
Review the current changes (PR branch or working tree) and cut them down to the smallest correct diff, the way a skilled developer would. The method is an ablation study: remove each piece, check whether anything that matters breaks, and keep only what earns its place.
Goal: clean, minimal code with the just-right abstraction, that is also robust (handles real edge cases) and universal (solves the general case, not only the one that triggered the change).
Hard Rules
- Behavior stays the same. Simplify only. Do not add features, change public APIs, or fix unrelated issues. Report unrelated findings instead.
- Scope is the diff. Only touch code the change introduced or modified, plus code that must change to remove it. Do not refactor the surrounding codebase.
- Every removal is verified. Run the repo's tests, typecheck, and lint after each batch. If a check has no coverage for the removed piece, reason about it explicitly or keep it.
- Match the surrounding code's style, naming, and comment density.
Workflow
- Get the diff. Pick the base: PR target branch merge base (
git merge-base HEAD origin/<default>), elsegit diff HEADfor uncommitted work. Read the full diff and the files around it. Note the goal of the change in one sentence; it is the yardstick for everything below. - Inventory the pieces. List each unit the diff adds: function, parameter, option, branch, type, file, dependency, abstraction layer, comment, test. See Ablation Study.
- Ablate. For each piece, try removing, inlining, or merging it. Decide keep or cut using Keep vs Cut.
- Apply the cuts in small steps. After each batch run focused checks (tests, typecheck, lint). Revert a cut that breaks behavior; that piece is now proven needed.
- Check the result. Re-read the final diff as a reviewer. Is each remaining line explained by the one-sentence goal? Is it still robust and general?
- Report. Show a short table of what was cut or kept and why, plus the diff size before and after (
git diff --stat). Do not commit unless asked.
Ablation Study
For every piece in the diff, ask: if I delete this, what concretely breaks?
| Piece | Ablation | Keep if |
|---|---|---|
| New function / helper | Inline it at the call site | Called from 2+ places, or the name explains a non-obvious step |
| Wrapper / abstraction layer | Call the underlying thing directly | It hides real complexity or a likely-to-change boundary |
| Parameter / option / config | Hardcode the only used value | A real caller needs a different value now |
| Type / interface / generic | Use the inferred or existing type | It is exported, or inference gives a worse or wrong type |
| Branch / guard / try-catch | Delete it and run tests | It guards a reachable case (real input, real failure), not an impossible one |
| New file / module | Merge it into its only consumer | It has multiple consumers or a distinct responsibility |
| Dependency | Replace with a few lines or an existing dep | It handles hard edge cases you would otherwise get wrong |
| Duplicate logic | Reuse an existing util in the repo | No equivalent exists (search first) |
| Comment | Delete it | It explains why (constraint, workaround, surprising choice), not what |
| Test | Remove it and see what is unprotected | It covers behavior or a regression nothing else covers |
| Changed lines unrelated to the goal | Revert them | Never keep drive-by edits |
Keep vs Cut
Cut when the piece is:
- Speculative: built for a future need nobody has (extra options, hooks, plugin points, "just in case" generics).
- Redundant: repeats what the language, framework, types, or an existing util already provides.
- Defensive against the impossible: null checks on values the types or callers guarantee, fallbacks that never run, catch blocks that swallow errors.
- Indirection without payoff: one-use helpers, pass-through wrappers, classes where a function works, factories that build one thing.
- Noise: commented-out code, narrating comments, unused imports and exports, formatting-only churn.
Keep (or even add) when the piece is:
- Robustness: handles real edge cases (empty input, concurrency, cleanup, cross-platform paths, error propagation with context).
- Universality: solves the general problem instead of special-casing the reported one. If the fix hardcodes a name, path, or value from th
الأسئلة الشائعة
هل ستضيف ميزات جديدة؟
لا، تبسّط التغييرات الموجودة فقط، وتبلغ عن المشكلات غير المرتبطة بدل إصلاحها.
هل ستغيّر كودًا خارج تغييراتي؟
لا، تعمل على الكود الذي أضافه تغييرك أو عدّله.
كيف تتحقق من أن شيئًا لم ينكسر؟
تشغّل اختبارات المستودع وفحوص الأنواع والتدقيق بعد كل دفعة إزالة.
التفاصيل
الوصف الأصلي من المؤلف
Simplify the changes of the current PR or working tree with an ablation study - remove each piece of the diff and keep only what is proven needed - so the result has just-right abstraction, minimal clean code, and stays robust and universal. Use when asked to simplify, slim down, clean up, or reduce the current changes or PR.
repo: antfu/skills
الشعبية
- نجوم GitHub
- 6.0k
- الترتيب
- #14438
- الترخيص
- MIT
- آخر تحديث
- 30/10/2026
التعليقات
- …
المزيد من المهارات من هذا المستودع
antfu-create-pr
6.0kيساعد وكيلك على فتح طلب سحب واضح على GitHub من فرعك، مع ملخص بسيط لما تغيّر ولماذا.
antfu-issue-triage
6.0kيساعد وكيلك على فرز قضايا GitHub وطلبات السحب المفتوحة، فيكشف المكرر والمُصلَح، ثم يسألك قبل أن يتصرف.
antfu-query
6.0kيسألك وكيلك خطوة بخطوة عن خطة أو فكرة، حتى يتفقا على فهم واضح ومُختبَر.
antfu
6.0kيعلّم وكيلك العادات التي يفضلها Anthony Fu في مشاريع JavaScript وTypeScript، من تنظيم الملفات إلى اختيار الأدوات.
مهارات مشابهة
diffs
394kيتيح لوكيلك إنتاج فرق تعديلات حقيقي يمكن مشاركته، كرابط عرض أو ملف صورة، بدلاً من ملخص مكتوب يدوياً.
coding-agent
394kيساعد وكيلك على تسليم مهمة برمجة كبيرة إلى Codex أو Claude Code أو OpenCode كعامل في الخلفية، ثم متابعة تقدمها.
gh-issues
394kيساعد وكيلك على إيجاد مشكلات GitHub واختيار ما ستعمل عليه، وفتح طلبات سحب بالإصلاحات، ومتابعة تعليقات المراجعة.