← BLOG
Tutorial

إنشاء مهارات وأوامر مخصصة لكلود كود

Skills turn repetitive prompts into reusable commands. Write a SKILL.md once, invoke it with /skill-name, and Claude Code executes the full workflow every time.

المهارات هي ملفات تخفيض السعر التي تحدد سير العمل القابل لإعادة الاستخدام لـ Claude Code. بدلاً من كتابة نفس الموجه المعقد في كل مرة تريد النشر أو تشغيل مراجعة التعليمات البرمجية أو إنشاء وثائق، يمكنك كتابة SKILL.md مرة واحدة واستدعاءه باستخدام أمر شرطة مائلة.

What is a Claude Code Skill?

المهارة عبارة عن ملف تخفيض السعر (SKILL.md) يحتوي على تعليمات يتبعها Claude Code عند استدعائها. ويمكن أن يتضمن وصفًا وقيودًا للأداة وإعدادات السياق وتعليمات خطوة بخطوة. فكر في الأمر كمطالبة محفوظة ذات قوى خارقة.

كيف تصنع مهارة؟

Create a SKILL.md file in your project's .claude/skills/ directory (shared with team) or in ~/.claude/skills/ (personal):

# .claude/skills/deploy.md
---
name: deploy
description: Deploy the current branch to staging
allowed-tools: Bash, Read
---

## Steps
1. Run the test suite: `npm run test`
2. If tests pass, build the project: `npm run build`
3. Deploy to staging: `npm run deploy:staging`
4. Verify the deployment by checking the health endpoint
5. Post a summary of what was deployed

الآن يمكنك استدعاء ذلك:

# In Claude Code
> /deploy

ما هي خيارات الواجهة الأمامية المتاحة؟

خيارماذا يفعلمثال
اسماسم أمر القطعdeploy
وصفيظهر في قائمة المهاراتنشر إلى التدريج
الأدوات المسموح بهاقم بتقييد الأدوات التي يمكن للمهارة استخدامهاباش، اقرأ، عدل
disable-model-invocationمنع مكالمات الذكاء الاصطناعي المتداخلةحقيقي
سياقالتعامل مع الجلسةشوكة (يعمل في سياق معزول)

ما هي حالات الاستخدام الجيد للمهارات؟

  • +سير عمل النشر (الاختبار ← البناء ← النشر ← التحقق)
  • +Code review checklists (security, performance, style)
  • +إنشاء الوثائق (مستندات API، وسجلات التغيير، والملفات التمهيدية)
  • +عمليات قاعدة البيانات (الترحيل، البذر، النسخ الاحتياطي)
  • +إعداد أعضاء الفريق الجدد (جولة المشروع، التحقق من الإعداد)
  • +إدارة الإصدار (زيادة الإصدار، سجل التغيير، العلامة، النشر)

كيف تستخدم المتغيرات في المهارات؟

تدعم المهارات الحجج من خلال $ARGUMENTS (النص الكامل) والمتغيرات الموضعية ($0، $1، وما إلى ذلك):

# .claude/skills/create-component.md
---
name: create-component
description: Create a new React component
---

Create a new React component named $0 in the components directory.

Requirements:
- TypeScript with proper props interface
- Tailwind CSS for styling
- Export as default
- Include basic unit test in __tests__/

Usage: /create-component UserProfile

الاستدعاء مع الحجج

# Single argument
> /create-component UserProfile

# Multiple arguments
> /create-component UserProfile --with-tests --with-story

كيف تشارك مهاراتك مع فريقك؟

Put Skills in your project's .claude/skills/ directory and commit them to git. Every developer who clones the repo gets the same skills. Personal skills go in ~/.claude/skills/ and don't get shared.

الأسئلة المتداولة

عودوا للكتابالبداية الحرة - الوحدة ١