Learning Library

← Back to Library

Designing Effective GitHub Copilot Agents

Key Points

  • GitHub Copilot now supports multiple custom agents defined in agent.md files, letting you create specialized “team members” (e.g., doc, test, security) with distinct roles and rules.
  • Agents often fail because their descriptions are too vague; you must give precise, task‑oriented instructions (e.g., “QA engineer writing React tests, never modify source code”).
  • Effective agent.md files include early, detailed comments with exact flags, concrete code snippets that show the desired style, clear boundaries on what the agent may not touch (e.g., production configs, secrets), and explicit stack information such as versions and key dependencies.
  • Successful agents cover six core areas—comments, testing, project structure, code style, workflow, and boundaries—and can follow a three‑tier model: actions the agent can take, questions it must ask first, and prohibited actions.
  • To create your first agent, start with a single, simple task, define a concise name, one‑line description, persona, and boundaries; you can even have Copilot generate a starter file that you review and refine, then expand into a full team of specialized agents.

Full Transcript

# Designing Effective GitHub Copilot Agents **Source:** [https://www.youtube.com/watch?v=7353uEUBH78](https://www.youtube.com/watch?v=7353uEUBH78) **Duration:** 00:04:55 ## Summary - GitHub Copilot now supports multiple custom agents defined in agent.md files, letting you create specialized “team members” (e.g., doc, test, security) with distinct roles and rules. - Agents often fail because their descriptions are too vague; you must give precise, task‑oriented instructions (e.g., “QA engineer writing React tests, never modify source code”). - Effective agent.md files include early, detailed comments with exact flags, concrete code snippets that show the desired style, clear boundaries on what the agent may not touch (e.g., production configs, secrets), and explicit stack information such as versions and key dependencies. - Successful agents cover six core areas—comments, testing, project structure, code style, workflow, and boundaries—and can follow a three‑tier model: actions the agent can take, questions it must ask first, and prohibited actions. - To create your first agent, start with a single, simple task, define a concise name, one‑line description, persona, and boundaries; you can even have Copilot generate a starter file that you review and refine, then expand into a full team of specialized agents. ## Sections - [00:00:00](https://www.youtube.com/watch?v=7353uEUBH78&t=0s) **Defining Effective Copilot Agents** - The video explains how to craft precise agent.m MD files for GitHub Copilot by using detailed comments, concrete code snippets, clear boundaries, and specific stack/version information to avoid vague failures. - [00:03:25](https://www.youtube.com/watch?v=7353uEUBH78&t=205s) **Designing Minimal Purpose‑Built Agents** - The speaker recommends starting with a concise agent name, one‑line description, and defined persona, setting strict boundaries on what it may modify, using Copilot to generate starter code, and illustrates this approach with simple doc, test, and API agents. ## Full Transcript
0:00If you're using GitHub Copilot, then you 0:02must know about this new feature. GitHub 0:06Copilot now lets you define multiple 0:09custom agents using agent.m MD files. So 0:13instead of one generalpurpose assistant, 0:16you can create a whole team, a doc 0:20agent, a test agent, a security agent, 0:23each with its own job description and 0:26rules. But in order to use these agents 0:29efficiently, you need to understand how 0:32to define them right. And in this video, 0:35I will show you how. So keep watching 0:38and let's dive in. So why most agents 0:42fail? According to the GitHub's own 0:46research, based on the analysis of more 0:49than 2,500 0:51repos, agent MD files fail for one 0:55simple reason. It's just too vague. You 0:58are a helpful coding assistance. This 1:02sounds nice, but it does not tell the 1:04model what it should actually do. You 1:07need to specify it. For example, you are 1:11a QA engineer who writes tests for React 1:15components and never modifies source 1:18code. But it's not just this. GitHub 1:21researchers found a consistent pattern 1:25in agency MDS at work and that's what 1:28you should do. First put comments early 1:32and not just the generic one like yarn 1:35run or yarn install. Give your exact 1:39comments including flags. What happened? 1:42What happened? [sighs and gasps] 1:54and use code examples over explanations. 1:58One real code snippet showing your 2:00coding style is better than paragraphs 2:03of rules. Set clear boundaries. Tell the 2:06agent what it should never touch. 2:09Production configs, secrets, or specific 2:13folders. And be specific about your 2:16stack. include versions and key 2:18dependencies and make sure you cover 2:21these six areas that are shown in the 2:25most successful agent MD files comments 2:29testing project structure code style g 2:33workflow and as I already said 2:35boundaries GitHub also shares an example 2:39of a doc agent file that is basically a 2:42blueprint of the good agent MD file it 2:45defined finds a role technical writer 2:48and states where it should read from and 2:50where it should write to. Specifies the 2:53ST and includes comments such as dogs 2:56build and markdown linty. And I like 2:59this three tier boundaries idea things 3:02that agent should do, things it should 3:04ask first and things it should never do 3:08like modifying source code or committing 3:10secrets. So, how do you actually start 3:12writing your first agent without 3:15overengineering it? And that's what 3:17GitHub suggests. Pick one simple task. 3:21Don't build a general helper agent and 3:25start minimal agent name, a oneline 3:28description, and a clear persona. Then 3:31define boundaries, where it should write 3:34and what it should never do. Or you can 3:36even be smarter and just ask Copilot to 3:40write an agent for you. Copilot can 3:43generate you a starter file that you 3:45then can review and adjust. For example, 3:48using some custom comments from your 3:50repo and voila, it's ready. 3:53>> And once you got the idea, you can start 3:56building your own team of agents. So 4:00which agents are worth building? These 4:03are few examples from my projects. A doc 4:07agent that reads your source files and 4:10generates documentation but never 4:13changes the original code. A test agent 4:16that writes and runs test but never 4:19deletes or skips them to fix it. or you 4:23can add an API agent that will build you 4:26a new endpoints but will ask you 4:29permissions in case if it needs to 4:31change database schema. So these are 4:35simple rules of building good agents and 4:38if you have any examples of the agents 4:42you build or something to add to this 4:45please let me know in the comments below 4:48the video. Thank you so much for 4:49watching my video and don't forget to 4:51hit the like button and subscribe.