أمر بكلود كود ما أحد يستخدمه ويحتاجه كل مطور
الأمر الخفي الذي يحول العمل المتكرر إلى أتمتة كاملة هو `/loop`. بدلاً من تشغيل نفس الأوامر يدويًا كل ساعة أو كل يوم، هذا الأمر يجعل كلود يفعل ذلك تلقائيًا ويتوقف عندما ينتهي من المهمة.
**المشكلة التي يحلها:**
تخيل أنك تنتظر نتيجة بناء (build) لمشروعك. كنت تشغل الأمر نفسه كل 30 ثانية يدويًا. أو تراقب حالة نشر موقعك. أو تفحص إذا انتهت مهمة معينة. هذا هو العمل اليدوي الذي يضيع الوقت.
**كيفية الاستخدام:**
الخطوة 1: افتح نافذة Claude Code
الخطوة 2: اكتب `/loop` متبوعًا بالأمر الذي تريده
الخطوة 3: أضف الفاصل الزمني بالدقائق إذا أردت (مثلاً `5m` لكل 5 دقائق)
**أمثلة عملية:**
مثال 1: مراقبة حالة النشر
اكتب: `/loop 2m git status`
ستعمل بشكل متكرر كل دقيقتين وتتوقف تلقائيًا عندما تنتهي.
مثال 2: مراقبة أسعار العملات المشفرة
اكتب: `/loop 10m check crypto prices using external API`
ستعمل كل 10 دقائق حتى تحصل على البيانات الكاملة.
مثال 3: بدون فاصل زمني (self-paced)
اكتب: `/loop monitor deployment logs`
كلود يقرر بنفسه متى يتحقق ومتى يتوقف بناءً على النتائج.
**لماذا هذا الأمر مهم جدًا:**
1. توفير الوقت: لا تحتاج للراقبة اليدوية
2. الدقة: لن تنسى التحقق
3. الأتمتة الكاملة: يعمل في الخلفية بدون تدخل منك
4. المرونة: تحدد الفاصل الزمني حسب احتياجاتك
**حالات الاستخدام الفعلية:**
- انتظار اكتمال اختبارات التطبيق
- مراقبة الأخطاء في السجلات (logs)
- التحقق من حالة قاعدة البيانات
- جمع بيانات من API خارجي بشكل دوري
- مراقبة تحديثات الفريق (GitHub، Slack، وغيره)
- فحص استقرار الموقع
**نصيحة مهمة:**
استخدم `/loop` بدون فاصل زمني عندما تريد أن يقرر كلود بنفسه. استخدم مع فاصل زمني (مثل `5m`) عندما تريد تحكمًا أكثر دقة.
هذا الأمر سيوفر ساعات من عملك الجدولي كل أسبوع. معظم المطورين لا يعرفونه حتى.
من @mabuzant — تابعني للمزيد
--- English ---
The Claude Code Command Nobody Uses But Should
The hidden command that transforms repetitive work into complete automation is `/loop`. Instead of running the same commands manually every hour or day, this command makes Claude do it automatically and stop when the task is complete.
**The Problem It Solves:**
Imagine you're waiting for your build to complete. You're running the same command every 30 seconds manually. Or monitoring your site's deployment status. Or checking if a task finished. This is wasted manual labor.
**How to Use It:**
Step 1: Open Claude Code
Step 2: Type `/loop` followed by the command you want
Step 3: Add the time interval in minutes if you want (e.g., `5m` for every 5 minutes)
**Practical Examples:**
Example 1: Monitor deployment status
Type: `/loop 2m git status`
Runs automatically every 2 minutes and stops when done.
Example 2: Check API response times
Type: `/loop 1m check server response time`
Runs every minute until you get consistent data.
Example 3: Without a time interval (self-paced)
Type: `/loop monitor build logs`
Claude decides when to check and when to stop based on results.
**Why This Command is Essential:**
1. Time Savings: No manual monitoring needed
2. Consistency: You won't forget to check
3. Full Automation: Works in the background without intervention
4. Flexibility: Set your own interval based on needs
**Real-World Use Cases:**
- Waiting for test suite completion
- Monitoring error logs for issues
- Checking database health
- Polling external APIs periodically
- Monitoring team updates (GitHub, Slack, etc.)
- Verifying site stability after deployment
**Important Tip:**
Use `/loop` without an interval when you want Claude to decide timing. Use it with an interval (like `5m`) when you need precise control.
This single command saves hours of manual monitoring work every week. Most developers have never even heard of it.
From @mabuzant — follow for weekly AI content