AI / GitHub Copilot CLI Fundamentals Interview Questions
What are best practices for writing effective prompts in GitHub Copilot CLI?
The quality of Copilot CLI's output is directly related to the clarity and specificity of your prompt. Well-structured prompts reduce back-and-forth and get you to working code faster.
| Principle | Example |
|---|---|
| Specify the task clearly | 'Add input validation to the email field in src/forms/signup.tsx - reject addresses without @ and a domain' |
| Include the context path | 'Look at src/api/auth.ts and add rate limiting to the /login endpoint' |
| Mention constraints | 'Add the feature without modifying existing tests' |
| Describe the expected outcome | 'The result should pass all existing tests and add new tests for the validation logic' |
| Break large tasks into phases | Use Plan mode to review a step-by-step plan before Autopilot executes it |
# Vague prompt (avoid) "Fix the bug" # Better prompt "The login form throws a TypeError when the email field is empty. Fix the bug in src/components/LoginForm.tsx - the issue is in the handleSubmit function around line 45." # Best prompt for complex task - use Plan mode # Shift+Tab to Plan mode, then: "Refactor the payment processing module in src/payments/ to use the new Stripe SDK v5 API. The old SDK used client.charges.create(); the new SDK uses client.paymentIntents.create(). Preserve all existing error handling and update the relevant unit tests." # → Copilot produces a plan for review before executing
Pro tip - use Plan mode for risky changes: before letting Copilot execute a significant refactor or delete files, switch to Plan mode (Shift+Tab) and review the proposed steps. This catches misunderstandings before they cause unintended changes.
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
