Custom Instructions: Apply Rules to Specific Parts of Your Project

Different folders often require different types of guidance. Documentation, tests, templates, and source code rarely follow identical rules. Custom instruction files allow you to define folder-specific behavior so Copilot adapts automatically depending on where you are working.

When to use custom instructions

Examples include:

  • Documentation folders
  • Assignment content
  • Test projects
  • Infrastructure scripts
  • Sample applications

How to create custom instructions

  1. Create an instruction file in the appropriate location.
  2. Describe the expected structure and formatting.
  3. Specify any required sections.
  4. Define optional content such as starter code or examples.

Example

# assignments.instructions.md

When creating a new assignment:

- Start with a title.
- Add learning objectives.
- Include prerequisites.
- Add step-by-step instructions.
- Finish with review questions.
- Provide starter code when applicable.

Whenever Copilot generates content for assignments, it can follow these requirements automatically.

Best practices

  • Keep each instruction focused on one purpose.
  • Store instructions close to the content they describe.
  • Update them whenever the folder structure changes.
  • Avoid duplicating global project rules.
instructions
assignments
copilot
workflow
automation

Comments