Why add repository instructions?
GitHub Copilot (and the Copilot Coding Agent) can use a repository-level instructions file to guide code suggestions, PR creation, and automated changes. Adding a concise .github/copilot-instructions.md helps make suggestions consistent with project conventions, coding style, and workflow expectations.
The 10-second recipe
- Open your terminal at the repository root.
- Run the following command to create the directory (if it doesn’t exist) and write a minimal instructions file:
mkdir -p .github && cat > .github/copilot-instructions.md <<'EOF'
# Copilot Instructions
- Purpose: Provide repository-specific guidance to Copilot and the Copilot coding agent.
- Do: Prefer TypeScript, use Prettier for formatting, run `npm ci` for installs in CI.
- Don't: Modify generated files without confirming with the maintainer.
EOF
- Commit and push the new file:
git add .github/copilot-instructions.md
git commit -m "chore: add copilot instructions"
git push origin HEAD
That’s it — Copilot will pick up the repository instructions the next time it runs in supported contexts.
Example content you can paste (short)
# Copilot Instructions
- Project: My Awesome Repo (TypeScript + React)
- Formatting: Prettier + ESLint (run `npm run format` before committing)
- Tests: Use `npm test` and keep CI green
- Branching: Create feature branches named `feat/short-descriptive-slug`
- PR: Include a small changelog entry in PR description
Notes and tips
- Keep the instructions short and actionable — Copilot prefers concise rules.
- If you have multiple projects in a monorepo, add a path-specific instructions file under each package’s
.github/directory. - Use the repo settings or CODEOWNERS for permissions — Copilot doesn’t change access control.
References
- GitHub Docs: Add repository instructions for Copilot — see GitHub documentation for the latest features and supported file formats.