11 Hidden GitHub Copilot Tricks Every Developer Should Know

# .github/instructions/sql.instructions.md
---
applyTo: "**/*.sql"
---
- Always terminate SQL statements with a semicolon.
- Use parameterized queries to prevent SQL injection.
/* (pasted entire AuthService.ts here) */
Refactor this class to use async/await.
do:
#file:AuthService.ts refactor class to use async/await
TipCategoryDifficultyImpactWhen to use
Slash Commands (e.g. /fix, /tests)Tooling/Productivity★☆☆High – instant actionWhen needing fixes, tests, docs quickly
File References (#file:)Context Management★☆☆High – accuracy/costWhen asking Copilot about a specific file
Custom Instructions FileConfiguration/Standards★★☆High – code qualityAt project setup; enforce team rules
Scoped Instructions (applyTo)Configuration/Context★★☆Medium – cost savingWhen instructions should only apply to some files
Next Edit Suggestions (NES)Productivity/Refactoring★★☆High – speed/accuracyDuring refactoring or repetitive edits
Agent Mode / Cloud AgentAutomation/AI Workflow★★★High – automationFor multi-step tasks or backlog issues
Agentic Code Review (Implement PRs)Code Review/Automation★★☆Medium – convenienceWhen accepting Copilot review suggestions
Agent Hooks (pre/post checks)DevOps/Quality★★☆High – code qualityAlways: to run linters/tests during AI runs
MCP IntegrationIntegration/Data Access★★★High – contextWhen needing Copilot to use external data
GitHub Spark (App generation)Tooling/Prototyping★★☆High – rapid prototypingWhen you need a quick full-stack prototype
Copilot CLI (Plan & Autopilot)Tooling/Automation★★★High – automationFor scripting complex, multi-step tasks
“Code-Only” Directive (trim output)Cost Optimization★☆☆High – cost reductionOn every coding prompt (except when explanation needed)
Terse Prompts (concise requests)Cost Optimization★☆☆High – cost reductionAlways – make prompts as brief as possible
Trim Instructions File (short text)Cost Optimization★★☆Medium – cost reductionKeep repo instructions minimal at all times
Close Unused Files (limit context)Cost Optimization★☆☆Medium – cost reductionBefore starting Copilot sessions
Model Routing (pick cheaper model)Cost/Performance★☆☆High – cost/perfUse cheapest sufficient model for task
No Full File Pasting (attach or open)Cost/Usability★☆☆Medium – cost/clarityReference files; avoid copy-paste large code
Fresh Conversations (reset chat)Cost/Workflow★☆☆Medium – costStart a new chat when switching topics
Usage Dashboard (monitor costs)Budget/Management★☆☆Medium – controlRegularly (weekly/monthly) check usage