debugging-strategies
ما الذي تفعله
تساعدك هذه المهارة على إيجاد الأخطاء في شيفرة الحاسوب وإصلاحها بطريقة منظمة. وتعلّم أساليب للتحقيق في المشكلات بدلًا من التخمين.
متى تستخدمها
- ✓عندما لا يعمل برنامج كما هو متوقع.
- ✓عندما تريد معرفة سبب بطء برنامج ما.
- ✓عندما تحاول فهم شيفرة لم تكتبها بنفسك.
رابط المهارة
https://github.com/wshobson/agents/blob/main/plugins/developer-essentials/skills/debugging-strategies/SKILL.mdانسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.
طريقة الاستخدام
أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.
رسالة جاهزة للصق
لـ Claude Code أو Codex أو Cursor: شغّله داخل مجلد مشروعك وستُثبَّت المهارة.
نزّل ملف SKILL.md وضعه في مجلد مهارات وكيلك.
مثال على ما تطلبه من الذكاء الاصطناعي
“ينهار برنامجي عندما أضغط على زر «حفظ». كيف أكتشف السبب؟”
5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.
كيف تعمل
تقترح المهارة اتباع عملية علمية: ملاحظة المشكلة، ثم صياغة فرضية حول السبب، ثم اختبار هذه الفرضية، وتحليل النتائج. كما تشجعك على عدم الافتراض، وعلى شرح المشكلة لنفسك أو لغيرك.
المحتوى التقني (ملف SKILL.md الأصلي)
النص الأصلي من المؤلف، مباشرة من GitHub.
Debugging Strategies
Transform debugging from frustrating guesswork into systematic problem-solving with proven strategies, powerful tools, and methodical approaches.
When to Use This Skill
- Tracking down elusive bugs
- Investigating performance issues
- Understanding unfamiliar codebases
- Debugging production issues
- Analyzing crash dumps and stack traces
- Profiling application performance
- Investigating memory leaks
- Debugging distributed systems
Core Principles
1. The Scientific Method
1. Observe: What's the actual behavior? 2. Hypothesize: What could be causing it? 3. Experiment: Test your hypothesis 4. Analyze: Did it prove/disprove your theory? 5. Repeat: Until you find the root cause
2. Debugging Mindset
Don't Assume:
- "It can't be X" - Yes it can
- "I didn't change Y" - Check anyway
- "It works on my machine" - Find out why
Do:
- Reproduce consistently
- Isolate the problem
- Keep detailed notes
- Question everything
- Take breaks when stuck
3. Rubber Duck Debugging
Explain your code and problem out loud (to a rubber duck, colleague, or yourself). Often reveals the issue.
Systematic Debugging Process
Phase 1: Reproduce
## Reproduction Checklist
1. **Can you reproduce it?**
- Always? Sometimes? Randomly?
- Specific conditions needed?
- Can others reproduce it?
2. **Create minimal reproduction**
- Simplify to smallest example
- Remove unrelated code
- Isolate the problem
3. **Document steps**
- Write down exact steps
- Note environment details
- Capture error messages
Phase 2: Gather Information
## Information Collection
1. **Error Messages**
- Full stack trace
- Error codes
- Console/log output
2. **Environment**
- OS version
- Language/runtime version
- Dependencies versions
- Environment variables
3. **Recent Changes**
- Git history
- Deployment timeline
- Configuration changes
4. **Scope**
- Affects all users or specific ones?
- All browsers or specific ones?
- Production only or also dev?
Phase 3: Form Hypothesis
## Hypothesis Formation
Based on gathered info, ask:
1. **What changed?**
- Recent code changes
- Dependency updates
- Infrastructure changes
2. **What's different?**
- Working vs broken environment
- Working vs broken user
- Before vs after
3. **Where could this fail?**
- Input validation
- Business logic
- Data layer
- External services
Phase 4: Test & Verify
## Testing Strategies
1. **Binary Search**
- Comment out half the code
- Narrow down problematic section
- Repeat until found
2. **Add Logging**
- Strategic console.log/print
- Track variable values
- Trace execution flow
3. **Isolate Components**
- Test each piece separately
- Mock dependencies
- Remove complexity
4. **Compare Working vs Broken**
- Diff configurations
- Diff environments
- Diff data
Before selecting debugging tools or performing bisect, differential, trace, or memory analysis, read references/tools-and-techniques.md.
Debugging Patterns by Issue Type
Pattern 1: Intermittent Bugs
## Strategies for Flaky Bugs
1. **Add extensive logging**
- Log timing information
- Log all state transitions
- Log external interactions
2. **Look for race conditions**
- Concurrent access to shared state
- Async operations completing out of order
- Missing synchronization
3. **Check timing dependencies**
- setTimeout/setInterval
- Promise resolution order
- Animation frame timing
4. **Stress test**
- Run many times
- Vary timing
- Simulate load
Pattern 2: Performance Issues
## Performance Debugging
1. **Profile first**
- Don't optimize blindly
- Measure before and after
- Find bottlenecks
2. **Common culprits**
- N+1 queries
- Unnecessary re-renders
- Large data processing
- Synchronous I/O
3. **Tools**
- Browser DevTools Performance tab
- Lighthouse
- Python: cProfile, line_profiler
- Node: clinic.js, 0x
Pattern 3: Production Bugs
## Production Debugging
1. **Gather evidence**
- Error tracking (Sentry, Bugsnag)
- Application logs
- User reports
- Metrics/monitoring
2. **Reproduce locally**
- Use production data (anonymized)
- Match environment
- Follow exact steps
…
الأسئلة الشائعة
ما هو «Rubber Duck Debugging»؟
هو أسلوب تشرح فيه شيفرتك والمشكلة بصوت عالٍ، كأنك تتحدث إلى بطة مطاطية. وهذا كثيرًا ما يوضح الأفكار ويساعد على إيجاد الحل.
كيف أعيد إنتاج الخطأ؟
حاول تكرار الخطوات التي أدت إلى الخطأ. دوّن بدقة ما فعلته، وفي أي ظروف، وهل يحدث الخطأ في كل مرة أم أحيانًا. وحاول تبسيط الأمر قدر الإمكان لعزل المشكلة.
ماذا أفعل إذا لم أجد الخطأ؟
خذ استراحة، وراجع ملاحظاتك، وحاول شرح المشكلة لشخص آخر، أو استخدم أسلوب البطة المطاطية. وأحيانًا يساعد البحث عن أخطاء شائعة، مثل الأخطاء المطبعية أو القيم الفارغة أو مسارات الملفات الخاطئة.
التفاصيل
الوصف الأصلي من المؤلف
Master systematic debugging techniques, profiling tools, and root cause analysis to efficiently track down bugs across any codebase or technology stack. Use when investigating bugs, performance issues, or unexpected behavior.
repo: wshobson/agents
الشعبية
- نجوم GitHub
- 41k
- الترتيب
- #6677
- الترخيص
- MIT
- آخر تحديث
- 15/10/2026
التعليقات
- …
المزيد من المهارات من هذا المستودع
screen-reader-testing
41kيجعل وكيلك يختبر مواقع الويب باستخدام قارئات الشاشة للتأكد من أنها سهلة الوصول.
wcag-audit-patterns
41kيساعد وكيلك على تدقيق مواقع الويب من حيث إمكانية الوصول، وإصلاح المشكلات وفق إرشادات WCAG.
multi-reviewer-patterns
41kيمكّن وكيلك من تنسيق مراجعات الشيفرة المتوازية، مع إزالة التكرار في الملاحظات ودمج التقارير.
parallel-debugging
41kيتيح للوكيل تصحيح الأخطاء المعقدة عبر تحقيقات متوازية وتحليل السبب الجذري.
مهارات مشابهة
diffs
394kيتيح لوكيلك إنتاج فرق تعديلات حقيقي يمكن مشاركته، كرابط عرض أو ملف صورة، بدلاً من ملخص مكتوب يدوياً.
coding-agent
394kيساعد وكيلك على تسليم مهمة برمجة كبيرة إلى Codex أو Claude Code أو OpenCode كعامل في الخلفية، ثم متابعة تقدمها.
gh-issues
394kيساعد وكيلك على إيجاد مشكلات GitHub واختيار ما ستعمل عليه، وفتح طلبات سحب بالإصلاحات، ومتابعة تعليقات المراجعة.