Copilot CLI for beginners: Plan, delegate, and review
By GitHub
Key Concepts
- Plan Mode (
/plan): A feature that allows Copilot to analyze project requirements, ask clarifying questions, and generate a step-by-step implementation roadmap before writing code. - Delegation (
/delegate): A command that offloads tasks to a remote GitHub Copilot coding agent, which executes the work and creates a draft Pull Request (PR). - Review (
/re): A command that triggers a specialized sub-agent to perform a code review on local changes or remote PRs to identify bugs and vulnerabilities. - GitHub Copilot Coding Agent: An autonomous agent capable of performing complex coding tasks, managing file changes, and creating PRs in the background.
1. Planning a Feature with /plan
The planning phase ensures that the AI understands the specific requirements before execution.
- Process: Triggered via
Shift+Tabor/plan. The user provides a high-level goal (e.g., "Implement the 'Support this game' button"). - Clarification: Copilot analyzes the project structure and proactively asks questions regarding technical implementation details, such as state storage (local storage vs. backend), UI elements (icon selection), and functional behavior (toggling state).
- Outcome: A structured, step-by-step plan that serves as the blueprint for the coding agent.
2. Delegating Work with /delegate
Delegation allows for asynchronous development, enabling the user to work on other tasks while the agent handles the implementation.
- Methodology: By typing
/delegatefollowed by a prompt, the user pushes the previously created plan to a remote coding agent. - Execution: The agent creates a draft PR and provides a streaming log of its progress in the terminal.
- Multitasking: Users can initiate a new session (
Ctrl+N) to work on different tasks while the agent processes the request in the background. - Monitoring: Users can track the agent's progress via the "View Session" button, allowing for real-time steering if the agent deviates from the plan.
3. Code Review and Iteration with /re
Once the code is authored, the review process ensures quality and security.
- Functionality: The
/recommand invokes a specialized sub-agent to audit the code. This works on both uncommitted local changes and existing PRs. - Best Practice: The video suggests using a different AI model for the review than the one used for the initial coding to ensure a fresh perspective on potential bugs or vulnerabilities.
- Feedback Loop: If the agent identifies issues, it proposes fixes and requests user input. It concludes by providing a summary of changes, allowing the user to iterate until the code is ready for merge.
4. Workflow Integration
The workflow demonstrates a complete "coding loop" entirely within the terminal:
- Plan: Define requirements and resolve ambiguities with
/plan. - Build: Offload the heavy lifting to a remote agent using
/delegate. - Review: Validate the implementation and catch errors using
/re. - Resume: Use
/resumeto cycle through remote branches and pull the work down locally for final testing or further manual adjustments.
Synthesis
The GitHub Copilot CLI provides a powerful, terminal-centric ecosystem that shifts the developer's role from manual coding to "agent orchestration." By utilizing the sequence of planning, delegating, and reviewing, developers can maintain high-level control over feature implementation while leveraging autonomous agents to handle the technical execution and quality assurance. This approach significantly reduces context switching and streamlines the transition from concept to a production-ready Pull Request.
Chat with this Video
AI-PoweredHi! I can answer questions about this video "Copilot CLI for beginners: Plan, delegate, and review". What would you like to know?