Welcome to Module 03! This module dives deep into the art and science of effective prompting for GitHub Copilot. You'll learn how to optimize context, craft precise prompts, and use custom instructions to maximize AI assistance. Master these techniques to transform Copilot from a simple autocomplete tool into a powerful development partner.
- Total Time: 3 hours
- Lecture/Demo: 30 minutes
- Hands-on Exercises: 2 hours 30 minutes
- 🟢 Fundamentals Track (Modules 1-5)
By the end of this module, you will be able to:
-
Optimize Context for Better Suggestions
- Structure code for optimal AI understanding
- Manage context window effectively
- Use comments and documentation strategically
-
Craft Precise and Effective Prompts
- Write clear, specific instructions
- Use natural language effectively
- Iterate and refine prompts for better results
-
Implement Custom Instructions
- Configure Copilot settings for your workflow
- Create reusable prompt patterns
- Build project-specific instructions
-
Debug and Improve AI Suggestions
- Identify why suggestions might be suboptimal
- Adjust context to improve results
- Create feedback loops for continuous improvement
- ✅ Completed Module 01: Introduction to AI-Powered Development
- ✅ Completed Module 02: GitHub Copilot Core Features
- ✅ Basic programming knowledge in Python
- ✅ GitHub Copilot installed and configured
- ✅ Understanding of basic Copilot features
See prerequisites.md for detailed setup instructions.
The context window is the amount of code and information Copilot considers when generating suggestions. Understanding how to manage it is crucial:
- Local Context: The immediate code around your cursor
- File Context: The entire file you're working in
- Workspace Context: Related files in your project
- Custom Context: Additional information you provide
Effective prompts follow these principles:
- Clarity: Be specific about what you want
- Context: Provide necessary background information
- Constraints: Specify requirements and limitations
- Examples: Show desired input/output patterns
- Iteration: Refine based on results
GitHub Copilot allows customization through:
- Comments: Strategic placement of guiding comments
- Documentation: Well-structured docstrings and READMEs
- Patterns: Consistent coding patterns in your project
- Configuration: VS Code settings and workspace configuration
module-03-effective-prompting/
├── README.md # This file
├── prerequisites.md # Setup requirements
├── exercises/
│ ├── exercise1-easy/ # Context Optimization Workshop
│ ├── exercise2-medium/ # Prompt Pattern Library
│ └── exercise3-hard/ # Custom Instruction System
├── best-practices.md # Production patterns
├── resources/
│ ├── prompt-templates/ # Reusable prompt patterns
│ ├── context-examples/ # Context optimization examples
│ └── cheat-sheet.md # Quick reference guide
├── troubleshooting.md # Common issues and solutions
└── project/ # Independent project
└── README.md
- Duration: 30-45 minutes
- Goal: Master context window management
- Skills: Code organization, strategic comments, context control
- Duration: 45-60 minutes
- Goal: Build a library of effective prompt patterns
- Skills: Pattern recognition, template creation, reusability
- Duration: 60-90 minutes
- Goal: Create a complete custom instruction framework
- Skills: Advanced configuration, project templates, automation
graph LR
A[Basic Prompts] --> B[Context Optimization]
B --> C[Prompt Patterns]
C --> D[Custom Instructions]
D --> E[Advanced Techniques]
E --> F[Production Workflows]
style A fill:#f9f,stroke:#333,stroke-width:2px
style F fill:#9f9,stroke:#333,stroke-width:2px
- Context window manipulation
- Multi-file context awareness
- Custom instruction processing
- Pattern recognition and learning
- Prompt chaining
- Context injection
- Template-based generation
- Iterative refinement
After completing this module, you'll be able to:
-
Accelerate Development
- Generate complex code structures quickly
- Create consistent implementations
- Reduce boilerplate writing time
-
Improve Code Quality
- Generate better documentation
- Maintain consistent patterns
- Catch edge cases early
-
Team Productivity
- Share effective prompts
- Standardize AI usage
- Create team knowledge bases
-
Set up your environment:
cd modules/module-03-effective-prompting ./scripts/setup-module03.sh -
Open the first exercise:
cd exercises/exercise1-easy code .
-
Follow the exercise instructions:
- Read the README in each exercise folder
- Complete the hands-on activities
- Run the validation scripts
- Context window visualization
- Real-time prompt refinement
- Custom instruction examples
- Common pitfalls and solutions
- Balancing context vs. performance
- Ethical considerations in prompt engineering
- Team standardization strategies
- Future of AI-assisted development
You'll know you've mastered this module when you can:
- Control Copilot's context window effectively
- Write prompts that generate correct code 80%+ of the time
- Create reusable prompt patterns
- Configure custom instructions for projects
- Debug and improve suboptimal suggestions
- Module Issues: See troubleshooting.md
- Questions: Post in GitHub Discussions
- Emergency: Tag @module-03-support in Slack
After mastering prompting techniques:
- Module 04: AI-Assisted Debugging and Testing
- Apply prompting skills to testing
- Learn test generation patterns
- Master debugging with AI
To complete this module:
- ✅ Complete all three exercises
- ✅ Pass the validation scripts
- ✅ Submit the independent project
- ✅ Score 80%+ on the module quiz
🎉 Ready to become a prompting expert? Let's dive into Exercise 1!