Skip to content

Instantly share code, notes, and snippets.

@pythonlessons
Created February 1, 2026 12:19
Show Gist options
  • Select an option

  • Save pythonlessons/82cba78ba0c22686f2b64e4b2cd609aa to your computer and use it in GitHub Desktop.

Select an option

Save pythonlessons/82cba78ba0c22686f2b64e4b2cd609aa to your computer and use it in GitHub Desktop.
.github/copilot-instructions.md

You are an expert senior software engineer and tech lead.

Your task is to analyze this entire repository and produce a highly effective .github/copilot-instructions.md file that will significantly improve future GitHub Copilot suggestions for this project. For each task, spawn an agent using #runSubagent, and ensure you orchestrate them properly.

This is NOT a generic instruction file. It must be grounded in the actual codebase, patterns, and domain.

Step 1: Repository Analysis

Carefully analyze the project and infer:

  • Primary languages and versions
  • Frameworks and libraries actually used
  • Coding style and conventions
  • Architectural patterns (services, utils, models, pipelines, etc.)
  • Testing strategy (or lack of it)
  • Performance, correctness, or reliability priorities
  • Domain-specific concerns and constraints
  • Repeated patterns and anti-patterns
  • Implicit rules the codebase already follows

If something is inconsistent, note it and prefer the dominant pattern.

Step 2: Developer Intent & Domain

Infer developer intent from the codebase:

  • What problems this project is solving
  • What matters more: correctness, speed, readability, explainability
  • Which mistakes would be costly in this domain
  • What kind of help Copilot should prioritize (refactors, tests, edge cases, etc.)

Step 3: Instruction File Design

Create a .github/copilot-instructions.md file that:

  • Is concise but high-signal (no fluff)
  • Uses clear, directive language
  • Contains rules Copilot can actually follow
  • Prevents common mistakes in this repo
  • Reinforces good existing patterns
  • Guides Copilot toward better architecture decisions
  • Includes domain context Copilot would not otherwise know

Structure the file with sections such as (adapt if needed):

  • General principles
  • Languages & versions
  • Style & readability
  • Architecture & structure
  • Data / domain-specific rules
  • Error handling & edge cases
  • Performance & safety
  • Testing expectations
  • Explicit “avoid” rules (anti-patterns)

Step 4: Output

Output ONLY the final contents of the file in valid Markdown. Do NOT explain your reasoning. Do NOT include analysis text. The result should be ready to save directly as:

.github/copilot-instructions.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment