GitHub Copilot CLI — Hackathon Cheat Sheet#
Companion handout for the session "Vibe Coding an App with GitHub Copilot CLI" (Tobias & Jeffrey).
Everything here is grounded in the official docs: https://docs.github.com/en/copilot/how-tos/copilot-cli
Written against Copilot CLI as documented in July 2026. The CLI ships fast — run /help and /changelog summarize if something here doesn't match what you see.
The one-line version: describe the outcome, let Copilot plan it, steer while it works, and make it prove the result. Vibe coding is not "no engineering" — it's engineering with the agent holding the keyboard.
0. Get running in 5 minutes#
# Pick one
npm install -g @github/copilot # cross-platform, needs Node.js 22+
winget install GitHub.Copilot # Windows
brew install --cask copilot-cli # macOS / Linux
cd my-project
copilot # start interactive session
Inside the session:
| Step | What to do |
|---|---|
| 1 | /login — OAuth device flow, first time only |
| 2 | Confirm you trust this folder (option 2 remembers it) |
| 3 | /init — generate .github/copilot-instructions.md for the repo |
| 4 | Give me an overview of this project. |
Non-interactive / scripting:
copilot -p "In Git, how can I apply a commit from another branch"
copilot -sp "YOUR PROMPT" # -s = response only, no usage info
copilot --continue # resume the most recent session
copilot --resume # pick from a list of sessions
Also useful: copilot version, copilot update, copilot help TOPIC,
copilot completion zsh|bash|fish (tab completion), copilot plugins list.
1. Vibe coding — the loop that actually works#
Copilot CLI is agentic: it reads, writes, runs commands and verifies. Your job is direction and acceptance criteria, not typing.
| Phase | Prompt it like this |
|---|---|
| Explore | Read the authentication files but don't write code yet |
| Plan | /plan Add OAuth2 authentication with Google and GitHub providers |
| Review | Read the plan, push back, edit it (Ctrl+Y) |
| Implement | Proceed with the plan (or /fleet implement the plan) |
| Verify | /diff — read it yourself — then run the tests |
| Accept | Use the feature by hand. Tests green ≠ demo works |
| Commit | Commit these changes with a descriptive message |
Don't skip the verify gate. The same agent that wrote the code will happily "fix" a failing test by weakening it. Keep this line handy:
Don't weaken tests or change the acceptance criteria to make things pass.
Separate pre-existing failures from ones you introduced. Show me the diff
and stop before committing.
Rules of thumb
- One goal per session. Use
/clearor/newbetween unrelated tasks — focused sessions produce better results. - Give it a way to check its own work (tests, a lint command, a running app). An agent that can verify beats an agent that can only generate.
- Attach reality:
@file,#123(issue/PR), screenshots and mockups (drag & drop, or Ctrl+V). - Small, reviewable steps. You still own the diff.
- Commit at every green state. A commit is the cheapest escape hatch you have.
2. Init — teach the repo to Copilot#
/init (or copilot init) analyses the codebase and writes/updates .github/copilot-instructions.md with:
- build, test and lint commands
- high-level architecture
- codebase-specific conventions
If the file already exists, Copilot proposes improvements you can accept or reject.
/init suppress hides the startup reminder for this repo.
Example .github/copilot-instructions.md
## Build Commands
- `npm run build` - Build the project
- `npm run test` - Run all tests
- `npm run lint:fix` - Fix linting issues
## Code Style
- Use TypeScript strict mode
- Prefer functional components over class components
## Workflow
- Run `npm run lint:fix && npm test` after making changes
- Commit messages follow conventional commits format
Where instructions come from (all merged; keep them short and non-conflicting):
| Location | Scope |
|---|---|
.github/copilot-instructions.md |
Repository-wide |
.github/instructions/**/*.instructions.md |
Path-specific via applyTo: glob frontmatter |
AGENTS.md, CLAUDE.md, GEMINI.md |
Agent instructions, repo root / cwd |
$HOME/.copilot/copilot-instructions.md |
Your personal preferences, all repos |
/instructions lists and toggles what loaded. Use @relative/path inside an instruction file to inline another file.
⚠️ Instruction edits apply on the next session — /new, or exit and copilot --continue.
3. Planning — the single highest-value habit#
Shift+Tab cycles standard → plan → autopilot. Or run /plan YOUR GOAL from standard mode.
In plan mode Copilot:
- analyses your request and the codebase
- asks clarifying questions
- writes a checklist plan to
plan.mdin the session folder - waits for your approval before touching code
Ctrl+Y opens the plan in your editor. /session plan shows the current plan.
| Use plan mode | Skip plan mode |
|---|---|
| Complex multi-file changes | Quick bug fixes |
| Refactors with many touch points | Single-file changes |
| New feature implementation | Throwaway questions |
4. Steering — keeping the agent on track#
- Just type while it's thinking. Anything you send mid-turn is treated as steering and folded into the current task. There is no separate instruction queue — it lands in the work already in flight. (Ctrl+Enter / Ctrl+Q is different: it holds a message and sends it when the turn ends.)
- Reject with feedback: choose "No, and tell Copilot what to do differently" on a permission prompt and say what you want instead.
- Esc cancels; Esc Esc interrupts the running turn.
/undo(/rewind) rewinds the last turn and reverts file changes. It restores your entire workspace to the snapshot — your own manual edits and the effects of shell commands are reverted too, and any files created since are deleted regardless of their Git status. Commit before you rely on it./compact focus on the auth modulesteers what gets kept when context is summarised.
📖 Steering agents · Rolling back changes
5. MCP — give Copilot new tools#
The GitHub MCP server is built in. Add others to reach your APIs, browsers, databases, docs.
# Local (stdio)
copilot mcp add playwright -- npx @playwright/mcp@latest
copilot mcp add context7 -- npx -y @upstash/context7-mcp
# Remote (HTTP)
copilot mcp add --transport http notion https://mcp.notion.com/mcp
copilot mcp add --transport http --header "Authorization: ******" stripe https://mcp.stripe.com
In-session: /mcp add opens a form (Tab between fields, Ctrl+S to save — active immediately, no restart).
Manage with /mcp list | show | edit | delete | enable | disable | auth | reload.
Config file locations
| Path | Use |
|---|---|
~/.copilot/mcp-config.json |
Personal, all projects |
.mcp.json (repo) |
Per-checkout, closest file wins |
.github/mcp.json |
Committed, shared with the team |
{
"mcpServers": {
"playwright": { "type": "local", "command": "npx", "args": ["@playwright/mcp@latest"], "tools": ["*"] },
"context7": { "type": "http", "url": "https://mcp.context7.com/mcp", "tools": ["*"] }
}
}
⚠️ .vscode/mcp.json is not read by the CLI. Project MCP servers load only after you confirm folder trust.
🔎 Find servers: https://github.com/mcp
6. Skills — teach Copilot how to do a specific job#
A skill is a folder with a SKILL.md (plus optional scripts/resources) that Copilot loads only when relevant — so it doesn't burn context on every turn.
.github/skills/github-actions-failure-debugging/
├── SKILL.md
└── (optional scripts, examples, templates)
---
name: github-actions-failure-debugging
description: Guide for debugging failing GitHub Actions workflows. Use this when asked to debug failing GitHub Actions workflows.
# allowed-tools: shell # only if you fully trust the skill and its scripts
---
1. Use `list_workflow_runs` to find recent runs and their status
2. Use `summarize_job_log_failures` for an AI summary of failed jobs
3. Fall back to `get_job_logs` for full detail
4. Reproduce locally, then fix
| Location | Scope |
|---|---|
.github/skills/ (also .claude/skills, .agents/skills) |
Project |
~/.copilot/skills/ (also ~/.agents/skills) |
Personal, all projects |
Commands: /skills list · /skills info NAME · /skills add · /skills reload · /skills remove DIR · /skills (toggle on/off).
Invoke explicitly: Use the /frontend-design skill to create a responsive nav bar in React.
Ready-made skills: https://awesome-copilot.github.com/skills/
⚠️ Only put shell/bash in allowed-tools for skills you have read and trust.
Instructions vs. skills: instructions = always-on conventions. Skills = detailed, situational playbooks.
7. Custom agents — specialists with their own context#
An agent profile is a Markdown file with frontmatter, stored as .github/agents/NAME.agent.md (project) or ~/.copilot/agents/ (user).
---
name: readme-creator
description: Agent specializing in creating and improving README files
---
You are a documentation specialist focused on README files. Do not modify code files.
- Structure sections: overview, installation, usage, contributing
- Use relative links for files inside the repository
Create one fast: /agent → Create new agent → describe it in plain English → Copilot writes the profile → restart the CLI to load it.
Use it four ways: /agent picker · Use the security-auditor agent on /src/app · by inference from the description · copilot --agent security-auditor -p "Check /src/app/validator.go"
Copilot ships a set of built-in agents too, and both yours and the built-ins can run as subagents with their own context window — see §8.
📖 Custom agents · Built-in agents
8. Subagents — separate context, often parallel#
The main agent can hand a piece of work to another agent — a built-in one, or one of yours — and that subagent gets its own context window. The subtask's noise (file dumps, test output, dead ends) never lands in your main thread. Only the result comes back.
Copilot picks one automatically from your prompt and the current context. "How does authentication work in this codebase?" typically goes to explore.
| Built-in | What it's for | Worth knowing |
|---|---|---|
explore |
Fast, read-only codebase search and understanding | Changes nothing, so it can run in parallel with other subagents |
task |
Runs tests, builds, linters, formatters, dependency installs | Brief summary on success, full output on failure. Inherits the parent's tools and permissions |
general-purpose |
Anything the main agent can do | Reach for it when a job simply needs its own context window |
code-review |
Bugs, security holes, race conditions, leaks, logic errors in diffs | Never comments on style. Makes no edits |
research |
Exhaustive research on codebases, APIs, libraries, architecture | Only via /research — the main agent cannot trigger it |
rubber-duck |
Second opinion on plans, code and tests | Runs on a different model. Review-only (see §10) |
Your own agents work the same way. Anything you define in .github/agents/ (§7) can be run as a subagent, with the same context isolation.
Ask for one explicitly when you already know what you want:
Use the explore agent to map how auth flows through the app.
Run the test suite with the task agent.
/research Trade-offs between Server-Sent Events and WebSockets for this API?
Why this matters at a hackathon: context is your scarcest resource. Pushing exploration and test runs into subagents is the cheapest way to keep a long session coherent — and /fleet (§9) is exactly this, applied to many steps at once.
📖 Running agents as subagents · Built-in agents
9. Fleet & Tasks — parallel execution#
/fleet [PROMPT] lets Copilot split a job into parts and run them across subagents in parallel. Best used on an approved plan.
Typical hackathon flow
- Shift+Tab → plan mode, describe the feature
- Iterate until the plan is right
- Choose "Accept plan and build on autopilot + /fleet", or exit plan mode and type
/fleet implement the plan
Monitor with /tasks — lists background subagents and shell commands:
↑/↓ navigate · Enter details/summary · k kill · r remove finished · Esc back.
Autopilot (Shift+Tab): Copilot keeps going without asking after each step. It stops when done, when blocked, on Ctrl+C, or at the continuation limit (--max-autopilot-continues). Works best with full permissions — grant deliberately. It's sticky; disable with /settings stayInAutopilot false.
10. Rubber duck — a second opinion from a different model#
The built-in rubber-duck agent critiques Copilot's own plans, code and tests. It deliberately runs on a different model family than your session model, so it is less likely to share the same blind spots. It is read-only — it reviews, it does not edit.
It reports blocking / non-blocking / suggestions, and stays quiet on style, naming and formatting.
Copilot consults it automatically at high-leverage moments: after planning but before implementing, mid-implementation, after writing tests, and after repeated failures. For small changes it skips it.
Ask for it explicitly:
Rubber duck your plan.
Get a critique of the changes you've made so far.
/rubber-duck What edge cases are missing?
(The rubber duck agent needs your main session model to be a Claude or GPT model.)
Separate from the duck, and with no such restriction: /review [PROMPT] and /security-review [PROMPT].
11. Chronicle — your sessions are data#
Sessions are stored locally (~/.copilot/session-state/{session-id}/) and synced to your GitHub account by default.
| Command | What you get |
|---|---|
/chronicle standup |
Standup report from the last 24h (add for the last 3 days) |
/chronicle tips |
3–5 personalised tips based on how you actually work |
/chronicle cost tips |
Where your tokens went + how to spend less |
/chronicle search TERM |
Keyword search across full session content |
/chronicle improve |
Concrete improvements for .github/copilot-instructions.md, based on where you had to course-correct |
/chronicle reindex |
Rebuild the local session store and re-sync |
Resume & share
copilot --continue /resume [SESSION-ID]
copilot --resume [ID] /rename Improve test coverage
/session /share (link on GitHub.com)
/session checkpoints /share gist | file [PATH] | html [PATH]
Great demo move: end the hackathon with /chronicle standup for your team update, then /chronicle improve to bank what you learned into the repo.
12. GitHub Copilot app — the same engine, with a UI#
A desktop app (macOS, Windows, Linux) built on Copilot CLI. Type /app in the CLI to launch it, or get the download URL.
- Parallel workspaces — multiple agent sessions at once, each with its own git worktree and branch (plus cloud sandboxes, public preview)
- Session modes — Interactive, Plan, Autopilot; pick model and reasoning effort per session
- GitHub native — browse issues, start a session from one, open/review/merge PRs, see CI results
- Customizations — instructions, MCP servers and skills carry over
- Automations — save recurring agent tasks, run on a schedule
- Quick chats — brainstorm without creating a branch
- Canvases — shared surfaces where you and agents collaborate
Available on all Copilot plans (Business/Enterprise: the separate GitHub Copilot app policy must stay enabled).
📖 About the GitHub Copilot app
13. Context, models & cost#
Infinite sessions — context is compacted automatically, so you won't hit a wall mid-hackathon. Compaction summarises, so older detail can be lost: re-state the goal after a long session, or use /compact FOCUS to steer what survives.
| Command | Purpose |
|---|---|
/context |
Token usage breakdown & visualisation |
/compact [FOCUS] |
Manually summarise history (rarely needed) |
/usage |
Session metrics, per-model token totals |
/session checkpoints [N] |
View compaction summaries |
/clear, /new |
Fresh conversation — do this between tasks |
/model |
Switch model mid-session |
/limits set max-ai-credits VALUE |
Cap AI credits per response |
Model picking (/model)
| Model | Best for |
|---|---|
| Auto | Default choice — lower latency, less rate limiting |
| Claude Opus 4.5 | Complex architecture, hard debugging, nuanced refactors |
| Claude Sonnet 4.5 | Day-to-day coding — fast and cost-effective |
| GPT-5.2 Codex | High-volume code generation, second-opinion reviews |
Cost hygiene for a hackathon: plan before coding, keep sessions focused, use a lighter model for routine work, and run /chronicle cost tips at the end.
Model names and defaults change and depend on your plan — run /model to see what your account actually offers.
14. Permissions & safety#
Copilot asks before anything that could modify or execute files. Options: yes once, yes for the session, or no + tell it what to do instead.
copilot --allow-tool='shell(git:*)' --deny-tool='shell(git push)'
copilot --allow-all # a.k.a. --yolo — grants tools, paths and URLs
| Command | Purpose |
|---|---|
/permissions show \| reset |
Inspect / clear session approvals |
/reset-allowed-tools |
Reset the allowed-tools list |
/allow-all (/yolo) |
Grant everything for this session (not a toggle) |
/add-dir PATH, /list-dirs |
Extend and inspect file access |
/cwd PATH, /cd PATH |
Change working directory without restarting |
Common patterns: shell(git:*), shell(npm run:*), shell(npm run test:*), write.
Non-negotiables: review the diff before you merge · never commit secrets · be deliberate with --allow-all (it can delete files) · treat third-party skills/MCP servers as code you're installing.
15. When it goes wrong — the recovery playbook#
Hour two is where hackathons are lost. Work this list top to bottom.
| Symptom | Do this |
|---|---|
| "What did it just change?" | /diff · ! git status · ! git diff |
| "Is this my bug or was it already broken?" | ! git stash -u && <test cmd> — if it still fails, it's most likely pre-existing. Say so explicitly. (-u also stashes untracked files; plain git stash leaves them behind.) |
| "It's going the wrong way" | Type the correction now, mid-turn. Don't wait for it to finish. |
| "It's gone too far" | Esc Esc to interrupt, then /undo to rewind the turn and its file changes |
| "It's confidently repeating the same broken fix" | Two-strikes rule: after 2 failed attempts, stop. /clear, then re-open with the error text, the file, and what you already ruled out. |
| "It's lost the plot after a long session" | Context was compacted. Re-state the goal and acceptance criteria in one message, or /clear and start clean from a commit. |
| "I don't trust any of this" | ! git reset --hard <last-good-sha> — which only works if you committed. Commit at every green state. |
Before you debug, get to a known state. Commit or stash your work, note the last-good SHA, and then let the agent loose.
When to cut scope: if a feature isn't working 60% of the way through your budget, cut it. Ship a smaller thing that demos than a bigger thing that doesn't. Tell the agent explicitly: Drop the export feature. Focus only on making the dashboard render real data.
16. Working as a team#
Two people pointing agents at the same checkout will produce conflicts and lost work. Split the surface first.
| Command | What it does |
|---|---|
/worktree [BRANCH\|TASK] |
New Git worktree off HEAD, switch to it, leave uncommitted changes behind (experimental) |
/move [BRANCH\|TASK] |
Move your uncommitted changes into a new worktree and switch (experimental) |
/fork [NAME] |
Fork the current session (keeps the conversation) (experimental) |
/delegate PROMPT |
Hand a self-contained task to a cloud agent — it opens a PR |
Ground rules that save hackathons
- One workstream per person per worktree/branch. Never two agents in the same working tree.
- Agree the interfaces before you split — API shapes, types, file boundaries. Write them into
.github/copilot-instructions.mdso every agent sees the same contract. - Merge a walking skeleton early. Get one end-to-end path (even a stub) on
mainin the first hour, then everyone builds against something real. - Integrate hourly, not at the end. Long-lived branches + generated code = a merge you can't review.
- One person owns integration and the demo build. They stay out of feature work near the end.
- Freeze before the demo. No merges in the last stretch. Rehearse the demo on the actual build.
17. Quick reference#
Keys#
| Key | Action |
|---|---|
| Shift+Tab | Cycle standard → plan → autopilot |
| Esc / Esc Esc | Cancel / interrupt the running turn |
| Ctrl+C | Cancel, clear input; twice to exit |
@ FILE |
Add file contents to context |
# NUMBER |
Add a GitHub issue or PR to context |
! CMD |
Run a shell command directly (! alone = shell mode) |
? |
Quick help · /help full help |
| Ctrl+Y | View/edit the plan in your editor |
| Ctrl+O / Ctrl+E | Expand recent / all timeline items |
| Ctrl+T | Show/hide reasoning |
| Ctrl+Enter or Ctrl+Q | Queue a message while busy |
| Ctrl+G | Edit prompt in $EDITOR |
Ctrl+X then b |
Send the running task to the background |
| Ctrl+V | Paste an image as an attachment |
| Ctrl+R | Reverse-search prompt history |
Slash commands worth memorising#
/init · /plan · /fleet · /tasks · /rubber-duck · /review · /security-review · /research · /chronicle · /skills · /mcp · /agent · /instructions · /model · /context · /usage · /undo · /diff · /worktree · /move · /pr · /delegate · /resume · /share · /clear · /env · /app · /help
Delegate vs. work locally#
/delegate (cloud agent, opens a PR) |
Keep it local |
|---|---|
| Tangential tasks | Core feature work |
| Documentation updates | Debugging |
| Refactoring separate modules | Interactive exploration |
Multi-repo#
cd ~/projects && copilot # work across all child repos
/add-dir /Users/me/projects/backend-service
/list-dirs
18. Hackathon run sheet#
Percentages of your total budget, so this works for a 4-hour sprint or a 2-day event.
| Phase | Do this |
|---|---|
| Before the event | Install the CLI, /login, verify repo + API access, get dependencies installed and the baseline build/test green. Don't spend event time here. |
| First 10% | Agree the demo: what's on screen at the end, 3 acceptance criteria, must-have vs. stretch. Then /init. Split workstreams and worktrees. |
| Next 10% | Build a walking skeleton — the riskiest integration end-to-end, stubs everywhere else. Add the MCP servers and skills that skeleton actually needs, not the ones that look interesting. Merge it. |
| Middle 55% | Vertical slices. Plan mode for anything multi-file (Shift+Tab), rubber duck the plan before code exists, implement, /diff, test, commit. Interactive by default. Integrate hourly. |
| Last 25% | Scope freeze. Final integration, /review, fix blockers only, rehearse the demo on the real build, /pr create. |
| Throughout | Steer by typing mid-turn · two-strikes rule · /clear between unrelated tasks · commit at every green state |
| Wrap-up | /chronicle standup for the readout · /chronicle improve to bank the learnings in the repo |
When to reach for /fleet and autopilot: only once you have an approved plan whose steps are genuinely independent (separate files, no shared contract in flux). On coupled work it costs more and saves nothing. Everything else: stay interactive and watch the diffs.
Do#
- Write acceptance criteria into the prompt ("done means: tests pass and
npm run devserves the page") - Point at real artifacts:
@src/api.ts,#42, a screenshot of the design - Read the
/diffbefore you commit — you own it, not the agent - Commit at every green state so
/undoandgit resetare both available - Capture repeated instructions into
copilot-instructions.mdor a skill - Cut scope early and loudly rather than late and quietly
Don't#
- Don't dump one giant vague prompt and hope
- Don't stack unrelated tasks in one session
- Don't approve
--allow-allon a repo you care about without thinking - Don't merge a diff you haven't read
- Don't paste secrets into prompts or let them land in files
- Don't let two people (or two agents) work in the same checkout
- Don't keep re-prompting a stuck agent — reset the context instead
Links#
- Copilot CLI docs hub — https://docs.github.com/en/copilot/how-tos/copilot-cli
- Best practices — https://docs.github.com/en/copilot/how-tos/copilot-cli/cli-best-practices
- Command & shortcut reference — https://docs.github.com/en/copilot/reference/copilot-cli-reference/cli-command-reference
- Comparing customization features (instructions vs. skills vs. agents vs. MCP) — https://docs.github.com/en/copilot/concepts/agents/copilot-cli/comparing-cli-features
- Awesome GitHub Copilot skills — https://awesome-copilot.github.com/skills/
- MCP Registry — https://github.com/mcp
- Free hands-on course — https://developer.microsoft.com/blog/get-started-with-github-copilot-cli-a-free-hands-on-course
Copilot CLI ships fast — run /help and /changelog summarize for the newest features.