Best Practices & Productivity Tips
1. Course Recap
Những gì bạn đã học
Skills Acquired
| Skill | Bài học |
|---|---|
| Copilot Autocomplete | Bài 3 |
| Prompt Engineering | Bài 4 |
| Copilot Chat | Bài 5 |
| Agent Mode | Bài 6 |
| Code Review | Bài 7 |
| Refactoring | Bài 8 |
| Testing | Bài 9 |
| Full-stack Development | Bài 10-11 |
2. The Vibe Coding Mindset
Từ "Viết Code" sang "Điều khiển AI"
Mindset Shift
Coding Approach
Traditional Coding
Type every character
Search documentation
Debug by print/log
Write tests manually
Vibe Coding
Describe what you want
Ask Copilot directly
Debug with Chat
Generate tests with /tests
Core Principles
markdown
11. **Describe Intent, Not Implementation**2 - Good: "Add user authentication with JWT"3 - Bad: "Write a function that takes username..."4 52. **Think in Components/Functions**6 - Break down into small pieces7 - Let Copilot implement each piece8 93. **Review, Don't Trust Blindly**10 - Always review generated code11 - Test before committing12 134. **Iterate Rapidly**14 - Quick feedback loops15 - "Make it work, make it right, make it fast"3. Productivity Best Practices
3.1 Keyboard Shortcut Mastery
| Shortcut | Action | Frequency |
|---|---|---|
Tab | Accept suggestion | ⭐⭐⭐⭐⭐ |
Esc | Dismiss suggestion | ⭐⭐⭐⭐ |
Ctrl+Enter | Show alternatives | ⭐⭐⭐ |
Ctrl+I | Inline chat | ⭐⭐⭐⭐⭐ |
Ctrl+Alt+I | Chat panel | ⭐⭐⭐⭐ |
Ctrl+Shift+I | Agent mode | ⭐⭐⭐ |
3.2 File Naming for Better Suggestions
Bash
1# Good - Copilot understands context2user_service.py # Service for users3auth_middleware.js # Authentication middleware4product_api_test.py # Tests for product API5 6# Less clear7helpers.py8utils.js9test_stuff.py3.3 Comment-Driven Development
Python
1# Step 1: Write clear comment describing what you need2# Implement a rate limiter using sliding window algorithm3# - Max 100 requests per minute per IP4# - Use Redis for storage5# - Return 429 status when limit exceeded67# Step 2: Let Copilot generate8# Step 3: Review and refine4. Prompt Templates Library
4.1 Feature Implementation
markdown
1**Template:**2Implement [FEATURE_NAME] for [CONTEXT]:3- Requirements: [LIST]4- Input: [DESCRIPTION]5- Output: [DESCRIPTION]6- Edge cases: [LIST]7- Error handling: [EXPECTATIONS]8 9**Example:**10Implement user registration for a Flask app:11- Requirements: email, password, name fields12- Input: JSON body with user data13- Output: Created user object with JWT token14- Edge cases: duplicate email, invalid format15- Error handling: Return 400 with specific messages4.2 Bug Fix
markdown
1**Template:**2Fix the bug in [FILE/FUNCTION]:3- Current behavior: [WHAT_HAPPENS]4- Expected behavior: [WHAT_SHOULD_HAPPEN]5- Steps to reproduce: [STEPS]6- Error message: [IF_ANY]7 8**Example:**9Fix the bug in calculateTotal():10- Current behavior: Returns NaN for empty cart11- Expected behavior: Return 0 for empty cart12- Steps: Create cart, don't add items, call calculateTotal()4.3 Code Review
markdown
1**Template:**2Review this code for:31. Security vulnerabilities42. Performance issues53. Best practices violations64. Edge cases not handled7 8Format response as:9🔴 Critical: [MUST FIX]10🟡 Warning: [SHOULD FIX]11🟢 Suggestion: [NICE TO HAVE]4.4 Refactoring
markdown
1**Template:**2Refactor [CODE] to:3- Apply [PATTERN/PRINCIPLE]4- Improve [ASPECT: readability/performance/testability]5- Maintain backward compatibility: [YES/NO]6- Add tests: [YES/NO]4.5 Testing
markdown
1**Template:**2Generate tests for [FUNCTION/CLASS]:3- Test framework: [pytest/jest/etc]4- Coverage: [unit/integration/e2e]5- Include: happy path, edge cases, error cases6- Mock: [LIST_DEPENDENCIES]5. Common Anti-Patterns
❌ DON'T
Python
1# 1. Vague prompts2"Make this better"3"Fix the bug"4"Add feature"56# 2. Accepting without review7# Just press Tab on everything89# 3. Overcomplicating prompts10"Write a function that implements the observer pattern11with dependency injection using a factory method12that also handles async operations with proper13error boundaries and retry logic with exponential14backoff and circuit breaker pattern..."1516# 4. Ignoring context17# Not using @workspace when needed18# Not providing relevant files1920# 5. Fighting Copilot21# Manually editing when regenerating would be faster✅ DO
Python
1# 1. Specific prompts2"Add email validation using regex, return boolean"3"Fix NullPointerException on line 45"4"Add pagination to GET /users endpoint"56# 2. Review before accepting7# Read the code, understand it, test it89# 3. Break down complex requests10"First, create the data model"11"Next, add the API endpoint"12"Finally, write the tests"1314# 4. Leverage context15"@workspace how does auth work in this project?"1617# 5. Iterate with Copilot18"Good, but also add input validation"19"Make this async"20"Add error handling"6. Language-Specific Tips
Python
Python
1# Use type hints - better suggestions2def process_order(order: Order, user: User) -> Receipt:3 # Copilot understands types4 5# Use docstrings6def calculate_tax(amount: float, rate: float) -> float:7 """8 Calculate tax amount.9 10 Args:11 amount: Base amount12 rate: Tax rate (0.1 = 10%)13 14 Returns:15 Tax amount16 """17 # Copilot generates implementationJavaScript/TypeScript
TypeScript
1// TypeScript interfaces help Copilot2interface User {3 id: string;4 name: string;5 email: string;6 role: 'admin' | 'user';7}89// JSDoc for JavaScript10/**11 * @param {string} userId12 * @returns {Promise<User>}13 */14async function getUser(userId) {15 // Better suggestions16}React
tsx
1// Props interface = better component suggestions2interface ButtonProps {3 variant: 'primary' | 'secondary';4 size: 'sm' | 'md' | 'lg';5 onClick: () => void;6 children: React.ReactNode;7}89// Component with clear props10function Button({ variant, size, onClick, children }: ButtonProps) {11 // Copilot knows what to generate12}7. Team Workflows
7.1 Code Review với Copilot
markdown
1## PR Review Checklist with Copilot2 3### Before Reviewing41. Read PR description52. Understand the feature/fix6 7### Review Process81. Use `/explain` on complex changes92. Ask about potential issues103. Request security review114. Check test coverage12 13### Feedback Format14- Use Copilot to suggest improvements15- Reference docs/patterns when needed7.2 Pair Programming
markdown
1## Copilot as Pair Partner2 3Driver (You):4- Define what to build5- Review suggestions6- Make decisions7 8Navigator (Copilot):9- Generate code10- Suggest alternatives11- Explain approaches7.3 Onboarding New Members
markdown
1## Using Copilot for Onboarding2 31. **Understanding Codebase**4 @workspace explain the architecture of this project5 62. **Finding Examples**7 @workspace show me examples of API endpoints8 93. **Learning Patterns**10 @workspace what patterns does this project use?11 124. **Running Project**13 @workspace how do I set up and run this project?8. Staying Up-to-Date
8.1 New Features
GitHub Copilot được update thường xuyên:
- Copilot Chat improvements
- Agent mode enhancements
- New slash commands
- Better context understanding
8.2 Resources
markdown
1## Keep Learning2 3📚 Documentation4- https://docs.github.com/copilot5 6📺 YouTube7- GitHub channel8- VS Code channel9 10🐦 Twitter/X11- @GitHubCopilot12- @code13 14💬 Community15- GitHub Discussions16- VS Code Discord9. Productivity Metrics
Tracking Your Progress
markdown
1## Weekly Copilot Metrics2 3### Quantitative4- Lines of code assisted: ___5- Suggestions accepted: ___%6- Time saved (estimate): ___ hours7 8### Qualitative9- Most helpful feature this week: ___10- Challenge overcome with Copilot: ___11- New technique learned: ___12 13### Goals for Next Week14- Try: ___15- Improve: ___Before vs After
| Task | Before Copilot | With Copilot |
|---|---|---|
| Write CRUD API | 2 hours | 30 minutes |
| Write unit tests | 1 hour | 15 minutes |
| Debug complex issue | 1+ hour | 20 minutes |
| Learn new framework | Days | Hours |
| Code review | 30 min | 10 minutes |
10. Final Checklist
Copilot Mastery Checklist
markdown
1## Basics2- [ ] Efficient use of autocomplete3- [ ] Comfortable with inline chat4- [ ] Know all important shortcuts5 6## Intermediate7- [ ] Effective prompt engineering8- [ ] Using @workspace context9- [ ] Code review with Copilot10 11## Advanced12- [ ] Agent mode for complex tasks13- [ ] TDD with generated tests14- [ ] Refactoring workflows15 16## Expert17- [ ] Custom prompt templates18- [ ] Team workflow integration19- [ ] Teaching others11. Chứng chỉ hoàn thành
🎉 Chúc mừng bạn đã hoàn thành khóa học Vibe Coding với GitHub Copilot!
Bạn đã học được:
- ✅ Vibe Coding Philosophy - Cách tiếp cận mới trong lập trình
- ✅ Copilot Fundamentals - Autocomplete, Chat, Agent mode
- ✅ Prompt Engineering - Viết prompts hiệu quả
- ✅ Code Quality - Review, refactoring, testing
- ✅ Full-stack Development - Xây dựng ứng dụng hoàn chỉnh
- ✅ Best Practices - Tips và workflows
Tiếp theo của bạn:
markdown
11. **Practice Daily**2 - Use Copilot for all coding tasks3 - Experiment with new features4 52. **Build Projects**6 - Apply skills to real projects7 - Challenge yourself8 93. **Share Knowledge**10 - Help others learn11 - Share tips and tricks12 134. **Stay Updated**14 - Follow GitHub Copilot news15 - Try new features as releasedQuote để kết thúc
"The best way to predict the future is to invent it." — Alan Kay
Với Vibe Coding và GitHub Copilot, bạn đang tạo ra tương lai của lập trình!
Resources
Official
Community
Practice
🚀 Chúc bạn code vui vẻ với GitHub Copilot!
