Using AI Coding Assistants (GitHub Copilot, Cursor)
Explains how AI coding assistants like GitHub Copilot and Cursor work, their key features, and how effective prompt engineering plus a 'vibe coding' flow lets you focus on the what and why rather than the how.
{"contentFormat":"slides.v1","completion":{"requireAllSlides":true,"requireQuiz":true},"slides":[{"kind":"title","eyebrow":"Module 6: Coding for AI + Vibe Coding","title":"Using AI Coding Assistants (GitHub Copilot, Cursor)","body":"Explore how AI coding assistants transform software development. Learn to integrate Copilot and Cursor into your workflow, apply prompt engineering for code, and avoid common pitfalls. This lesson covers practical techniques, real-world examples, and security considerations for 2026.","outcomes":["Explain how AI coding assistants work and their key features","Use prompt engineering techniques to generate accurate code","Identify and mitigate risks like insecure or incorrect code","Compare GitHub Copilot, Cursor, and alternatives like Amazon CodeWhisperer and Tabnine"],"narration":"Welcome to Module 6. In this lesson, we'll dive into AI coding assistants like GitHub Copilot and Cursor. You'll learn how to use them effectively, write better prompts, and stay safe by verifying AI-generated code. Let's get started."},{"kind":"content","heading":"How AI Coding Assistants Work","body":"AI coding assistants are powered by large language models (LLMs) trained on billions of lines of code from public repositories. They predict the next tokens in your code based on context—your comments, function names, and surrounding code. Think of them as an always-available pair programmer.\n\nKey capabilities:\n- Code completion: Suggests the next line or block as you type.\n- Code generation: Creates entire functions or classes from a comment.\n- Refactoring: Proposes improvements to existing code.\n- Explanation: Answers questions about code in natural language.\n\nAs of 2026, models like GPT-4o and Claude are commonly used. Always verify the specific model version in your tool's documentation.","callout":{"variant":"note","title":"Context is King","text":"The more relevant context you provide (open files, imports, comments), the better the assistant's suggestions. Close unused tabs to avoid confusion."},"narration":"AI coding assistants use LLMs trained on code. They predict what you want to write next based on your current context. To get the best results, keep your workspace clean and provide clear comments."},{"kind":"content","heading":"Popular Tools: Copilot, Cursor, and Alternatives","body":"While GitHub Copilot and Cursor are widely used, other tools also offer strong capabilities. Here's a comparison:","callout":{"variant":"tip","title":"Try Multiple Tools","text":"Each tool has strengths. For example, CodeWhisperer excels at AWS-related code, while Tabnine offers on-device models for sensitive projects."},"table":{"headers":["Tool","Integration","Key Strength","Pricing Model"],"rows":[["GitHub Copilot","VS Code, JetBrains, Neovim","Inline completions, deep IDE integration","Subscription (free for students)"],["Cursor","Standalone IDE (VS Code fork)","AI-native chat, project-wide refactoring","Subscription with free tier"],["Amazon CodeWhisperer","VS Code, JetBrains, AWS Cloud9","AWS service integration, security scanning","Free for individual developers"],["Tabnine","VS Code, JetBrains, Eclipse","Local model option, privacy-focused","Freemium with paid tiers"]]},"narration":"Besides Copilot and Cursor, consider Amazon CodeWhisperer and Tabnine. Each has unique features—CodeWhisperer is great for AWS, Tabnine offers local models. Experiment to find what fits your workflow."},{"kind":"content","heading":"Prompt Engineering for Code","body":"Effective prompts are essential for getting useful code from AI assistants. Follow these techniques:\n\n1. Be specific and descriptive\n- Bad: # function to sort\n- Good: # function to sort a list of integers in descending order using quicksort\n\n2. Provide context\n- Include relevant imports, types, and existing code.\n- Example: # using pandas, load a CSV and return the mean of column 'sales'\n\n3. Specify output format\n- # return a JSON object with keys 'name' and 'age'\n\n4. Break down complex tasks\n- Instead of one large prompt, write smaller comments for each step.\n\n5. Use examples\n- Show input/output pairs: # input: [1,2,3] -> output: 6","callout":{"variant":"exercise","title":"Try It Yourself","text":"Open your editor and write a comment: # function to download an image from a URL and save it to disk. See what the assistant generates. Then refine the prompt to add error handling."},"narration":"Prompt engineering for code is similar to text prompts. Be specific, provide context, and specify the output format. Break down complex tasks and use examples. This dramatically improves the quality of generated code."},{"kind":"content","heading":"Real-World Examples and Pitfalls","body":"AI assistants can accelerate many tasks, but they also introduce risks. Here are common use cases and warnings:\n\nExamples:\n- Generating unit tests: Write # generate pytest tests for this function to get a test suite.\n- Implementing algorithms: # implement binary search in Python yields a working function.\n- API integration: # call the GitHub API to list repos for user 'octocat' produces requests code.\n- Refactoring: Select a function and ask # simplify this function.\n\nPitfalls to avoid:\n- Insecure code: AI may suggest code with SQL injection, hardcoded secrets, or unsafe deserialization. Always review for security.\n- Incorrect logic: The assistant can produce plausible-looking but wrong code. Test thoroughly.\n- Over-reliance: Blindly accepting suggestions reduces your understanding. Use the AI as a tool, not a crutch.\n- License issues: Generated code may resemble copyrighted code. Use in-house policies or tools like Copilot's duplication detection.","callout":{"variant":"warning","title":"Always Verify AI-Generated Code","text":"Treat AI suggestions as a first draft. Review for security, correctness, and performance. Run tests and use static analysis tools."},"narration":"AI assistants can generate tests, algorithms, and API calls quickly. But beware: they can also produce insecure or incorrect code. Always review, test, and avoid over-reliance. Security is your responsibility."},{"kind":"quiz","heading":"Check Your Understanding","questions":[{"question":"Which of the following is a recommended prompt engineering technique for coding?","options":["Use vague comments to let the AI be creative","Provide specific context and desired output format","Avoid breaking down complex tasks","Write prompts in all caps for emphasis"],"questionId":"cmrf73k9m0024pd27jxxlk7bi"},{"question":"What is a key risk of using AI coding assistants?","options":["They always produce correct code","They may generate insecure or incorrect code","They cannot handle API integrations","They only work with Python"],"questionId":"cmrf73k9m0025pd271jgs6hb6"},{"question":"Which of the following is NOT a popular AI coding assistant as of 2026?","options":["GitHub Copilot","Amazon CodeWhisperer","Microsoft Word","Cursor"],"questionId":"cmrf73k9m0026pd270s3y78wl"}],"quizId":"qz_cmk7lkoqv002dg4p8ug2ads2u"},{"kind":"summary","heading":"Key Takeaways","takeaways":["AI coding assistants like Copilot, Cursor, CodeWhisperer, and Tabnine boost productivity by generating code from context.","Effective prompt engineering—being specific, providing context, and specifying output—improves code quality.","Always verify AI-generated code for security, correctness, and license compliance.","Use AI as a collaborative partner, not a replacement for your own understanding.","Explore multiple tools to find the best fit for your workflow and project needs."],"narration":"To wrap up: AI coding assistants are powerful when used wisely. Master prompt engineering, always verify output, and treat the AI as a partner. Experiment with different tools to find what works for you. Thanks for watching!"}]}