batch
ما الذي تفعله
يجد الملفات المطابقة لنمط، ويقسمها إلى مجموعات، ثم يعالج كل مجموعة بعمّال متوازيين قبل أن يلخّص النتائج. وهو مخصص لمن يحتاجون إلى تطبيق التغيير نفسه على ملفات كثيرة.
متى تستخدمها
- ✓عندما تريد تطبيق التغيير نفسه على ملفات كثيرة تطابق نمطا.
- ✓عندما تحتاج إلى مجموعة كبيرة من التعديلات المستقلة تُنفَّذ بالتوازي.
- ✓عندما تريد ملخصا للنتائج بعد عملية ملفات جماعية.
رابط المهارة
https://github.com/QwenLM/qwen-code/blob/main/packages/core/src/skills/bundled/batch/SKILL.mdانسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.
طريقة الاستخدام
أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.
رسالة جاهزة للصق
لـ Claude Code أو Codex أو Cursor: شغّله داخل مجلد مشروعك وستُثبَّت المهارة.
نزّل ملف SKILL.md وضعه في مجلد مهارات وكيلك.
مثال على ما تطلبه من الذكاء الاصطناعي
“أضف تعليق JSDoc قصيرا إلى كل ملف TypeScript في مجلد src، باستثناء ملفات الاختبار.”
5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.
كيف تعمل
يجد الوكيل الملفات المطابقة، ويتخطى المجلدات الشائعة مثل node_modules وdist وbuild، ويقسم القائمة إلى أجزاء، ويشغّل عليها وكلاء عمّال بالتوازي. ثم يجمع النتائج في ملخص.
المحتوى التقني (ملف SKILL.md الأصلي)
النص الأصلي من المؤلف، مباشرة من GitHub.
/batch - Parallel Batch Operations
You are orchestrating a batch operation across multiple files. Your job is to:
- Parse the user's request to understand the target files and operation
- Discover matching files using glob
- Split files into chunks for parallel processing
- Launch multiple worker agents to process files concurrently
- Aggregate results and present a summary
Step 1: Parse Intent and Discover Files
First, parse the user's request to identify:
- Target pattern: glob pattern for files (e.g.,
src/**/*.ts,**/*.js) - Operation: what to do with each file (e.g., "add JSDoc comments", "convert to TypeScript")
If the user didn't specify a pattern, infer it from context or ask for clarification.
Use the glob tool to discover matching files.
If no files match the pattern:
- Inform the user that no files were found for the given pattern
- Suggest checking the pattern or broadening the search scope
- Do not proceed with an empty batch
Apply these common exclusions automatically:
node_modules/**dist/**build/**.git/****/*.test.ts,**/*.test.js**/*.spec.ts,**/*.spec.js**/__tests__/****/test/**,**/tests/****/package-lock.json**/yarn.lock**/pnpm-lock.yaml**/*.min.js- Binary files (images, fonts, etc.)
- Files larger than 500KB (check size if needed)
Important: If more than 50 files match, inform the user with the exact count and the file list, then proceed. The user can cancel (Ctrl+C) if needed. If the count exceeds 100 files, warn the user and suggest a more specific pattern instead of proceeding.
Step 2: Chunk Files for Parallel Processing
Split the discovered files into chunks based on these rules:
| Total Files | Chunk Count | Files Per Chunk |
|---|---|---|
| 1-5 | 1 | All files |
| 6-15 | 2 | 3-8 each |
| 16-30 | 3 | ~10 each |
| 31-50 | 4 | ~10-12 each |
| 51-75 | 5 | ~10-15 each |
| 76-100 | 5 | ~15-20 each |
Chunking algorithm:
- Minimum chunk size: 3 files (avoid over-parallelization for small batches)
- Maximum chunk size: 15 files (ensure reasonable work per agent)
- Maximum parallel agents: 5 (API rate limit consideration)
Example: 24 files → 3 chunks of ~8 files each
Step 3: Launch Parallel Worker Agents
Launch worker agents in parallel by invoking the task tool (the Agent tool) multiple times in a SINGLE message.
Note: The task tool in allowedTools is the Agent tool used to spawn worker agents.
Each worker agent should receive:
- The list of files to process (full paths)
- The operation to perform
- Clear instructions to report success/failure per file
Use the general-purpose subagent type for workers.
CRITICAL: All Agent tool calls MUST be in a single response to enable parallel execution. The system automatically runs multiple Agent calls concurrently.
Agent Prompt Template
For each chunk, use this prompt format:
You are a worker agent processing a batch of files.
**Operation**: [describe the operation, e.g., "Add JSDoc comments to all exported functions"]
**Files to process**:
- [file1.ts]
- [file2.ts]
- ...
**Instructions**:
1. Process each file independently
2. For each file, report one of:
- SUCCESS: [file path] - [brief description of change]
- FAILED: [file path] - [reason for failure]
- SKIPPED: [file path] - [reason for skipping]
3. If a file fails or is skipped, continue with the next file - do not abort
4. At the end, provide a summary of what was done
**Constraints**:
- Do not modify test files unless explicitly requested
- Preserve existing code style and formatting
- Make minimal necessary changes to accomplish the operation
Example Invocation Pattern
Set run_in_background: false on every worker call so all results return inline
for aggregation in Step 4.
<Agent tool call 1>
description: "Process batch chunk 1/3"
prompt: "You are a worker agent... [full prompt as above]"
subagent_type: "general-purpose"
run_in_background: false
</Agent tool call 1>
<Agent tool call 2>
description: "Process batch chunk 2/3"
prompt: "You are a worker agent... [full prompt as above]"
subagent_type: "general-purpose"
run_in_background: false
</Agent tool call 2>
<Agent tool call 3>
description: "Process batch chunk 3/3"
prompt: "You are a worker agent.
الأسئلة الشائعة
ما الملفات التي تُتخطى تلقائيا؟
مجلدات شائعة مثل node_modules وdist وbuild وgit، وكذلك ملفات الاختبار وملفات القفل والملفات المصغّرة والملفات الثنائية والملفات التي يزيد حجمها على 500KB.
ماذا لو لم يطابق أي ملف؟
يخبرك الوكيل ويقترح فحص النمط، بدلا من تشغيل دفعة فارغة.
هل تشغيل الدفعة أرخص؟
ليس بالضرورة. يعمل الآن بالتوازي، بينما مهارة Batch API المنفصلة هي الخيار بنصف السعر للعمل الذي يحتمل الانتظار.
التفاصيل
الوصف الأصلي من المؤلف
Execute batch operations on multiple files in parallel. Automatically discovers files, splits into chunks, and processes with parallel worker agents. Use `/batch` followed by operation and file pattern. For many independent single-turn transforms (translate/rewrite/extract each file into a new file) that can wait minutes to hours, you may suggest the user type `/batch-api` themselves for the half-price asynchronous Batch API — you cannot invoke it, and it is not suited to in-place edits or tasks needing tool feedback.
repo: QwenLM/qwen-code
الشعبية
- نجوم GitHub
- 29k
- الترتيب
- #9777
- الترخيص
- Apache-2.0
- آخر تحديث
- 2/11/2026
التعليقات
- …
المزيد من المهارات من هذا المستودع
codegraph
29kيساعد وكيلك على تحليل قاعدة كود مفهرسة عبر رسم الاستدعاءات والتبعيات والكود الميت والنقاط الساخنة والبحث الدلالي.
qwen-code-claw
29kيساعد وكيلك على تسليم مهام البرمجة إلى Qwen Code، مثل فهم قاعدة الكود وإصلاح الأخطاء وإعادة هيكلة الكود وتوليد مشروع جديد.
structured-debugging
29kيعلّم وكيلك طريقة من خطوات لتصحيح الأخطاء الصعبة: صياغة فرضية، وإضافة فحوص موجهة، واختبارها، والوصول إلى السبب الحقيقي قبل الإصلاح.
tmux-real-user-testing
29kيساعد وكيلك على اختبار تطبيق طرفية كمستخدم حقيقي داخل tmux، مع حفظ سجل مقروء خطوة بخطوة ولقطة شاشة لكل إجراء.
مهارات مشابهة
knowledge-automation
394kيساعد وكيلك على إعداد مهمة متكررة تضيف المحتوى الجديد إلى خزنة Knowledge حسب جدول زمني، ثم يتحقق من أنها تعمل.
knowledge-source-ingest
394kيساعد وكيلك على إبقاء خزنة المعرفة محدّثة بالعناصر الجديدة من قنوات الدردشة أو الخلاصات أو صناديق البريد، دون إعادة إضافة ما لديه.
benchmark
280kيساعد وكيلك على قياس سرعة الشيفرة وأدائها، ويفيد في التأكد من أن الأشياء سريعة وفي إيجاد مشكلات البطء.