GitHub Copilot Tips: 10 Tricks Every Developer Should Know
GitHub Copilot Tips: 10 Tricks Every Developer Should Know
GitHub Copilot has transformed how developers write code. But are you using it to its full potential? Here are 10 tips that will supercharge your Copilot experience.
1. Write Detailed Comments First
Copilot generates better code when it understands context. Write a detailed comment before you start coding:
// Function to validate email addresses
// - Check for @ symbol
// - Verify domain has at least one dot
// - Return true if valid, false otherwise
// - Handle edge cases like empty strings
function validateEmail(email) {
// Copilot will generate excellent code here
}2. Use Copilot Chat for Explanations
Press Cmd+I (Mac) or Ctrl+I (Windows) to open Copilot Chat. Ask it to:
- Explain selected code
- Find bugs
- Suggest improvements
- Generate tests
3. Accept Partial Suggestions
You don't have to accept the entire suggestion. Use:
- Tab: Accept full suggestion
- Cmd+→: Accept word by word
- Cmd+]: Accept line by line
4. Provide Examples in Comments
Copilot learns from examples:
# Convert temperature
# Example: celsius_to_fahrenheit(0) -> 32
# Example: celsius_to_fahrenheit(100) -> 212
def celsius_to_fahrenheit(celsius):
# Copilot now understands exactly what you want5. Use Slash Commands in Chat
Copilot Chat supports powerful slash commands:
/explain: Explain selected code/fix: Fix problems in code/tests: Generate unit tests/doc: Add documentation/simplify: Simplify complex code
6. Create Custom Snippets
Train Copilot on your patterns by keeping example files:
// In a file called "patterns.ts" (don't import, just keep open)
// Copilot will learn these patterns
// Pattern: API endpoint with error handling
async function apiEndpoint(req, res) {
try {
const data = await service.getData();
res.json({ success: true, data });
} catch (error) {
res.status(500).json({ success: false, error: error.message });
}
}7. Use the @workspace Agent
In Copilot Chat, use @workspace to ask questions about your entire codebase:
- "@workspace where is authentication handled?"
- "@workspace how do we connect to the database?"
- "@workspace find all usages of UserService"
8. Generate Tests Automatically
Select a function and use /tests in chat:
/tests for the validateEmail functionCopilot will generate comprehensive test cases including edge cases.
9. Iterate with Follow-ups
Don't accept the first suggestion. Ask follow-up questions:
- "Generate the function"
- "Add error handling"
- "Make it async"
- "Add TypeScript types"
10. Use Keyboard Shortcuts
Master these shortcuts:
| Action | Mac | Windows |
|---|---|---|
| Show suggestions | Opt+\ | Alt+\ |
| Next suggestion | Opt+] | Alt+] |
| Previous suggestion | Opt+[ | Alt+[ |
| Accept suggestion | Tab | Tab |
| Dismiss | Esc | Esc |
| Open Chat | Cmd+I | Ctrl+I |
Bonus: Configure Copilot Settings
In VS Code settings, customize:
- Enable/disable for specific languages
- Adjust suggestion delay
- Configure inline suggestions
- Set up workspace-specific settings
Common Mistakes to Avoid
- Accepting without reading: Always review suggestions
- Not providing context: More context = better suggestions
- Ignoring Chat: Chat is often better than inline
- Not iterating: First suggestion isn't always best
- Forgetting security: Don't paste sensitive data
Conclusion
GitHub Copilot is more than autocomplete—it's a coding partner. These tips will help you collaborate more effectively with AI and write better code faster.

Milo
Milo covers AI coding tools and developer workflows for the Scout AI Team — the same agentic stack that builds and ships this site.