simplify
ما الذي تفعله
تجعل هذه المهارة الشيفرة العاملة أوضح وأبسط دون تغيير سلوكها. وهي موجهة للمطورين الذين يريدون شيفرة أسهل على الآخرين في القراءة والتعديل.
متى تستخدمها
- ✓عندما تعمل الميزة وتمر اختباراتها، لكن الشيفرة تبدو أثقل مما تحتاج.
- ✓عندما تكون الدالة طويلة أو متداخلة بعمق أو لها أسماء غير واضحة.
- ✓عندما تشير مراجعة شيفرة إلى مشكلات في القراءة أو التعقيد.
رابط المهارة
https://github.com/alvinunreal/oh-my-opencode-slim/blob/master/src/skills/simplify/SKILL.mdانسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.
طريقة الاستخدام
أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.
رسالة جاهزة للصق
لـ Claude Code أو Codex أو Cursor: شغّله داخل مجلد مشروعك وستُثبَّت المهارة.
نزّل ملف SKILL.md وضعه في مجلد مهارات وكيلك.
مثال على ما تطلبه من الذكاء الاصطناعي
“هذه الدالة تعمل، لكن يصعب تتبعها. بسّطها دون أن تغيّر ما تفعله.”
5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.
كيف تعمل
تتحقق المهارة من فهم السلوك، ثم تجري تغييرات تُبقي المدخلات والمخرجات ومعالجة الأخطاء كما هي. وتتجاوز الشيفرة الواضحة أصلًا.
المحتوى التقني (ملف SKILL.md الأصلي)
النص الأصلي من المؤلف، مباشرة من GitHub.
Code Simplification
Overview
Simplify code by reducing complexity while preserving exact behavior. The goal is not fewer lines - it's code that is easier to read, understand, modify, and debug. Every simplification must pass a simple test: "Would a new team member understand this faster than the original?"
When to Use
- After a feature is working and tests pass, but the implementation feels heavier than it needs to be
- During code review when readability or complexity issues are flagged
- When you encounter deeply nested logic, long functions, or unclear names
- When refactoring code written under time pressure
- When consolidating related logic scattered across files
- After merging changes that introduced duplication or inconsistency
When NOT to use:
- Code is already clean and readable - don't simplify for the sake of it
- You don't understand what the code does yet - comprehend before you simplify
- The code is performance-critical and the "simpler" version would be measurably slower
- You're about to rewrite the module entirely - simplifying throwaway code wastes effort
The Five Principles
1. Preserve Behavior Exactly
Don't change what the code does - only how it expresses it. All inputs, outputs, side effects, error behavior, and edge cases must remain identical. If you're not sure a simplification preserves behavior, don't make it.
Before every change, ask:
- Does this produce the same output for every input?
- Does this maintain the same error behavior?
- Does this preserve the same side effects and ordering?
- What proportionate final-state verification will reveal a behavior change?
2. Follow Project Conventions
Simplification means making code more consistent with the codebase, not imposing external preferences.
Before simplifying:
- Read
AGENTS.md/ project conventions - Study how neighboring code handles similar patterns
- Match the project's style for imports, naming, function style, error handling, and type annotations
Simplification that breaks project consistency is not simplification - it's churn.
3. Prefer Clarity Over Cleverness
Explicit code is better than compact code when the compact version requires a mental pause to parse.
- Replace nested ternaries with readable control flow
- Replace dense inline transforms with named intermediate steps when they clarify intent
- Keep helpful names even if they cost a few extra lines
4. Maintain Balance
Watch for over-simplification:
- Don't inline away names that carry meaning
- Don't merge unrelated logic into one larger function
- Don't remove abstractions that serve testability or extensibility
- Don't optimize for line count over comprehension
5. Scope to What Changed
Default to simplifying recently modified code. Avoid unrelated drive-by refactors unless explicitly asked.
Process
Step 1: Understand Before Touching
Before changing or removing anything, understand why it exists.
Answer:
- What is this code's responsibility?
- What calls it? What does it call?
- What are the edge cases and error paths?
- Are there tests that define expected behavior?
- Why might it have been written this way?
If you can't answer these, read more context first.
Step 2: Look for Simplification Opportunities
Signals:
- Deep nesting
- Long functions with mixed responsibilities
- Nested ternaries
- Boolean flag arguments
- Repeated conditionals
- Generic or misleading names
- Duplicated logic
- Dead code
- Wrappers or abstractions that add no value
Step 3: Apply Changes Incrementally
Make one simplification at a time.
For each simplification:
- Make the change
- Use the proportionate final-state verification plan to check preservation
- Keep it only when the evidence supports preservation
Separate refactoring from feature work whenever possible.
Step 4: Verify the Result
After simplifying, confirm:
- The code is genuinely easier to understand
- The diff is clean and reviewable
- Project conventions still match
- No behavior, error handling, or side effects changed
Guidance for This Repository
- Prefer straightforward TypeScript over clever compression
- Preserve existing runtime behavior, tests, and hooks
- Favor explicit names and smaller focused helpers when they improve readability
- Keep refactors tightly scoped to the task or review feedback
Final-state verification
Use a proportionate final-state verification plan for the final diff. Run checks required by r
الأسئلة الشائعة
هل ستغيّر طريقة عمل الشيفرة؟
تقول المهارة إن السلوك يجب أن يبقى تمامًا كما هو، فتتجنب أي تغيير لست متأكدًا منه.
هل الهدف عدد أقل من الأسطر؟
لا. الهدف شيفرة أسهل في القراءة والفهم والتعديل.
متى أتجاوزها؟
عندما تكون الشيفرة نظيفة أصلًا، أو عندما تكون حرجة للأداء وتكون النسخة المبسطة أبطأ بقياس واضح.
التفاصيل
الوصف الأصلي من المؤلف
Simplifies code for clarity without changing behavior. Use for readability, maintainability, and complexity reduction after behavior is understood.
الشعبية
- نجوم GitHub
- 10k
- الترتيب
- #12017
- الترخيص
- MIT
- آخر تحديث
- 2/11/2026
التعليقات
- …
المزيد من المهارات من هذا المستودع
cli-review
10kيتيح لوكيلك تشغيل مراجعة شيفرة من Greptile على فرعك الحالي قبل فتح طلب سحب، ثم تلخيص النتائج بلغة واضحة.
ai-estimates
10kيساعد وكيلك على تقدير المدة التي يستغرقها العمل عندما يعمل شخص مع الذكاء الاصطناعي، مع الفصل بين عمل الذكاء الاصطناعي السريع والتأخيرات البشرية والخارجية.
clonedeps
10kيتيح لوكيلك نسخ الشيفرة المصدرية للاعتماديات الأساسية في المشروع إلى مجلد محلي، حتى يستطيع قراءة كيفية عمل تلك المكتبات من الداخل.
codemap
10kينشئ خريطة منظمة لمشروع شيفرة غير مألوف، حتى يجد وكيلك أجزاءه الرئيسية بسرعة. الأفضل استخدامها عندما تطلب خريطة للشيفرة.
مهارات مشابهة
diffs
394kيتيح لوكيلك إنتاج فرق تعديلات حقيقي يمكن مشاركته، كرابط عرض أو ملف صورة، بدلاً من ملخص مكتوب يدوياً.
coding-agent
394kيساعد وكيلك على تسليم مهمة برمجة كبيرة إلى Codex أو Claude Code أو OpenCode كعامل في الخلفية، ثم متابعة تقدمها.
gh-issues
394kيساعد وكيلك على إيجاد مشكلات GitHub واختيار ما ستعمل عليه، وفتح طلبات سحب بالإصلاحات، ومتابعة تعليقات المراجعة.