نظام الإضافات

استخدم نظام إضافات Claude Code لإنشاء أوامر ووكلاء وسير عمل مخصصة

آخر تحديث 2026-11-13

تحتاج مفتاح API؟ أنشئ حسابًا ←نقاط النهاية وعناوين Base URL ←

في هذه الصفحة

يتيح لك نظام إضافات Claude Code توسيع قدرات Claude من خلال إنشاء أوامر شرطة مائلة مخصصة، ووكلاء متخصصين، ومهارات قابلة لإعادة الاستخدام، وخطافات أتمتة. وباستخدام الإضافات، يمكنك تقنين أفضل ممارسات فريقك وسير عمله.

ما هي الإضافات؟

المفاهيم الأساسية

إضافة Claude Code عبارة عن مجلد ذي بنية ملفات محددة يمكنه إضافة المكونات التالية:

المكوّن الوصف تنسيق الملف
الأوامر أوامر شرطة مائلة مخصصة ملفات .md
الوكلاء وكلاء فرعيون لمهام متخصصة ملفات .md
المهارات معرفة وقدرات قابلة لإعادة الاستخدام مجلد + SKILL.md
الخطافات أتمتة تُثار بالأحداث hooks.json

لماذا الإضافات؟

  • توحيد معايير الفريق: ضمّن معايير البرمجة ومعايير المراجعة كأوامر قابلة للتنفيذ

  • أتمتة سير العمل: أتمت المهام المتكررة مثل عمليات الالتزام والنشر والمراجعة

  • مشاركة المعرفة: شارك أفضل الممارسات والخبرات بين أعضاء الفريق

  • تجربة مخصصة: خصّص سلوك Claude وفق احتياجات المشروع

بنية مجلد الإضافة

my-plugin/
├── .claude-plugin/
│   └── plugin.json          # Required: Plugin manifest
├── commands/                 # Slash commands (.md files)
│   ├── review.md
│   └── deploy.md
├── agents/                   # Subagent definitions (.md files)
│   └── code-reviewer.md
├── skills/                   # Agent skills (subdirectories)
│   └── coding-standards/
│       └── SKILL.md
├── hooks/
│   └── hooks.json           # Event handler configuration
├── .mcp.json                # MCP server definitions (optional)
└── scripts/                 # Helper scripts (optional)

البدء السريع

تثبيت الإضافات

# Install from marketplace
/plugin install plugin-name@claude-code-marketplace

# Install from local directory
claude --plugin-dir /path/to/my-plugin

استخدام معالج إنشاء الإضافات

/plugin-dev:create-plugin

يرشدك هذا الأمر عبر 8 مراحل لإنشاء إضافة كاملة.

إنشاء أوامر مخصصة

تنسيق الأمر الأساسي

أنشئ ملفات .md في المجلد commands/:

---
description: Perform code review
argument-hint: [file-path]
allowed-tools: Read, Bash(git:*)
---

Please review the code quality of: @$1

Focus on:
1. Code readability
2. Potential bugs
3. Performance issues
4. Security vulnerabilities

إعداد مقدمة YAML

الحقل الوصف مثال
description وصف الأمر (يظهر في /help) Perform code review
argument-hint تلميحات المعاملات [file-path] [options]
allowed-tools الأدوات المسموح بها Read, Bash(git:*)
model تحديد النموذج opus أو sonnet

استخدام الوسائط الديناميكية

  • $1, $2, $3... - الوسائط الموضعية

  • $ARGUMENTS - جميع الوسائط

  • @path/to/file - مرجع ملف

  • !command`` - تنفيذ أمر Bash

أمثلة على الأوامر

أمر مراجعة الشيفرة (commands/review.md):

---
description: Comprehensive code review
argument-hint: [file-or-directory]
allowed-tools: Read, Grep, Glob
model: opus
---

Perform a comprehensive code review of @$1.

Checklist:

- [ ] Code style follows project standards
- [ ] No potential security issues
- [ ] Error handling is complete
- [ ] Tests are needed

If it's a directory, first use Glob tool to find all relevant files.

أمر الالتزام الذكي (commands/commit.md):

---
description: Smart commit with generated message
allowed-tools: Bash(git:*)
---

1. Run `git status` to see changes
2. Run `git diff --staged` to analyze staged changes
3. Generate a conventional commit message based on changes
4. Execute `git commit`

Commit message format:

- feat: New feature
- fix: Bug fix
- docs: Documentation update
- refactor: Refactoring
- test: Test related

إنشاء وكلاء مخصصين

تنسيق تعريف الوكيل

أنشئ ملفات .md في الدليل agents/:

---
description: Specialized code review agent
model: opus
tools: Read, Grep, Glob
---

You are a professional code review agent. Your task is to:

1. Carefully read the provided code
2. Identify potential issues
3. Provide specific improvement suggestions
4. Focus on security and performance

Always be constructive and specific.

أنواع الوكلاء

النوع الغرض المثال
وكيل المراجعة مراجعة الشيفرة، مراجعة PR code-reviewer
وكيل الاختبار إنشاء الاختبارات وتشغيلها test-generator
وكيل الوثائق إنشاء الوثائق doc-writer
وكيل إعادة الهيكلة إعادة هيكلة الشيفرة refactorer

إنشاء المهارات

بنية دليل المهارة

skills/
└── coding-standards/
    ├── SKILL.md              # Required: Skill definition
    ├── references/           # Reference materials
    │   └── style-guide.md
    └── examples/             # Example code
        └── good-practices.md

تنسيق SKILL.md

# Coding Standards Skill

## Overview
This skill contains team coding standards and best practices.

## Knowledge Content

### Naming Conventions

- Variables: camelCase
- Constants: UPPER_SNAKE_CASE
- Classes: PascalCase
- Files: kebab-case

### Code Style

- Use 2-space indentation
- Max line width 100 characters
- Use semicolons

### Error Handling

- Always use try-catch
- Log errors
- Provide meaningful error messages

إنشاء الخطافات

تنسيق hooks.json

{
  "hooks": [
    {
      "event": "on_commit",
      "command": "npm run lint",
      "description": "Run lint check before commit"
    },
    {
      "event": "on_file_change",
      "pattern": "*.ts",
      "command": "npm run typecheck",
      "description": "Type check when TypeScript files change"
    }
  ]
}

الأحداث المدعومة

الحدث يُفعَّل عندما
on_commit إيداع الشيفرة (commit)
on_file_change تغيّر ملف
on_session_start بدء جلسة
on_command تنفيذ أمر

بيان الإضافة

تنسيق plugin.json

{
  "name": "my-plugin",
  "version": "1.0.0",
  "description": "My custom plugin",
  "author": "Your Name",
  "components": {
    "commands": ["commands/*.md"],
    "agents": ["agents/*.md"],
    "skills": ["skills/*/SKILL.md"],
    "hooks": "hooks/hooks.json"
  },
  "mcpServers": ".mcp.json"
}

أمثلة عملية

المثال 1: إضافة مراجعة الكود للفريق

team-review-plugin/
├── .claude-plugin/
│   └── plugin.json
├── commands/
│   ├── review-pr.md          # PR review command
│   ├── security-check.md     # Security check command
│   └── perf-audit.md         # Performance audit command
├── agents/
│   ├── security-reviewer.md  # Security review agent
│   └── perf-analyzer.md      # Performance analysis agent
└── skills/
    └── team-standards/
        └── SKILL.md          # Team standards skill

المثال 2: إضافة أتمتة النشر

deploy-plugin/
├── .claude-plugin/
│   └── plugin.json
├── commands/
│   ├── deploy-staging.md     # Deploy to staging
│   ├── deploy-prod.md        # Deploy to production
│   └── rollback.md           # Rollback command
├── hooks/
│   └── hooks.json            # Pre-deploy check hooks
└── .mcp.json                 # Kubernetes MCP config

أفضل الممارسات

تصميم الأوامر

  1. مسؤولية واحدة: يؤدّي كل أمر مهمة واحدة

  2. أوصاف واضحة: اجعل الوصف موجزًا

  3. وثّق المعاملات: استخدم argument-hint لشرح المعاملات

  4. أقل صلاحيات ممكنة: لا تُدرج في allowed-tools سوى الأدوات اللازمة

  5. معالجة الأخطاء: ضع في الحسبان سيناريوهات الفشل

تنظيم الإضافات

  1. نمطي: نظّم الوظائف المترابطة معًا

  2. قابل لإعادة الاستخدام: ينبغي أن تكون المهارات صالحة للاستخدام من أوامر متعددة

  3. موثّق: أضف README وتعليمات الاستخدام

  4. مُرقَّم الإصدارات: استخدم الإصدارات الدلالية

اعتبارات الأمان

  1. لا أسرار مضمّنة في الكود: استخدم متغيرات البيئة

  2. قيّد الوصول إلى الملفات: لا تصل إلا إلى المسارات اللازمة

  3. تحقّق من الإدخال: تحقّق من المعاملات

  4. سجلات التدقيق: سجّل العمليات الحساسة

تصحيح أخطاء الإضافات

# View plugin load status
/plugin list

# View command details
/help my-command

# Test command
/my-command test-argument

الخطوات التالية

ابدأ مع QCode

مفتاح API واحد لـ Claude Code وCodex وغيرها — تُحسب حسب التوكن، وأسعار كل نموذج على qcode.cc/models

المؤسسات ←