Customize AI for your project
This guide walks you through setting up AI customizations for your project in Visual Studio Code. You start with basic coding standards and progressively add more targeted capabilities.
By the end, your project will have:
- Project-wide coding standards that apply to every chat request
- File-specific instructions for frontend code
- A reusable prompt file for a common task
- A custom agent with restricted tools
- A skill for a specialized capability
Prerequisites
- VS Code installed
- A GitHub Copilot plan (Free, Pro, Business, or Enterprise)
- The GitHub Copilot extension installed
- An open workspace or folder in VS Code
Step 1: Set project-wide coding standards
Start by generating an instructions file that captures your project's coding standards. These instructions are automatically included in every chat request.
-
Open the Chat view (⌃⌘I (Windows, Linux Ctrl+Alt+I)).
-
Type
/initand press Enter./init -
VS Code analyzes your project structure and generates a
.github/copilot-instructions.mdfile tailored to your codebase. -
Review the generated file and customize it. For example, add a rule about your preferred import style:
## Imports - Use named imports instead of default imports. - Group imports: external libraries first, then internal modules, then relative paths. -
Save the file.
Verify it works: Ask Copilot to generate some code (for example, "create a utility function for date formatting"). Check that the response follows your coding standards. Select the References section in the chat response to confirm that copilot-instructions.md was included.
Learn more about always-on instructions in Use custom instructions.
Step 2: Add file-specific instructions
When different parts of your codebase follow different conventions, use instructions files with applyTo patterns to target specific file types.
-
In the Chat view, select Configure Chat (gear icon) > Instructions & Rules, and then select New instruction file.
-
Select
.github/instructions/to store the instructions in your project. -
Enter a file name, such as
react. -
Add the following content to the file:
--- applyTo: "**/*.tsx,**/*.jsx" --- # React component guidelines - Use functional components with hooks. - Define prop types with TypeScript interfaces. - Use CSS modules for component styling. - Export components as named exports. -
Save the file.
Verify it works: Open a .tsx file and ask Copilot to "create a user profile card component". The response should follow your React-specific conventions. Check the References section to confirm the instructions file was applied.
You can create multiple instructions files for different file types, frameworks, or modules. Learn more in Use .instructions.md files.
Step 3: Create a reusable prompt file
Prompt files encode common tasks as slash commands you can invoke in chat. Create one for a task you perform regularly.
-
In the Chat view, select Configure Chat (gear icon) > Prompt Files, and then select New prompt file.
-
Select
.github/prompts/to store the prompt file in your project. -
Enter a file name, such as
create-component. -
Add the following content to the file:
--- description: Scaffold a new React component with tests agent: agent tools: ['editFiles', 'createFile'] --- Create a new React component based on the user's description. For each component, generate: 1. The component file in `src/components/` 2. A test file in `src/components/__tests__/` Follow the conventions in [React guidelines](../instructions/react.instructions.md). -
Save the file.
Verify it works: In the Chat view, type /create-component a data table with sorting and filtering and press Enter. Copilot should scaffold the component and test file according to your conventions.
Type /create-prompt in chat to generate a prompt file with AI assistance. You can also extract a reusable prompt from an ongoing conversation by asking "save this workflow as a prompt". Learn more in Use prompt files.
Step 4: Build a custom agent
Custom agents let the AI adopt specialized personas with specific tool access. Create a code reviewer agent that can only read code, not modify it.
-
In the Chat view, select Configure Chat (gear icon) > Custom Agents, and then select Create new custom agent.
-
Select
.github/agents/to store the agent in your project. -
Enter a file name, such as
reviewer. -
Add the following content to the file:
--- description: Review code for quality, security, and best practices tools: ['search/codebase', 'search/workspace', 'githubRepo'] --- You are a code reviewer. Analyze the provided code and identify: 1. **Security issues**: SQL injection, XSS, hardcoded secrets, insecure dependencies 2. **Code quality**: complex functions, duplicated logic, missing error handling 3. **Best practices**: naming conventions, documentation, test coverage Provide specific, actionable feedback. Reference the relevant code locations. Do NOT modify any files. Only review and report findings. -
Save the file.
Verify it works: Select the Reviewer agent from the agents dropdown in the Chat view, then ask "review the authentication module". The agent should analyze the code without making changes.
You can add handoffs to your agent to create guided workflows. For example, hand off from a planning agent to an implementation agent. Learn more in Custom agents.
Step 5: Create a skill for a specialized capability
Skills are folders of instructions, scripts, and resources that Copilot loads when relevant to perform specialized tasks. Unlike instructions files that define coding standards, skills teach Copilot how to perform specific workflows.
-
Create a
.github/skills/update-readme/directory in your workspace. -
Create a
SKILL.mdfile in the directory with the following content:--- name: update-readme description: Update the project README to reflect recent code changes. Whenever code changes are made, this skill reviews the changes and updates the README with new features, usage instructions, and API references. --- # Update README When updating the README: 1. Review recent code changes to identify new or modified features 2. Update the relevant sections (installation, usage, API reference) 3. Add entries for new commands, configuration options, or environment variables 4. Remove documentation for deleted or deprecated features 5. Keep the existing tone, structure, and formatting conventions -
Save the file.
Verify it works: In chat, ask Copilot to add a new feature to your project (for example, "add a health check endpoint"). When it generates the code, it should also automatically update the README with the new endpoint's documentation. You can also invoke the skill directly by typing /update-readme in the Chat view.
Type /create-skill in chat to generate a skill with AI assistance. You can also extract a skill from an ongoing conversation by asking "create a skill from what we just did". Learn more in Agent Skills.
What you built
Your project now has a layered AI customization setup:
your-project/
.github/
copilot-instructions.md # Project-wide coding standards (Step 1)
instructions/
react.instructions.md # React-specific conventions (Step 2)
prompts/
create-component.prompt.md # Reusable component scaffolding (Step 3)
agents/
reviewer.agent.md # Read-only code reviewer (Step 4)
skills/
update-readme/
SKILL.md # README updater workflow (Step 5)
Next steps
- Add MCP servers to extend the agent with external tools and services
- Set up hooks to automate tasks at agent lifecycle points, such as running a formatter after every file edit
- Browse agent plugins to install pre-packaged customizations from community marketplaces
- Share customizations with your team by committing the
.github/directory to your repository - See all your customizations in one place with the Chat Customizations editor