python-spreadsheet-debug
ما الذي تفعله
تمنح هذه المهارة وكيل الذكاء الاصطناعي مجموعة مرتبة من الفحوص لمهام جداول البيانات بـ Python. وهي مناسبة لمن تفشل سكربتات جداوله ويحتاج إلى معرفة هل المشكلة في الإعداد أم في السكربت.
متى تستخدمها
- ✓عندما يفشل سكربت جدول بيانات ويصعب قراءة مخرجات الطرفية.
- ✓عندما أشك في أن Python أو إحدى مكتباتها ناقصة أو بإصدار خاطئ.
- ✓عندما أريد تشغيلًا تجريبيًا صغيرًا للتأكد من أن الملف يمكن قراءته قبل المهمة الكاملة.
رابط المهارة
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/python-spreadsheet-debug/SKILL.mdانسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.
طريقة الاستخدام
أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.
رسالة جاهزة للصق
لـ Claude Code أو Codex أو Cursor: شغّله داخل مجلد مشروعك وستُثبَّت المهارة.
نزّل ملف SKILL.md وضعه في مجلد مهارات وكيلك.
مثال على ما تطلبه من الذكاء الاصطناعي
“سكربت جدول البيانات الخاص بي يفشل دون سبب واضح. تحقق من أن Python وpandas تعملان، ثم اختبر قراءة الملف.”
5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.
كيف تعمل
يتحقق الوكيل من نسخة Python المستخدمة وإصدارها، ثم يستورد كل مكتبة مطلوبة على حدة. بعد ذلك يشغّل سكربت اختبار قصيرًا يقرأ الملف ويطبع ملخصًا قبل تشغيل المهمة الكاملة.
المحتوى التقني (ملف SKILL.md الأصلي)
النص الأصلي من المؤلف، مباشرة من GitHub.
Python Spreadsheet Debugging Workflow
When executing Python scripts for spreadsheet/data processing tasks, use this systematic debugging approach to efficiently isolate environment configuration issues from script logic errors, especially when run_shell returns opaque errors.
Step 1: Verify Python Environment
First, confirm the Python interpreter path and version to ensure you're working in the expected environment:
which python python3
python --version
python3 --version
This identifies whether Python is available and which version is being used.
Step 2: Test Library Imports in Isolation
Before running your full script, verify that required libraries can be imported successfully. Test each critical import individually:
python -c "import pandas; print('pandas:', pandas.__version__)"
python -c "import openpyxl; print('openpyxl:', openpyxl.__version__)"
python -c "import xlrd; print('xlrd:', xlrd.__version__)"
Replace library names based on your script's requirements. This identifies missing dependencies or version conflicts early.
Step 3: Run Minimal Test Script
Create and execute a minimal script that exercises only the core functionality without full business logic:
# test_minimal.py
import pandas as pd
# Test 1: Can we read a file?
try:
df = pd.read_excel('sample.xlsx')
print(f"✓ File read successful: {len(df)} rows")
except Exception as e:
print(f"✗ File read failed: {e}")
# Test 2: Can we perform basic operations?
try:
result = df.groupby('category')['amount'].sum()
print(f"✓ GroupBy operation successful")
except Exception as e:
print(f"✗ Operation failed: {e}")
Run this with: python test_minimal.py
Purpose: This isolates whether the issue is with file access, library functionality, or specific script logic.
Step 4: Execute Full Script
Once the minimal test passes, run the complete script:
python your_script.py
If errors occur now, you know the environment is correctly configured and can focus on debugging the specific logic.
Quick Diagnostic Command
For rapid diagnosis, run all checks in sequence:
echo "=== Python Version ===" && python --version && \
echo "=== Key Imports ===" && python -c "import pandas, openpyxl; print('OK')" && \
echo "=== Ready for full script ==="
Common Issues and Resolutions
| Symptom | Likely Cause | Resolution |
|---|---|---|
ModuleNotFoundError |
Missing package | pip install <package-name> |
ImportError with version |
Version conflict | Check pip list, reinstall specific version |
FileNotFoundError |
Wrong path/context | Verify working directory with pwd |
PermissionError |
File access | Check file permissions or path |
When to Use This Pattern
run_shellreturns cryptic or truncated error messages- Script worked previously but suddenly fails
- Deploying to a new environment or container
- Debugging spreadsheet processing with pandas, openpyxl, xlrd, etc.
Benefits
- Fast isolation: Identifies environment vs. logic issues within seconds
- Incremental confidence: Each passing step narrows the problem space
- Reusable pattern: Apply consistently across all Python spreadsheet tasks
الأسئلة الشائعة
لماذا نستورد المكتبات واحدة تلو الأخرى؟
يُظهر ذلك المكتبة الناقصة أو المعطوبة بدقة، فيصبح الإصلاح أسرع.
ماذا يفعل سكربت الاختبار المصغر؟
يحاول قراءة جدول البيانات ويطبع عدد الصفوف، وهذا يؤكد أن الأساسيات تعمل.
هل ينطبق هذا على ملفات Excel فقط؟
لا، تنطبق الخطوات أيضًا على ملفات CSV وغيرها من البيانات الجدولية.
التفاصيل
الوصف الأصلي من المؤلف
Systematic Python debugging workflow for spreadsheet tasks to isolate environment issues from script logic
repo: HKUDS/AgentPilot
الشعبية
- نجوم GitHub
- 7.8k
- الترتيب
- #12963
- الترخيص
- MIT
- آخر تحديث
- 1/11/2026
التعليقات
- …
المزيد من المهارات من هذا المستودع
agentpilot
7.8kيساعد وكيلك على تحسين مشروع خطوة بخطوة، بتجهيز مهمة وتشغيل حلقة AgentPilot التي تقترح التغييرات وتختبرها وتقيّمها.
openspace
7.8kيساعد وكيلك على إعداد OpenSpace، وهو أداة تخزن مهارات الوكلاء وتسترجعها، وربطه بتطبيق الذكاء الاصطناعي عبر MCP.
rsi-arena
7.8kيساعد وكيلك على إعداد اختبارات معيارية مثل AIME وTerminal-Bench وتشغيلها، لمقارنة طرق التحسين المختلفة.
experiment-guide
7.8kيساعد وكيلك على تخطيط تجارب صغيرة وقراءة نتائجها وتسجيل ما يتعلمه أثناء التحقيق في طرق تحسين برنامج.
مهارات مشابهة
gitcrawl
394kيتيح لوكيلك البحث في أرشيف محفوظ لمشكلات GitHub وطلبات السحب، وتجميع المكرر منها، والتحقق من حالتها الحالية على GitHub.
slacrawl
394kيتيح لوكيلك البحث في رسائل Slack داخل أرشيف محلي وعدّها، والتحقق من مدى حداثة الأرشيف، وتحديثه عند الحاجة.
goplaces
394kيساعد وكيلك على البحث عن الأماكن وعرض تفاصيلها وتقييماتها وتحديد أسمائها عبر Google Places، مع مخرجات JSON للسكربتات.