Tutorials

How to Use GitHub Copilot Like a Senior Developer (Not a Beginner)

Most developers use GitHub Copilot completely wrong. They accept the first suggestion and wonder why the code is mediocre. Here's how senior developers actually use it.

S
Stackpulse Team
··...·5 min read
GitHub Copilot code suggestions appearing in VS Code editor

There's a version of GitHub Copilot that makes you slightly faster at typing.

And there's a version that genuinely transforms how you code — where you're shipping features in half the time without sacrificing quality.

Most developers are using the first version. Here's how to use the second.

The biggest mistake developers make

They treat it like autocomplete.

You start typing, a suggestion appears, you press Tab, you move on. This works for boilerplate. It fails for anything that actually matters.

The developers getting the most out of Copilot treat it more like a pair programmer — someone you give context to, discuss approaches with, and review code with afterward. Not just someone who finishes your sentences.

Write intentional comments before you code

This is the single biggest productivity unlock, and almost nobody does it consistently.

Before writing a function, write a comment describing exactly what it should do. Copilot reads your comments as context and generates far better code.

Weak approach:

// Get user data
function getUser(id) {
  // Copilot suggests something generic
}

Strong approach:

// Fetch a user by ID from the database.
// Returns the user object with their profile and subscription info.
// Throws UserNotFoundError if the ID doesn't exist.
// Uses caching with a 5-minute TTL to reduce database calls.
async function getUser(id: string): Promise<User> {
  // Now Copilot suggests something specific and useful
}

The more specific the comment, the better the suggestion. This takes an extra 30 seconds and saves 5 minutes of editing.

Use Copilot Chat for self code review

Copilot Chat is dramatically underused. Here's how senior developers use it:

Select your code, open Copilot Chat, and ask things like "What edge cases does this function not handle?" or "What would break this in production?" or "Review this like you're a security engineer."

This surfaces problems you'd miss in a solo review, in seconds.

When Copilot suggests code you don't fully understand, ask it to explain: "Why does this use a WeakMap instead of a regular Map?" or "What's the performance difference between these two approaches?" This is genuinely useful for learning while you ship.

Generate tests immediately

Here's a workflow that improves code quality fast:

Write the function signature and a comment explaining what it does. Let Copilot write the implementation. Immediately ask Copilot Chat: "Write comprehensive unit tests for this function. Cover edge cases, error cases, and happy path." Run the tests. If they fail, ask Copilot to fix the implementation.

This forces you to think about edge cases before shipping and is much faster than writing tests manually.

Use multi-line comments for complex logic

For complex functions, don't let Copilot guess. Lay out the algorithm in comments first:

async function processPayment(orderId: string, amount: number) {
  // 1. Validate the order exists and is in 'pending' status
  // 2. Check if the user has a saved payment method
  // 3. If yes, charge the saved method
  // 4. If no, return an error asking them to add a payment method
  // 5. If charge succeeds, update order status to 'paid'
  // 6. Send confirmation email
  // 7. If anything fails, log the error and return appropriate error code
}

Now Copilot has a blueprint. The suggestions will be dramatically better than if you just wrote the function name.

Use it for documentation

Nobody enjoys writing documentation. Copilot is genuinely good at it.

Select a function and ask in Copilot Chat: "Write JSDoc for this function" or "Write a README section explaining how to use this module" or "Add inline comments explaining the non-obvious parts."

The documentation it generates is usually 80–90% of the way there. Editing is faster than writing from scratch.

Know when NOT to accept suggestions

This is the most important skill and the hardest to teach.

Copilot is often wrong in subtle ways. Watch for security issues — it sometimes suggests code that's insecure. SQL queries that could be injected, authentication logic with subtle flaws, exposed sensitive data. Never accept security-sensitive code without careful review.

Also watch for hallucinated APIs. Copilot sometimes suggests methods or parameters that don't exist or have changed. Check the actual documentation for libraries you don't know well.

And watch for the wrong algorithm. Copilot optimises for code that looks right. For performance-critical code, verify the algorithmic complexity is actually what you need.

The rule: the more consequential the code, the more carefully you review the suggestion.

Keyboard shortcuts worth memorising

Tab — accept suggestion. Esc — dismiss. Alt+] and Alt+[ — cycle through alternative suggestions. This one is huge. There's often a much better suggestion on the second or third option. Ctrl+Enter — open a panel showing multiple suggestions at once. Ctrl+Shift+I — open Copilot Chat.

Alt+] is the most underused shortcut. When the first suggestion isn't quite right, there are usually 3–5 alternatives and the second one is frequently better.

The real productivity gain

Copilot doesn't make bad developers good. It makes good developers faster.

If you don't know what you want the code to do, Copilot can't save you. But if you have a clear mental model of the solution and you're good at giving it context — it genuinely cuts implementation time in half for many tasks.

The senior developers who use Copilot most effectively all share one habit: they think carefully before they type, and they review carefully after. The AI handles the middle part.

What's your biggest frustration with Copilot right now? Drop it in the comments.

Related Articles