Published: 2025-07-09T12:10:00Z
Tags:
#githubcopilot
#ai
#productivity
#tutorial
Originally shared as an internal how-to document. GitHub Copilot as a true pair...
<blockquote>
<p>Originally shared as an internal how-to document.</p>
</blockquote>
<h2>
<a href="#github-copilot-as-a-true-pair-programmer">
</a>
GitHub Copilot as a true pair programmer
</h2>
<p>I've spent a lot of time testing workflows, instructions and prompts. Some with more context, some with less. I've gotten some great results and some spectacular failures! Here's an overview of what I found works for nearly every scenario when using GitHub Copilot Agent mode as a pair implementation specialist.</p>
<h2>
<a href="#tldr">
</a>
📌 TL;DR
</h2>
<ol>
<li>Set up repo-level instructions & starter template</li>
<li>Know your goal & break tasks into stories</li>
<li>Explore options in Ask mode for planning</li>
<li>Design a comprehensive, context-rich prompt</li>
<li>Spell out rules, conventions & self-review steps</li>
<li>Choose the right AI model for each task</li>
<li>Require a self-review pass</li>
<li>Supervise your AI pair—pause & redirect</li>
<li>Review & refine changes like a seasoned engineer</li>
<li>Provide feedback, reprompt & repeat</li>
</ol>
<hr>
<h2>
<a href="#1-set-up-repolevel-instructions">
</a>
1. Set Up Repo-Level Instructions
</h2>
<p><strong>Why it matters</strong>: Repo instructions give Copilot the context it needs before any new code exists. This is your baseline and everything from here on will depend on this. </p>
<blockquote>
<p>🔁 If you missed it, check out my previous post <a href="https://dev.to/anchildress11/all-ive-learned-about-github-copilot-instructions-so-far-5bm7">All I’ve Learned About GitHub Copilot Instructions (So Far)</a>.</p>
</blockquote>
<p>If you're starting a brand new project, use a starter template to scaffold basic structure and create a minimum set of instructions that includes:</p>
<div class="table-wrapper-paragraph"><table>
<thead>
<tr>
<th>Category</th>
<th>Description</th>
<th>Notes</th>
</tr>
</thead>
<tbody>
<tr>
<td>Project Overview</td>
<td>What does this repo do? Why does it matter?</td>
<td></td>
</tr>
<tr>
<td>Testing Requirements</td>
<td>TDD strategy, code coverage %, test types, error handling, edge cases.</td>
<td>I never had a great opportunity to test Copilot's reaction to TDD. Add your experience below!</td>
</tr>
<tr>
<td>Documentation</td>
<td>Javadoc, README, Swagger/OpenAPI specs.</td>
<td>✨ If you want something a little more advanced, look into mermaid diagrams!</td>
</tr>
<tr>
<td>Design & Security</td>
<td>Architecture constraints, naming conventions, auth rules.</td>
<td></td>
</tr>
<tr>
<td>Review Rules</td>
<td>Checklist for self-reviews and criteria for acceptance.</td>
<td>This step will save you a ton of time in the long run.</td>
</tr>
</tbody>
</table></div>
<hr>
<h2>
<a href="#2-know-your-goal-amp-break-it-down">
</a>
2. Know Your Goal & Break It Down
</h2>
<p>✨ Side-project vibe-code?<br>
🛠️ Production bug fix?<br>
🌀 Somewhere in between?</p>
<p>Define your end goal, then split work into small, targeted stories that Copilot can handle one step at a time. If a task can be broken down further, do so - you’ll get better results. The smaller and more targeted you define the task, the better results you’ll get in the end.</p>
<blockquote>
<p>💡 <strong>ProTip</strong>: Give Copilot access to your issue tracker via an MCP server. That's one less thing to copy/paste and you can add an update clause in your prompt to let Copilot handle the comments and even issue tracking status or labels directly.</p>
</blockquote>
<hr>
<h2>
<a href="#3-explore-in-ask-mode">
</a>
3. Explore in Ask Mode
</h2>
<p>If you know exactly how, why, and where, then you can probably skip this step. Otherwise, before coding, do a little exploring with Copilot Ask mode. Prompt it with something like:<br>
</p>
<div class="highlight js-code-highlight">
<pre><code>Given requirements in JIRA-123, analyze #codebase and propose 3 implementation options with pros/cons. Score each by simplicity & maintainability. Recommend one.
</code></pre>
<div class="highlight__panel js-actions-panel">
<div class="highlight__panel-action js-fullscreen-code-action">
<svg xmlns="http://www.w3.org/2000/svg" width="20px" height="20px" viewbox="0 0 24 24" class="highlight-action crayons-icon highlight-action--fullscreen-on"><title>Enter fullscreen mode</title>
<path d="M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z"></path>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" width="20px" height="20px" viewbox="0 0 24 24" class="highlight-action crayons-icon highlight-action--fullscreen-off"><title>Exit fullscreen mode</title>
<path d="M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z"></path>
</svg>
</div>
</div>
</div>
<p>Iterate until uncertainties are surfaced and addressed. This is also the perfect time to validate your setup, including the story itself and custom instructions. Ask yourself, is the result what you expected it to be? If not, can you pinpoint which detail was unclear or too complex?</p>
<p>This is not only a great time to improve your custom instructions and story definition, but also explore alternative approaches. You might even think of something you wouldn't have otherwise. </p>
<blockquote>
<p>⚠️ <strong>Be careful</strong> with overconfident models. Sometimes you will read an explanation presented with such a high degree of certainty that you’ll catch yourself agreeing with it regardless of whether it actually makes sense for your use case.</p>
<p>💡 <strong>ProTip</strong>: Ask mode is perfect for exploration. It prevents Copilot from making changes to the code before you’re ready and it saves a premium request.</p>
</blockquote>
<hr>
<h2>
<a href="#4-design-a-comprehensive-prompt">
</a>
4. Design a Comprehensive Prompt
</h2>
<p>Consider how you want to prompt Copilot to complete its task. For a high-impact production fix, you will probably want to keep a tight leash on the exact implementation. The more straightforward the prompt and instructions are, the less room Copilot has to veer off its intended path or hallucinate a better implementation than the one you had planned. </p>
<p>Your prompt should include:</p>
<ol>
<li>Specific <code>#file</code> or <code>#selection</code> that is relevant to the task</li>
<li>Open any related or secondary files in the editor as additional context</li>
<li>A numbered list of implementation steps, if you need better control or visibility along the way.</li>
<li>Specify any important design patterns, security concerns, or future work planned (can also be separate <code>.github/instructions/specific-guidelines.instruction.md</code> files in the repo for ultimate reusability.</li>
<li>Identify any important config files (like <code>./eslint.config.js</code> or <code>./vitest.config.js</code>) that Copilot must adhere to and put them in context with #file.</li>
<li>For complex tasks, add an extra step instructing Copilot to consider at least X alternative approaches before starting work. Assess whether the detailed implementation plan covers all edge cases and error scenarios appropriately. If not, then update accordingly before moving on.</li>
</ol>
<p>It's always better to be more specific and more strict than to provide no guidance at all. If that means your prompt is closer to the size of a 3-page essay, then that's OK! Try it out and make changes later, if needed.</p>
<h3>
<a href="#example-prompt">
</a>
‼️ Example prompt:
</h3>
<div class="highlight js-code-highlight">
<pre><code><span class="nx">Assess</span> <span class="k">this</span> <span class="err">#</span><span class="nx">codebase</span> <span class="k">in</span> <span class="nx">conjunction</span> <span class="kd">with</span> <span class="nx">the</span> <span class="err">#</span><span class="nx">file</span><span class="p">:</span><span class="nx">README</span><span class="p">.</span><span class="nx">md</span><span class="p">.</span> <span class="nx">Use</span> <span class="err">#</span><span class="nx">githubRepo</span> <span class="nx">tool</span> <span class="nx">to</span> <span class="nx">reference</span> <span class="nx">other</span> <span class="nx">codebases</span><span class="p">,</span> <span class="k">as</span> <span class="nx">needed</span><span class="p">.</span>
<span class="nx">Without</span> <span class="nx">making</span> <span class="nx">any</span> <span class="nx">changes</span> <span class="nx">to</span> <span class="nx">the</span> <span class="nx">existing</span> <span class="nx">code</span><span class="p">,</span> <span class="nx">generate</span> <span class="nx">a</span> <span class="k">new</span> <span class="nx">PROJECT_DIAGRAM</span><span class="p">.</span><span class="nx">md</span> <span class="nx">file</span> <span class="nx">that</span> <span class="nx">correctly</span> <span class="nx">illustrates</span> <span class="nx">a</span> <span class="nx">mermaid</span> <span class="nx">diagram</span> <span class="k">for</span> <span class="k">this</span> <span class="nx">repository</span><span class="p">.</span>
<span class="nx">Adhere</span> <span class="nx">to</span> <span class="nx">the</span> <span class="nx">following</span> <span class="nx">guidelines</span><span class="p">:</span>
<span class="mi">1</span><span class="p">.</span> <span class="nx">The</span> <span class="nx">primary</span> <span class="nx">project</span> <span class="nx">diagram</span> <span class="nx">should</span> <span class="nx">be</span> <span class="nx">a</span> <span class="nx">very</span> <span class="nx">high</span><span class="o">-</span><span class="nx">level</span> <span class="nx">and</span> <span class="nx">only</span> <span class="nx">include</span> <span class="nx">inputs</span><span class="p">,</span> <span class="nx">major</span> <span class="nx">functionality</span><span class="o">/</span><span class="nx">business</span> <span class="nx">logic</span><span class="o">/</span><span class="nx">outputs</span><span class="p">.</span>
<span class="nx">If</span> <span class="nx">it</span> <span class="nx">links</span> <span class="nx">to</span> <span class="nx">a</span> <span class="nx">separate</span> <span class="nx">project</span><span class="p">,</span> <span class="nx">those</span> <span class="nx">should</span> <span class="nx">be</span> <span class="nx">well</span> <span class="nx">documented</span><span class="p">.</span>
<span class="mi">2</span><span class="p">.</span> <span class="nx">For</span> <span class="nx">each</span> <span class="nx">primary</span> <span class="nx">use</span> <span class="k">case</span> <span class="nx">you</span> <span class="nx">can</span> <span class="nx">identify</span><span class="p">,</span> <span class="nx">generate</span> <span class="nx">a</span> <span class="nx">diagram</span> <span class="k">for</span> <span class="nx">it</span> <span class="nx">that</span> <span class="nx">includes</span> <span class="nx">enough</span> <span class="nx">detail</span> <span class="nx">to</span> <span class="nb">document</span> <span class="nx">the</span> <span class="nx">process</span> <span class="nx">end</span> <span class="nx">to</span> <span class="nx">end</span><span class="p">,</span>
<span class="nx">but</span> <span class="nx">leave</span> <span class="nx">out</span> <span class="nx">any</span> <span class="nx">irrelevant</span> <span class="nx">processing</span> <span class="nx">or</span> <span class="dl">"</span><span class="s2">common sense</span><span class="dl">"</span> <span class="nx">logic</span><span class="p">.</span>
<span class="mi">3</span><span class="p">.</span> <span class="nx">Every</span> <span class="nx">diagram</span> <span class="nx">should</span> <span class="nx">have</span> <span class="nx">its</span> <span class="nx">own</span> <span class="nx">section</span> <span class="nx">that</span> <span class="nx">includes</span> <span class="nx">the</span> <span class="nx">mermaid</span> <span class="nx">diagram</span> <span class="nx">itself</span><span class="p">,</span> <span class="nx">a</span> <span class="nx">brief</span> <span class="nx">description</span> <span class="k">of</span> <span class="nx">its</span> <span class="nx">purpose</span><span class="p">,</span>
<span class="nx">any</span> <span class="nx">external</span> <span class="nx">factors</span> <span class="nx">or</span> <span class="nx">links</span><span class="p">,</span> <span class="nx">troubleshooting</span> <span class="nx">steps</span> <span class="k">for</span> <span class="nx">common</span> <span class="nx">failures</span><span class="p">,</span> <span class="nx">and</span> <span class="nx">suggested</span> <span class="nx">future</span> <span class="nx">improvements</span><span class="p">,</span>
<span class="k">if</span> <span class="nx">any</span> <span class="nx">exist</span><span class="p">,</span> <span class="nx">that</span> <span class="nx">would</span> <span class="nx">improve</span> <span class="nx">maintainability</span> <span class="nx">or</span> <span class="nx">eliminate</span> <span class="nx">potential</span> <span class="nx">bugs</span><span class="p">.</span>
<span class="mi">4</span><span class="p">.</span> <span class="nx">Ensure</span> <span class="k">this</span> <span class="k">new</span> <span class="nx">project_diagram</span> <span class="nx">is</span> <span class="nx">linked</span> <span class="nx">to</span> <span class="k">from</span> <span class="nx">the</span> <span class="nx">primary</span> <span class="err">#</span><span class="nx">file</span><span class="p">:</span><span class="nx">README</span><span class="p">.</span><span class="nx">md</span>
</code></pre>
<div class="highlight__panel js-actions-panel">
<div class="highlight__panel-action js-fullscreen-code-action">
<svg xmlns="http://www.w3.org/2000/svg" width="20px" height="20px" viewbox="0 0 24 24" class="highlight-action crayons-icon highlight-action--fullscreen-on"><title>Enter fullscreen mode</title>
<path d="M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z"></path>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" width="20px" height="20px" viewbox="0 0 24 24" class="highlight-action crayons-icon highlight-action--fullscreen-off"><title>Exit fullscreen mode</title>
<path d="M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z"></path>
</svg>
</div>
</div>
</div>
<blockquote>
<p>💡 <strong>ProTip</strong>: Mermaid diagrams are a great addition to any <code>README.md</code> and GitHub renders them without any help on your end. If you want the preview to display in VS Code, you'll need to install an extension. I use <a href="https://marketplace.visualstudio.com/items?itemName=bierner.markdown-mermaid">bierner.markdown-mermaid</a> but there's a ton of them available.</p>
</blockquote>
<hr>
<h2>
<a href="#5-spell-out-rules-amp-guidelines">
</a>
5. Spell Out Rules & Guidelines
</h2>
<p>Reference your <code>README.md</code> or <code>.github/custom-instructions.md</code> file when defining strict guidelines, especially if a commit hook or linter is involved.</p>
<p>In your prompt, try adding something similar to:<br>
</p>
<div class="highlight js-code-highlight">
<pre><code>Follow conventions in README.md: Javadoc, pass all tests, adhere to secure coding guidelines.
</code></pre>
<div class="highlight__panel js-actions-panel">
<div class="highlight__panel-action js-fullscreen-code-action">
<svg xmlns="http://www.w3.org/2000/svg" width="20px" height="20px" viewbox="0 0 24 24" class="highlight-action crayons-icon highlight-action--fullscreen-on"><title>Enter fullscreen mode</title>
<path d="M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z"></path>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" width="20px" height="20px" viewbox="0 0 24 24" class="highlight-action crayons-icon highlight-action--fullscreen-off"><title>Exit fullscreen mode</title>
<path d="M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z"></path>
</svg>
</div>
</div>
</div>
<p>For narrow tasks, add file-specific context:<br>
</p>
<div class="highlight js-code-highlight">
<pre><code>Implement within #MyComponent.tsx, preserve API interface.
</code></pre>
<div class="highlight__panel js-actions-panel">
<div class="highlight__panel-action js-fullscreen-code-action">
<svg xmlns="http://www.w3.org/2000/svg" width="20px" height="20px" viewbox="0 0 24 24" class="highlight-action crayons-icon highlight-action--fullscreen-on"><title>Enter fullscreen mode</title>
<path d="M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z"></path>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" width="20px" height="20px" viewbox="0 0 24 24" class="highlight-action crayons-icon highlight-action--fullscreen-off"><title>Exit fullscreen mode</title>
<path d="M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z"></path>
</svg>
</div>
</div>
</div>
<blockquote>
<p>🏹 <strong>One prompt → one premium request</strong> in Agent Mode. Maximize your premium usage by combining as much information and context into a single prompt as possible.</p>
</blockquote>
<hr>
<h2>
<a href="#6-choose-the-right-ai-model">
</a>
6. Choose the Right AI Model
</h2>
<p>The model you choose is probably the next biggest impact to the overall implementation and outcome. When in doubt, try the cheapest one first (aka smallest premium multiplier). If it doesn't work the first time, <code>/clear</code> everything and then re-submit the prompt.</p>
<div class="table-wrapper-paragraph"><table>
<thead>
<tr>
<th>Task</th>
<th>Recommended Model</th>
<th>Alternate Model</th>
</tr>
</thead>
<tbody>
<tr>
<td>New feature or complex logic</td>
<td>Claude Sonnet (any version)</td>
<td>Claude Opus</td>
</tr>
<tr>
<td>Quick fix</td>
<td>o3/4-mini</td>
<td>Gemini 2.0 Flash</td>
</tr>
<tr>
<td>Heavy analysis or debugging</td>
<td>o3/4 (regular)</td>
<td>Gemini 2.5 Pro</td>
</tr>
<tr>
<td>Ideation or creative exploration</td>
<td>GPT-4.1</td>
<td>GPT-4.5</td>
</tr>
</tbody>
</table></div>
<blockquote>
<p>📌 Refer to <a href="https://docs.github.com/en/copilot/reference/ai-models/choosing-the-right-ai-model-for-your-task">GitHub's model cheatsheet</a> for more detailed info about picking the right model.</p>
<p>💡 <strong>ProTip</strong>: The VS Code Chat extension works like your terminal - just press the up arrow key to rotate through previous chats, even after you've cleared them. You can also use the history button at the top to return to a previously cleared chat.</p>
</blockquote>
<hr>
<h2>
<a href="#7-require-a-selfreview-pass">
</a>
7. Require a Self-Review Pass
</h2>
<p>Either in the overall initial prompt or in a custom-instructions file, instruct GitHub Copilot to complete a detailed self-review of all changes made according to a set guideline (security, optimization, maintainability, etc):<br>
</p>
<div class="highlight js-code-highlight">
<pre><code>- Pass all tests & coverage checks
- Meet lint & format requirements
- Perform a detailed self-review with a focus on secure coding practices
</code></pre>
<div class="highlight__panel js-actions-panel">
<div class="highlight__panel-action js-fullscreen-code-action">
<svg xmlns="http://www.w3.org/2000/svg" width="20px" height="20px" viewbox="0 0 24 24" class="highlight-action crayons-icon highlight-action--fullscreen-on"><title>Enter fullscreen mode</title>
<path d="M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z"></path>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" width="20px" height="20px" viewbox="0 0 24 24" class="highlight-action crayons-icon highlight-action--fullscreen-off"><title>Exit fullscreen mode</title>
<path d="M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z"></path>
</svg>
</div>
</div>
</div>
<blockquote>
<p>💡 <strong>ProTip</strong>: You'll save on premium requests if you include the self-review requirements in the initial prompt. However, you'll get better results if you separate the review step from the implementation (be sure to <code>/clear</code> and consider changing the model, too!)</p>
</blockquote>
<hr>
<h2>
<a href="#8-supervise-your-ai-pair">
</a>
8. Supervise Your AI Pair
</h2>
<p>Always follow these basic guidelines whenever you're working with GitHub Copilot:</p>
<ol>
<li>
<p><strong>Never leave Copilot unattended</strong> (ask me how I know 🤣)</p>
<blockquote>
<p>☝️ Asked and answered <a href="https://dev.to/anchildress1/github-copilot-agent-mode-the-mistake-you-never-want-to-make-1mmh">here</a>.</p>
</blockquote>
</li>
<li><p>When in doubt, pause the task</p></li>
<li><p>Clarify & redirect whenever needed </p></li>
<li><p>Resume only when context is clear</p></li>
<li><p>Communicate manual edits with Copilot (else they'll get overwritten)</p></li>
</ol>
<blockquote>
<p>💡 <strong>ProTip</strong>: It doesn't seem to cost anything extra to simply pause execution, assess, and then resume. However, if you end up sending a new prompt to redirect they will charge you the standard premium request fee (whenever I figure out what that really means, I'll let you know!)</p>
</blockquote>
<hr>
<h2>
<a href="#9-review-like-a-human">
</a>
9. Review Like a Human
</h2>
<p>Use VS Code’s diff view to accept/reset line-by-line. Keep changes by default and reset unwanted bits in Source Control - this helps prevent accidental resets.</p>
<p>Pick your battles. Don’t spend premium requests on minor formatting or nitpicks. Sometimes you have to accept that it's never going to be 100% perfect. Don't be afraid to jump in and take over when you need to.</p>
<blockquote>
<p>🚨 Channel your inner code review boss, every single time. Whether AI helped out or not, you’re always on the hook for clean, accurate code. Double-check, polish, and take pride in your commits - it’s your name on the line, so make sure it’s something you’d want to sign off on!</p>
</blockquote>
<hr>
<h2>
<a href="#10-refine-reprompt-amp-repeat">
</a>
10. Refine, Reprompt & Repeat
</h2>
<p>Treat every interaction with Copilot like you're teaching a junior dev. Use every available opportunity to improve your instructions, prompt, or clarify your goal:</p>
<ul>
<li>Ask clarifying questions</li>
<li>Get alternate solutions</li>
<li>Propose different approaches (then let Copilot pick)</li>
<li>Prompt Copilot to challenge logic</li>
<li>Flag missing tests/docs with inline or PR comments</li>
</ul>
<blockquote>
<p>💡 <strong>ProTip</strong>: Copilot is a powerful teammate, but it’s not a one-size-fits-all solution - especially when you’re dealing with brand-new repos, high-stakes production fires, or anything that needed to be done yesterday. Save yourself a headache: choose your AI battles wisely, and don’t try to make AI your Swiss Army knife for every situation. Sometimes, the fastest route is a good old-fashioned human touch.</p>
</blockquote>
<hr>
<h2>
<a href="#your-turn">
</a>
💬 Your Turn:
</h2>
<p>What worked (or spectacularly failed)? Any surprises when pairing with GitHub Copilot? </p>
<p>Share your personal wins, no-repeat plans, and unique stories below!</p>
<hr>
<blockquote>
<h3>
<a href="#rai-disclaimer">
</a>
🛡️ RAI Disclaimer
</h3>
<p>Everything I share here is my own perspective—created with the help of AI tools (GitHub Copilot, ChatGPT, and their friends), but always with a human in the loop. I do my best to catch accidental bias and fact-check, but if you ever spot something odd, let me know! AI isn’t perfect, and neither am I.</p>
<p><strong>TL; DR:</strong> AI helped, but you can blame me for the <strong>chaos</strong>! 🫠</p>
</blockquote>
Read on Dev.to →