التخصيص — التعليمات وملفات Prompt وMCP
علّم Copilot اتفاقيات مشروعك باستخدام التعليمات المخصصة، وأنشئ ملفات prompt قابلة للإعادة الاستخدام، وصل خوادم MCP، واستكشف Copilot Spaces.
علّم Copilot اتفاقيات مشروعك باستخدام التعليمات المخصصة، وأنشئ ملفات prompt قابلة للإعادة الاستخدام، وصل خوادم MCP، واستكشف Copilot Spaces.
تتيح لك التعليمات المخصصة إعطاء Copilot سياقاً دائماً حول مشروعك — أسلوب الترميز، ومجموعة التقنيات، واتفاقيات التسمية — حتى لا تضطر لتكرارها في كل رسالة chat.
أنشئ .github/copilot-instructions.md في جذر مستودعك:
# Project: Acme Commerce Platform
## Tech Stack
- Next.js 15 (App Router), TypeScript strict
- Tailwind CSS v4 — no tailwind.config.js
- Drizzle ORM + Postgres
- Vitest for unit tests, Playwright for E2E
## Conventions
- Components are named with PascalCase and live in `src/components/`
- Server actions live in `src/actions/` with the suffix `Action`
- Database queries stay in `src/db/queries/` — never inline in components
- Always use named exports, never default exports for components
## Code Style
- Prefer `const` arrow functions
- No `any` — use `unknown` and narrow with type guards
- Error handling: throw typed errors, catch at the boundary
## Do Not
- Do not use `useEffect` for data fetching
- Do not add barrel `index.ts` files
- Do not write class-based React componentsيقرأ Copilot هذا الملف لكل طلب في ذلك المستودع. تنطبق التعليمات على الإكمالات المضمّنة واستجابات chat ووضع Agent.
في إعدادات VS Code (Cmd+,)، ابحث عن "Copilot Instructions". يمكنك إضافة تفضيلات شخصية تنطبق على جميع المشاريع — أسلوب تسمية المتغيرات المفضل لديك، وتفضيلات اللغة، وما إلى ذلك.
Prefer functional programming patterns. Always include JSDoc for public APIs.
Use early returns to reduce nesting.
ملفات Prompt هي قوالب chat قابلة للإعادة الاستخدام محفوظة كملفات .prompt.md في .github/prompts/. تتيح لك ولفريقك توحيد المهام الشائعة المدعومة بالذكاء الاصطناعي.
<!-- .github/prompts/create-api-endpoint.prompt.md -->
---
mode: agent
description: Scaffold a new REST API endpoint
---
Create a new API endpoint for the **${input:Resource name}** resource.
Follow these steps:
1. Add a route file at `src/app/api/${input:route path}/route.ts`
2. Implement GET, POST handlers with proper error handling
3. Add Zod validation schema for POST body
4. Add a database query in `src/db/queries/${input:resource}.ts`
5. Write unit tests in `__tests__/api/${input:resource}.test.ts`
Use the existing `src/app/api/users/route.ts` as a reference for code style.في VS Code Copilot Chat، اكتب / وابدأ بكتابة اسم ملف prompt. يُدرج Copilot prompts المتاحة من .github/prompts/. اختر واحداً لتحميله — تصبح العناصر النائبة ${input:...} حقولاً تملؤها قبل الإرسال.
يتيح ذلك لفريقك بناء مكتبة من سير العمل الموحدة بالذكاء الاصطناعي لأشياء مثل:
ملفات Prompt مع mode: agent تُفعّل وضع Agent تلقائياً عند اختيارها. استخدم mode: ask للـ prompts المخصصة لـ chat فقط.
يدعم Copilot خوادم Model Context Protocol (MCP) التي توسّع قدراته بأدوات خارجية ومصادر بيانات. في VS Code، هيّء خوادم MCP عبر واجهة إعدادات Copilot أو في .vscode/mcp.json.
افتح command palette في VS Code (Cmd+Shift+P) وشغّل "GitHub Copilot: Configure MCP Servers"، أو أنشئ .vscode/mcp.json:
{
"servers": {
"github": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_TOKEN": "${env:GITHUB_TOKEN}"
}
},
"postgres": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-postgres",
"postgresql://localhost/mydb"
]
}
}
}بمجرد الاتصال، يمكن لـ Copilot استخدام هذه الخوادم في وضع Agent. اطرح أسئلة باللغة الطبيعية:
What are the 5 most recent GitHub issues tagged "bug" in this repo?
How many orders came in today?
يستدعي Copilot أداة MCP المناسبة، يحصل على البيانات، ويدرجها في استجابته.
Copilot Spaces (متاح في خطتي Business وEnterprise) هي مساحات عمل AI قابلة للمشاركة تجمع:
استخدم Spaces لإنشاء بيئات AI مخصصة لسير عمل محددة: مساحة تصميم API، ومساحة تصحيح أخطاء، ومساحة توثيق. يحتفظ كل Space بالسياق عبر الجلسات وعبر أعضاء الفريق.
Copilot Spaces ميزة خاصة بخطة Enterprise. تحقق من خطتك في github.com/settings/copilot قبل محاولة إنشاء واحد.
ذاكرة Copilot (في مرحلة المعاينة منذ 2025) تتذكر تلقائياً المعلومات التي تشاركها عبر الجلسات:
تستمر الذاكرة على مستوى المستخدم — وليس لكل مستودع. يمكنك عرض وحذف الذكريات في إعدادات Copilot على github.com/settings/copilot/memory.
تلغي التعليمات المخصصة تكرار إعداد السياق. توحّد ملفات Prompt سير العمل الشائعة بالذكاء الاصطناعي لفريقك. تربط خوادم MCP Copilot بقواعد بياناتك وواجهات API والأدوات الخارجية. معاً تحوّل هذه الميزات Copilot من مساعد عام إلى متعاون عميق الوعي بالسياق يفهم مشروعك ومجموعة تقنياتك واتفاقياتك المحددة.