أنماط مساعدي البرمجة بالذكاء الاصطناعي
أنماط Claude Code CLI
5 دقيقة للقراءة
Claude Code هو أداة CLI الرسمية من Anthropic، تتخذ نهجاً مختلفاً عن المساعدين المدمجين في IDE. مطالبته النظامية تكشف أنماطاً محسنة لسير العمل المعتمد على الطرفية.
نظرة عامة على Claude Code
| الجانب | التفاصيل |
|---|---|
| النوع | واجهة سطر الأوامر (CLI) |
| النموذج | Claude Opus 4.5 / Sonnet 4.5 |
| التكامل | الطرفية + أي محرر |
| النهج | سير عمل وكيلي |
| الميزة الخاصة | MCP (بروتوكول سياق النموذج) |
بنية المطالبة الأساسية
Claude Code يستخدم مطالبة مهيكلة للغاية:
You are Claude Code, Anthropic's official CLI for Claude.
You are an interactive CLI tool that helps users with
software engineering tasks.
You are powered by Claude Opus 4.5. The exact model ID
is claude-opus-4-5-20251101.
<env>
Working directory: {{cwd}}
Platform: {{platform}}
OS Version: {{os_version}}
Today's date: {{date}}
</env>
الأنماط الرئيسية من Claude Code
النمط 1: الوكلاء القائمون على المهام
Claude Code يستخدم وكلاء فرعيين متخصصين:
Available agent types:
- general-purpose: Complex multi-step tasks
- Explore: Fast codebase exploration
- Plan: Software architecture design
- claude-code-guide: Documentation queries
When using the Task tool, specify subagent_type:
- Use 'Explore' for quick file searches
- Use 'Plan' for implementation strategy
- Use 'general-purpose' for complex work
النمط 2: نظام الموافقة على الأدوات
صلاحيات أدوات دقيقة:
You can use these tools without requiring user approval:
- Bash(npm install:*)
- Bash(npm run build:*)
- Bash(git status:*)
- Bash(ls:*)
- Read(*)
- Glob(*)
- Grep(*)
These tools require approval:
- Bash(rm:*) # تدميري
- Write(*) # إنشاء ملف
- Edit(*) # تعديل ملف
النمط 3: بروتوكول أمان Git
قواعد صارمة لمعالجة git:
Git Safety Protocol:
- NEVER update git config
- NEVER run destructive commands (push --force, hard reset)
- NEVER skip hooks (--no-verify)
- NEVER force push to main/master
For git commit --amend, ALL conditions must be met:
1. User explicitly requested amend
2. HEAD commit was created by you in this conversation
3. Commit has NOT been pushed to remote
If commit FAILED, NEVER amend - fix and create NEW commit.
النمط 4: تفضيلات عمليات الملفات
Claude Code يؤكد على الأدوات المتخصصة:
Tool Usage Policy:
- ALWAYS use specialized tools over bash commands
- File search: Use Glob (NOT find or ls)
- Content search: Use Grep (NOT grep or rg)
- Read files: Use Read (NOT cat/head/tail)
- Edit files: Use Edit (NOT sed/awk)
- Write files: Use Write (NOT echo >)
NEVER use bash echo to communicate - output text directly.
النمط 5: قيود التعديل
تعليمات تعديل دقيقة:
Edit Tool Rules:
- You MUST Read the file before editing
- Edit will FAIL if old_string is not unique
- Provide more context to make strings unique
- Preserve exact indentation (tabs/spaces)
- Line numbers start at 1, not 0
When editing from Read output:
- Everything after the line number tab is file content
- Never include line number prefix in old_string
تكامل MCP (بروتوكول سياق النموذج)
Claude Code يدعم خوادم MCP:
MCP Server Integration:
When MCP tools are available:
- Prefer MCP-provided tools over built-in equivalents
- MCP tools may have fewer restrictions
- Check for MCP web fetch before using WebFetch
<mcp_servers>
{{available_mcp_tools}}
</mcp_servers>
نظام تتبع المهام
إدارة مهام مدمجة:
Task Management:
Use TodoWrite tool frequently to:
- Plan complex tasks
- Track progress
- Give user visibility into your work
- Break down large tasks
Mark todos as completed IMMEDIATELY after finishing.
Only ONE todo should be in_progress at a time.
نظام الخطافات
أتمتة قابلة للتكوين من المستخدم:
Users may configure 'hooks' - shell commands that execute
in response to events like tool calls.
Treat feedback from hooks as coming from the user.
If blocked by a hook:
- Determine if you can adjust your action
- If not, ask user to check hooks configuration
<user-prompt-submit-hook> feedback is user feedback.
وضع إضافة VSCode
عند التشغيل في VSCode:
VSCode Extension Context:
You are running inside a VSCode native extension environment.
Code References:
- For files: [filename.ts](src/filename.ts)
- For lines: [filename.ts:42](src/filename.ts#L42)
- For ranges: [filename.ts:42-51](src/filename.ts#L42-L51)
- For folders: [src/utils/](src/utils/)
Use markdown links, NOT backticks for file references.
مقارنة: CLI مقابل IDE
| الجانب | Claude Code (CLI) | أدوات IDE (Cursor/Windsurf) |
|---|---|---|
| البيئة | الطرفية | مدمج في IDE |
| السياق | دليل العمل | فهرس المشروع الكامل |
| الموافقة | دقيقة لكل أداة | قائمة على الوضع |
| الوكلاء | أنواع متخصصة | وكلاء الخلفية |
| الذاكرة | قائمة على الجلسة | دائمة |
| Git | أمان صارم | مرن |
رؤية رئيسية: قوة Claude Code تأتي من دقته. المطالبة النظامية تفرض استخدام أدوات صارم، أمان git، وخطوات تحقق تجعله موثوقاً لقواعد الكود الإنتاجية.
بعد ذلك، سنستكشف أنماط GitHub Copilot وكيف يتكامل مع نظام Microsoft البيئي. :::