Welcome to the GitHub Copilot Refactoring Challenge! This exercise is designed to help you practice using GitHub Copilot's various features while improving code quality through refactoring.
This challenge consists of three increasingly difficult exercises that will help you master:
- GitHub Copilot inline suggestions
- GitHub Copilot Chat for code analysis and pattern suggestions
- Copilot Edits for bulk refactoring
Total time: ~20 minutes
- Challenge 1: 5-7 minutes
- Challenge 2: 6-8 minutes
- Challenge 3: 7-10 minutes
-
- Focus: Code clarity, TypeScript types, and SOLID principles
- Skills: Variable naming, type safety, function decomposition
-
- Focus: Design patterns and dependency injection
- Skills: SOLID principles, testing strategies, class decomposition
-
Advanced Pattern Implementation
- Focus: Security, modern patterns, and best practices
- Skills: Authentication patterns, security implementation, modern TypeScript
- Clone this repository
- Ensure you have the following VS Code extensions installed:
- GitHub Copilot
- GitHub Copilot Chat
- Run
npm installto set up dependencies - Start with Challenge 1 and progress through the challenges
- Use the verification tests to check your solutions
For each challenge:
- Start by asking Copilot Chat to analyze the code
- Use inline suggestions for implementation details
- Leverage Copilot Edits for bulk refactoring
- Verify your changes with the test suite
Each challenge includes its own test suite. To verify your solutions:
npm test # Run all tests
npm test challenge1 # Run specific challenge tests
npm run test:watch # Run tests in watch modeIf you get stuck:
- Ask Copilot Chat to explain the current code
- Request suggestions for specific patterns or implementations
- Use "Show Similar Examples" in Copilot Chat
- Check the hints section in each challenge
By completing these challenges, you'll learn:
- Modern TypeScript patterns and practices
- SOLID principles implementation
- Security best practices
- Test-driven development
- Clean code principles
Good luck!