---
name: github-copilot-instructions-builder
description: "Generates a copilot-instructions.md that steers Copilot toward your stack, repo layout and standards, and away from its recurring mistakes. Use when a repository owner wants a copilot-instructions.md so GitHub Copilot follows the codebase's stack, layout and conventions. Do not use for rules files for other editors or one-off task briefs. Related topics: AI, Coding, Engineering."
---

# GitHub Copilot Instructions Builder

Generates a copilot-instructions.md that steers Copilot toward your stack, repo layout and standards, and away from its recurring mistakes.

## When to use

Use this skill when a repository owner wants a copilot-instructions.md so GitHub Copilot follows the codebase's stack, layout and conventions. Do not use it for rules files for other editors or one-off task briefs.

## Workflow

1. Ask the user for each input listed below in a single message, skipping any they have already given. Where options are listed, offer them, but accept other answers too.
2. Summarise the stack, layout and conventions using real paths and version numbers from the inputs.
3. Convert each recurring Copilot mistake into a rule naming the wrong pattern and the correct replacement.
4. Order the rules by cost of violation so forbidden dependencies and deprecated modules come first.
5. Write all rules as short imperatives under headings and drop generic advice.
6. Review the file for contradictions and confirm every path it names appears in the layout.

## Inputs

- **Project name and purpose** (free text, e.g. "Orders API for the storefront")
- **Language, framework and versions** (free text, e.g. "Python 3.12 with FastAPI")
- **Repo layout** (longer free text)
- **Coding standards to enforce** (longer free text)
- **Habits to enforce** (choose any: Prefer existing utilities over new ones, Always include types, Write tests alongside code, Keep functions small, Follow existing file structure)
- **Mistakes Copilot keeps making here** (longer free text)
- **Areas or patterns to avoid** (longer free text)

## Output

A commit-ready markdown file with short headed sections of one-line imperative rules, strictest constraints first.

## Prompt template

Fill the inputs into this template and follow it as the full instruction.

### Copilot Instructions File

Write a copilot-instructions.md that keeps GitHub Copilot's suggestions consistent with this repository.

#### Project
- Project name and purpose: {{Project name and purpose}}
- Language, framework and versions: {{Language, framework and versions}}
- Repo layout: {{Repo layout}}

#### Conventions
- Coding standards to enforce: {{Coding standards to enforce}}
- Habits to enforce: {{Habits to enforce}}
- Mistakes Copilot keeps making here: {{Mistakes Copilot keeps making here}}

#### Boundaries
- Areas or patterns to avoid: {{Areas or patterns to avoid}}

Output a ready-to-commit copilot-instructions.md with concise imperative rules under short headings, strictest constraints first. Turn each recurring mistake into a rule that names the wrong pattern and the right one, for example "Use the shared http client in lib/http, never raw fetch". Cite real paths from the layout. Omit generic advice that any developer already knows.

## Pitfalls

- Describing conventions in prose instead of one-line rules the model can follow.
- Naming paths that do not exist in the repo, which makes the rule ignorable.
- Skipping the recurring mistakes, which are the highest-value rules.
