Duration: 60 minutes (20 min demo + 40 min hands-on)
Format: Demo + Hands-on
By the end of this module, you will be able to:
- Receive and accept inline code suggestions using Tab, partial accept, and next edit suggestions
- Write effective comment-driven prompts that produce accurate code completions
- Navigate alternative suggestions and understand when to accept, modify, or reject them
- Apply Copilot code suggestions to real enterprise tasks: CRUD operations, data transformations, and boilerplate reduction
- Use GitHub Copilot on GitHub.com to generate pull request summaries and request AI-powered code reviews
- Assign issues to the Copilot Coding Agent and review its autonomously generated pull requests
GitHub Copilot provides autocomplete-style code suggestions as you type. Suggestions appear as grayed-out "ghost text" in your editor.
Copilot generates suggestions from:
- Code context: The code already in your file and open tabs
- Comments: Natural language descriptions of what you want to build
- Function signatures: Method names and parameter types hint at intended behavior
| Action | macOS | Windows/Linux |
|---|---|---|
| Accept full suggestion | Tab |
Tab |
| Accept next word | ⌘ → |
Ctrl → |
| Accept next line | Custom keybind | Custom keybind |
| Next suggestion | ⌥ ] |
Alt ] |
| Previous suggestion | ⌥ [ |
Alt [ |
| Show all suggestions in panel | Ctrl Enter |
Ctrl Enter |
| Dismiss suggestion | Esc |
Esc |
Copilot can predict where your next edit will be and suggest a completion for it. Look for the arrow indicator in the gutter - press Tab to navigate to it, then Tab again to accept the suggestion.
Writing descriptive comments before code is one of the most effective ways to get high-quality suggestions.
// Calculate the number of business days between two dates
// excluding weekends (Saturday and Sunday) and an optional
// array of holiday dates
function calculateBusinessDays(startDate, endDate, holidays = []) {
// Copilot will suggest the implementation here
}/**
* Calculates the number of business days between two dates,
* excluding weekends (Saturday and Sunday) and an optional
* list of holiday dates.
*
* @param startDate the start date (inclusive)
* @param endDate the end date (inclusive)
* @param holidays list of holiday dates to exclude
* @return the number of business days
*/
public static long calculateBusinessDays(LocalDate startDate, LocalDate endDate, List<LocalDate> holidays) {
// Copilot will suggest the implementation here
}| Tip | Example |
|---|---|
| Be specific about inputs/outputs | // Parse a CSV string into a list of Employee objects with name, department, and salary fields |
| Mention edge cases | // Handle null inputs by returning an empty list |
| Reference enterprise patterns | // Use the repository pattern to fetch orders from the database |
| Specify error handling | // Throw IllegalArgumentException if the date range is invalid |
// Convert a UserEntity JPA entity to a UserDTO
// Map all fields including nested Address entity to AddressDTO
// Null-safe: return null if entity is null
public static UserDTO toDTO(UserEntity entity) {
// Copilot suggests the full mapping
}// Create a standardized API response envelope
// with status, data, message, and timestamp fields
// following the enterprise API response format
function createApiResponse(status, data, message) {
// Copilot suggests the response structure
}Copilot is not limited to your local editor. On GitHub.com, Copilot is embedded across pull requests, issues, search, and the dashboard — no editor required.
When you open a pull request, click the Copilot icon in the PR description field to generate an automatic summary. Copilot analyzes the diff and produces:
- An overview of what changed and why
- A file-by-file breakdown describing each change
- Review guidance highlighting what a reviewer should focus on
Request a review from Copilot just like you would from a human reviewer:
- Open a pull request
- In the Reviewers section, add Copilot as a reviewer
- Copilot posts inline comments with findings and code suggestions
Copilot code review uses the rules in .github/copilot-instructions.md to check against your team's coding standards. If this file does not exist, Copilot applies its own general best-practice guidelines.
| Review Category | What Copilot Checks |
|---|---|
| Security | Injection risks, credential exposure, OWASP Top 10 |
| Code quality | Duplicate code, missing error handling, complexity |
| Standards | Team-defined rules from custom instructions |
| Performance | N+1 queries, missing caching, unnecessary allocations |
The Copilot coding agent lets you assign a GitHub issue to Copilot and have it autonomously implement the fix or feature:
- Assign an issue to Copilot — Copilot creates a branch and starts working
- Copilot opens a pull request — Review the proposed changes as you would any PR
- Iterate via PR comments — Leave feedback; Copilot revises and pushes updates
Enterprise note: The coding agent respects
.github/copilot-instructions.mdand runs CI/CD pipelines to validate its own changes.
Open exercises/orderService.js and use Copilot to complete the functions.
Goals:
- Let Copilot generate implementations from the comments
- Practice accepting, rejecting, and navigating between suggestions
- Use partial accept (
⌘ →) to take a suggestion word by word
Open exercises/OrderService.java and use Copilot to complete the methods.
Goals:
- Use Copilot to implement enterprise patterns like validation, filtering, and aggregation
- Observe how Copilot uses Java type information to provide better suggestions
- Practice showing alternative suggestions with
⌥ ]/⌥ [
Open a new file and write the following comment, then let Copilot generate the code:
JavaScript:
// Express.js REST controller for a Product resource
// with CRUD endpoints: GET all, GET by id, POST, PUT, DELETE
// Include input validation and error handling middleware
// Use async/await patternJava:
/**
* Spring Boot REST controller for a Product resource.
* CRUD endpoints: GET all, GET by id, POST, PUT, DELETE.
* Include request validation with @Valid annotation.
* Use ResponseEntity for proper HTTP status codes.
*/- Create a new branch in this repository and make a small, meaningful code change (e.g., add a utility method to
exercises/orderService.jsor add input validation toexercises/OrderService.java) - Push the branch and open a pull request on GitHub.com
- In the PR description field, click the Copilot icon (or the "Generate summary" button)
- Review the generated summary:
- Does the "what changed" section accurately reflect your change?
- Would a reviewer find this summary useful?
- Edit the summary to add any context Copilot missed
- On the same pull request, go to the Reviewers section on the right sidebar
- Add Copilot as a reviewer
- Wait for Copilot to analyze the PR and post review comments
- Review Copilot's feedback:
- Are the suggestions relevant to your change?
- Did it flag anything against the standards in
.github/copilot-instructions.md? - How does it compare to what a human reviewer would say?
- Navigate to the Issues tab of the repository
- Open or create a small, well-described issue (e.g., "Add input validation to orderService.js")
- In the Assignees section, assign the issue to Copilot
- Watch Copilot create a branch and open a pull request
- Review the pull request and leave a comment to request a change; observe how Copilot revises
- Copilot is a pair programmer, not autopilot: Always review suggestions before accepting
- Better context = better suggestions: Descriptive comments, type hints, and existing code all improve completion quality
- Partial acceptance is powerful: Use
⌘ →to accept word-by-word when a suggestion is mostly right - Next Edit Suggestions save navigation time: Let Copilot predict where you need to edit next
- Enterprise patterns are well-supported: DTOs, repository patterns, API envelopes, and validation logic all generate reliably
- Copilot extends beyond the IDE: PR summaries, AI code review, and the coding agent work directly on GitHub.com — no editor required
- The coding agent is an autonomous team member: Assign an issue to Copilot and it will create a branch, implement the change, and open a PR for your review