c/agents › command
0votes

GitHub Copilot custom instructions file

TemplateLow risk Tested
submitted by CommandVault editors to c/agents · 1 use

A .github/copilot-instructions.md that makes Copilot chat and agent mode follow your repo's rules.

Template · 9 variables
# Copilot instructions for {{repo_name}}

## About this repository
{{repo_description}}. Main language: {{language}}. Framework: {{framework}}.

## How to build and test
- Install: `{{install_command}}`
- Test: `{{test_command}}`
- Lint: `{{lint_command}}`
Always run the tests related to files you change.

## Coding standards
- Follow the existing patterns in the folder you're editing.
- Small, focused functions; descriptive names; no abbreviations.
- Handle errors explicitly; never swallow exceptions.
- Add or update tests with every behavior change.

## Pull requests
- Title: imperative, under 60 characters.
- Description: what changed, why, how it was tested, risks.

## Do not
- Edit generated files in `{{generated_folder}}`.
- Add dependencies without explaining why in the PR.
- Change public APIs without updating `{{api_docs_path}}`.
0 commentsreport

Guide

What you get: The agent fixes and extends code while leaving the generated folder alone, updates your API docs, runs the related tests and writes a PR title and description in your format. Best for Teams that use GitHub Copilot chat/agent mode (or any agent reading a repo instructions file)..

Before you start

  • Save as .github/copilot-instructions.md
  • Fill all nine fields with real values (install, test and lint commands, generated folder, API docs path)
  • To use the same rules in Claude Code or Codex, save the text as CLAUDE.md / AGENTS.md too

Worked example (Nov 14, 2026, Claude Code 2.1.318 (claude-opus-5-5); Codex 0.151.0 (gpt-5.6-sol))

Input

parcelpost, a TypeScript library with a generated carrier client in src/generated/ ("DO NOT EDIT") and docs/api.md. Task: fix billableWeightKg returning grams, add an exported cheapestQuote(), rename the generated client's billableWeight field to billableWeightGrams, then write the PR title and description.

Result

Claude Code: "I didn't do item 3, because billableWeight lives in a generated file the repo rules say not to edit." PR title `Fix billable weight units and add cheapestQuote`. Codex: left src/generated untouched and added a hand-written adapter exposing billableWeightGrams; PR title `Fix quote weights and add cheapest quote`.

Not tested in Copilot: the filled file was saved as .github/copilot-instructions.md and also as CLAUDE.md (Claude Code) and AGENTS.md (Codex), which those agents load at startup. Re-run by us: npm test and npm run lint pass for both; git diff shows no change under src/generated/; docs/api.md updated by both; both PR titles imperative and under 60 characters, descriptions have what/why/how tested/risks. Codex's adapter changes the type injected clients must return; it listed that as a risk.

How to check it worked

  • git diff --stat -- <generated folder> should be empty
  • Check the API docs changed alongside any new export
  • Check the PR description has what, why, how tested and risks

Common problems

  • A request that targets a generated file: the agent should refuse or work around it, not edit it
  • Repo description ending in a period produces '..' before 'Main language'

How to use these Copilot instructions

  1. Fill in the 9 blanks above; Copy puts your answers into the file.
  2. Save it as .github/copilot-instructions.md in your repo and commit it. GitHub Copilot includes it in chat requests for that repository.
  • {{repo_name}} Repo name
  • {{repo_description}} Repo description
  • {{language}} Language
  • {{framework}} Framework
  • {{install_command}} Install command
  • {{test_command}} Test command
  • {{lint_command}} Lint command
  • {{generated_folder}} Generated folder
  • {{api_docs_path}} Api docs path

More from c/agents

See all of c/agents →
0 comments

Log in to join the discussion.