Introduction
If you write code every day, you’ve likely already integrated GitHub Copilot into your workflow. But are you using it to its full potential? Most developers treat Copilot as a fancy autocomplete — they start typing and let the AI finish the line. That’s like using a chainsaw only to cut butter.
In this article, I’ve collected nine battle-tested prompts that I personally use in my daily workflow. They cover the full spectrum of development: from generating meaningful commit messages to thorough code reviews. Each prompt is accompanied by a real usage example, so you can copy, paste, and adapt them immediately.
1. Generate a Commit Message from Diff
Prompt:
Generate a concise, conventional commit message for the following diff. Use the format: type(scope): description. Types: feat, fix, refactor, docs, test, chore.
<diff>
Real usage: I paste the output of git diff --staged directly after the prompt. Copilot returns something like feat(auth): add OAuth2 refresh token rotation — no more staring at the terminal trying to craft the perfect message.
2. Explain a Complex Function
Prompt:
Explain the following function to a junior developer. Include the purpose, input parameters, edge cases, and potential performance bottlenecks.
<function code>
Real usage: When I inherit spaghetti code from a previous project, I drop the 50-line function into this prompt. Copilot returns a clear, structured explanation that saves me 20 minutes of manual analysis.
3. Generate Unit Tests for a Module
Prompt:
Generate unit tests for the following module using Jest. Cover all public functions, including edge cases (empty input, null values, invalid types). Use describe/it blocks.
<module code>
Real usage: I use this before committing to ensure I haven’t missed any test cases. Copilot produces test skeletons that I then adjust for specific business logic. It cuts test-writing time by about 60%.
4. Write Documentation for an API Endpoint
Prompt:
Write OpenAPI 3.0 documentation for this endpoint. Include request body schema, response codes, error examples, and authentication requirements.
<endpoint code>
Real usage: After finishing a new REST endpoint in our Express app, I copy the route handler code into the prompt. Copilot outputs a complete YAML snippet that I paste directly into our API docs repository.
5. Refactor This Code to Improve Readability
Prompt:
Refactor the following code to improve readability and maintainability. Apply DRY principle, extract magic numbers into constants, and add meaningful variable names. Show the refactored version and explain each change.
<old code>
Real usage: During a code review, I encountered a 200-line function that did everything from parsing to validation to logging. I ran it through this prompt. Copilot returned a clean version with three helper functions — the author accepted the change immediately.
6. Review a Pull Request for Security Issues
Prompt:
Review this pull request diff for security vulnerabilities. Check for SQL injection, XSS, insecure deserialization, hardcoded secrets, and improper access control. List each issue with severity (high/medium/low) and suggested fix.
<diff>
Real usage: Before merging any PR that touches authentication or input handling, I feed the diff into this prompt. Copilot once caught a hardcoded API key in a comment — something I would have missed in a manual review.
7. Generate a SQL Query from a Natural Language Description
Prompt:
Generate a PostgreSQL query that: [describe the requirement in plain English]. Use proper joins, indexes, and avoid N+1 queries.
Real usage: Recently I needed to find all users who made purchases in the last 30 days but haven’t logged in. I wrote: “Generate a PostgreSQL query that finds all users who placed at least one order in the last 30 days and whose last_login is older than 30 days.” Copilot produced a clean query with a LEFT JOIN and proper date filtering.
8. Create a Migration Script
Prompt:
Generate a TypeORM migration script that adds a new table 'notifications' with columns: id (UUID), user_id (FK to users), type (enum: email, push, sms), content (text), created_at (timestamp). Include up() and down() methods.
Real usage: I use this whenever I need to modify the database schema. Copilot generates the boilerplate migration, and I only need to verify the column types and constraints. It saves me from constantly checking TypeORM docs.
9. Summarise a Codebase Context for a New Developer
Prompt:
Given the following file structure and key files, write a 200-word summary of the project architecture. Include the main frameworks used, data flow, and where to find the entry point.
<file list and key code snippets>
Real usage: When onboarding a new team member, I dump the project’s main directories and some core files into this prompt. Copilot produces a concise architecture overview that I include in our onboarding docs. It saves hours of one-on-one explanation.
Why These Prompts Work
All of these prompts share three characteristics:
1. Clear context — they specify the role (junior developer, code reviewer), the output format (conventional commit, Jest tests, OpenAPI YAML), and the constraints (security, performance, edge cases).
2. Actionable request — they ask Copilot to produce something you can immediately use or review, not just think about.
3. Measurable scope — they target a single file, a single function, or a single PR diff. Broad prompts like “improve this entire project” produce vague results.
Conclusion
GitHub Copilot is not just an autocomplete tool — it’s a junior developer, a code reviewer, a documentation writer, and a SQL expert all rolled into one. The key is knowing how to ask. The nine prompts above cover the most common tasks in a developer’s daily workflow: committing, testing, documenting, reviewing, and onboarding.
Start by copying one prompt that solves your biggest pain point right now. For me, it was commit messages. After a week, add another. Within a month, you’ll wonder how you ever worked without them.
ASI Biont supports connection to services like GitHub, GitLab, and Bitbucket via API — learn more at asibiont.com/courses
Comments