Module 5

GitHub Copilot & Coding Assistants

AI coding assistants like GitHub Copilot, Cursor, and Codeium are changing how developers write code. Here's how they work, how to set them up, and when to trust them.

The intern who shipped in three days

Priya joined a startup as a junior developer. Her first task: build an API integration with Stripe to handle subscription billing. She'd never worked with Stripe before. Without AI tools, this would mean two weeks of reading documentation, writing boilerplate, debugging edge cases, and asking senior developers for code reviews.

Instead, Priya opened Cursor (an AI-powered code editor). She typed a comment: // Create a Stripe checkout session for a monthly subscription plan. Cursor generated 30 lines of working code — the correct API call, error handling, and response formatting. She reviewed it, adjusted the plan IDs, and tested. It worked.

Over three days, she built the entire billing system: checkout, webhooks, subscription management, and invoice retrieval. Her tech lead reviewed the code and found it cleaner than what most mid-level developers would write. Not because Priya was a prodigy — because she knew how to guide an AI coding assistant and verify its output.

By the end of this module, you'll understand how AI coding assistants work under the hood, know the key differences between Copilot, Cursor, and Codeium, and be able to spot bugs in AI-generated code.

55%faster task completion reported by GitHub for Copilot users (GitHub 2022 study — based on a controlled experiment with ~100 developers; results may vary in practice)

77%of developers have used AI coding tools (Stack Overflow 2024 Developer Survey — based on ~65,000 respondents)

46%of new code on GitHub is AI-generated (GitHub CEO statement, 2024 — refers to code where Copilot suggestions were accepted; verify with current GitHub data)

How AI coding assistants actually work

AI coding assistants are large language models trained specifically on code. They read what you've written so far — your file, your project, your comments — and predict what comes next. Think of them as autocomplete on steroids: instead of suggesting the next word, they suggest the next 5-50 lines.

They work at three levels:

  1. Line completions — finish the current line as you type
  2. Multi-line suggestions — generate entire functions or blocks from a comment or function signature
  3. Chat/agent mode — have a conversation about your code, ask for refactoring, debugging, or explanations

The tools compared

ToolTypeBest forCostWorks with
GitHub CopilotIDE extensionInline suggestions, chat in VS Code$10/mo (Individual), $19/mo (Business)VS Code, JetBrains, Neovim
CursorFull IDE (VS Code fork)Deep codebase understanding, multi-file editsFree tier / $20/mo (Pro)Standalone editor
Codeium (Windsurf)IDE extension + editorFree alternative to CopilotFree tier / $10/mo (Pro)VS Code, JetBrains, many editors
Replit AIBuilt into ReplitBeginners, quick prototypingFree tier / $25/mo (Replit Core)Replit (browser-based)
Amazon CodeWhispererIDE extensionAWS-heavy codebasesFree (Individual) / included with AWSVS Code, JetBrains

GitHub Copilot

  • Works inside your existing VS Code setup
  • Best for inline completions while typing
  • Copilot Chat for Q&A about code
  • $10/mo Individual plan
  • Most widely adopted, huge community
  • GitHub integration built in

Cursor

  • Full IDE — replaces VS Code
  • Best for multi-file, codebase-wide edits
  • Composer mode for complex changes
  • $20/mo Pro plan
  • Smaller community but growing fast
  • Can index your entire codebase for context

There Are No Dumb Questions

"Do I need to be a programmer to use these tools?"

Yes and no. These tools accelerate existing developers — they don't replace the need to understand code. You still need to read, review, and debug what the AI generates. However, non-programmers can use tools like Replit AI or Cursor to build simple projects with heavy AI assistance. Think of it as the difference between driving a car and being a mechanic.

"Will AI replace software developers?"

No — but it's changing the job. Developers who use AI tools write code 30-55% faster (depending on the task and study). The work is shifting from "typing code" to "designing systems, reviewing AI output, and handling the hard problems AI can't solve." Junior developers who learn AI tools have an advantage over seniors who refuse them.

Setting up GitHub Copilot (5 minutes)

Step 1: Go to github.com/features/copilot and start a free trial or subscribe

Step 2: Open VS Code and install the "GitHub Copilot" extension from the marketplace

Step 3: Sign in with your GitHub account when prompted

Step 4: Open any code file and start typing — ghost text suggestions will appear automatically

Step 5: Press Tab to accept a suggestion, Esc to dismiss, or Alt+] to see alternative suggestions

What these tools are actually good at

Not all coding tasks benefit equally from AI assistance.

Where AI coding assistants excel:

  • Writing boilerplate (CRUD operations, API routes, database queries)
  • Generating unit tests from existing code
  • Writing documentation and comments
  • Regular expressions and complex formulas
  • Translating code between languages
  • Implementing well-known patterns (auth flows, pagination, form validation)

Where they struggle:

  • Novel algorithm design
  • System architecture decisions
  • Understanding complex business logic unique to your company
  • Security-critical code that needs careful review
  • Performance optimization for specific hardware
  • Code that requires deep domain expertise (medical, financial, scientific)

🔒

Match the task to AI suitability

25 XP

Match 6 items to their pairs.

Sign in to earn XP

Prompting techniques for coding assistants

1. Comment-driven development

This is the coding equivalent of the structured prompting from the Claude module — specificity in, quality out. Write a detailed comment, then let the AI generate the code.

python
# Function that takes a list of transactions and returns:
# - Total revenue (sum of amounts where type is "sale")
# - Total refunds (sum of amounts where type is "refund")
# - Net revenue (total - refunds)
# - Average transaction value
# Returns a dictionary with these four keys

The AI will generate the complete function matching your specification.

2. Provide examples in context

If you want code in a specific style, write one example first. The AI will follow the pattern.

javascript
// Example: GET /api/users - Returns all users
app.get('/api/users', async (req, res) => {
  const users = await db.users.findMany();
  res.json({ data: users });
});

// GET /api/products - Returns all products
// (AI generates this following the pattern above)

3. Use chat mode for complex tasks

Instead of inline completions, open the chat panel and describe what you need:

"Refactor this authentication middleware to:
1. Check for both JWT and API key auth
2. Return 401 with a specific error message for each failure case
3. Add rate limiting of 100 requests per minute per user
4. Log all auth failures to the audit table"
🔑The real productivity pattern
The developers getting the most from AI tools don't use them to write code from scratch. They use them to accelerate the boring parts — boilerplate, tests, documentation — so they can spend more time on the interesting parts: architecture, debugging tricky issues, and code review.

When NOT to trust AI-generated code

⚠️Always review
AI coding assistants confidently generate code that looks correct but has subtle bugs. These are the highest-risk areas:
  • Security — AI may generate code with SQL injection, XSS, or authentication vulnerabilities
  • Edge cases — AI handles the happy path but may miss null checks, empty arrays, or race conditions
  • Outdated APIs — AI may use deprecated functions or old library versions from its training data
  • License compliance — AI may reproduce patterns from copyleft-licensed code
  • Off-by-one errors — Classic in loops, pagination, and array slicing

Never push AI-generated code to production without review and testing.

🔒

Spot the bugs

50 XP

Here is AI-generated Python code. Identify at least 2 problems: ```python def get_user_discount(user): if user.membership == "premium": return user.cart_total * 0.20 if user.membership == "standard": return user.cart_total * 0.10 # Apply loyalty bonus if user.years_active > 5: return user.cart_total * 0.05 ``` Think about: What happens if a premium member has been active for 6 years? What happens if membership is None? What if cart_total is negative? Write the corrected version that handles these edge cases.

Sign in to earn XP

There Are No Dumb Questions

"Is GitHub Copilot worth $10/month?"

If you write code for at least a few hours per week, almost certainly yes. GitHub's own study found developers completed tasks 55% faster. Even a 20% speed increase on 10 hours of weekly coding saves you 2 hours — worth far more than $10. Start with the free trial and measure your own experience.

"Should I use Copilot or Cursor?"

If you want AI assistance inside your existing VS Code setup with minimal disruption: Copilot. If you want deeper codebase understanding and multi-file editing capabilities: Cursor. Many developers use both — Copilot for inline completions and Cursor for larger refactoring tasks.

Real productivity data

What do developers actually report after using AI coding tools for months?

MetricWithout AIWith AISource
Time to complete coding tasksBaseline30-55% fasterGitHub 2022 controlled study (~100 developers)
Lines of code accepted from AI0%~30% of total codeGitHub internal data (2024 — varies by language and project)
Time spent on boilerplate~40% of coding time~10%Developer surveys (anecdotal — no single authoritative study)
Code review pass rateVariesSimilar to human-written codeGoogle internal study on AI-assisted code (2023)
🔑The real metric
The best measure of AI coding tool value isn't lines of code generated — it's cognitive load reduced. When AI handles the predictable parts, developers have more mental energy for the creative, complex parts. That's the real productivity gain.

Back to Priya's first week

Remember Priya, the junior developer who shipped a full Stripe billing system in three days? Her secret wasn't that the AI wrote perfect code. It didn't — she caught a missing null check in the webhook handler and added rate limiting the AI forgot. Her secret was workflow: comment-driven development to generate the scaffolding, careful review to catch edge cases, and the confidence to trust the AI on boilerplate while applying her own judgment on the tricky parts. Three days instead of two weeks. That's what happens when you treat AI as a pair programmer, not a replacement.

Key takeaways

  • AI coding assistants (Copilot, Cursor, Codeium) predict and generate code from your context — like autocomplete for entire functions
  • They excel at boilerplate, tests, documentation, and well-known patterns — they struggle with architecture, novel algorithms, and security-critical code
  • GitHub Copilot is the most widely adopted ($10/mo); Cursor offers deeper codebase understanding ($20/mo); Codeium is a strong free alternative
  • Comment-driven development is the most effective technique: write a detailed comment, let AI generate the code
  • Always review AI-generated code for security vulnerabilities, edge cases, and outdated APIs
  • The real productivity gain is not speed — it's reduced cognitive load on routine tasks

Next up: not everyone writes code, but everyone makes presentations. The next module covers AI tools that can generate an entire slide deck from your raw notes in minutes.

?

Knowledge Check

1.What is the primary way AI coding assistants generate code suggestions?

2.Which type of coding task benefits LEAST from AI coding assistants?

3.What is 'comment-driven development' in the context of AI coding assistants?

4.What is the most important risk when using AI-generated code in production?

Want to go deeper?

🧠 AI & Machine Learning Master Class

Understand AI, use it in your job, and build AI-powered products.

View the full program