Context Engineering - One Sheet

Context Engineering - One Sheet

Welcome to the Context Engineering with AI workshop. This is a dry run of a training we’ll be giving to Riot Games in February. Please share any feedback or suggestions you have to improve the content or delivery in a comment below!

 

Agenda

Throughout the workshop, we’ll be exploring various topics and concepts related to Context Engineering. We’ll then take time to refine and optimize a copilot-instructions.md file for a codebase of your choosing.

  1. Introduction to Context (10 mins)

  2. Codebase Setup & Instructions Files (15 mins)

  3. Context Theory & Basics (30 mins)

    1. What Makes a Great Context File

    2. Building Context Files

    3. Maintaining Context Files

    4. Token Mangement

  4. copilot-instructions.md Iteration (1 hr)

Codebase Setup

In this section you’ll be setting up your codebase in preparation for creating and refining a copilot-instructions.md file. If you don’t have a codebase in mind, we’ll be using a demo project called TaskFlow.

  1. Open your codebase in VS Code and make sure you can run it.

In this sub-section, you’ll learn how to set-up TaskFlow in VS Code. Full setup instructions are available in the project’s README.md https://github.com/bitovi/taskflow, or follow the steps outlined below.

  1. Install Docker Desktop

    1. IMPORTANT: If you’re installing for the first time, make sure you open the app and complete the setup steps before continuing.

  2. Install VS Code Extensions

    1. Dev Containers Extension

    2. Docker Extension

  3. TaskFlow Demo App Cloned & Loaded in VS Code

    1. git clone https://github.com/bitovi/taskflow.git && cd taskflow

    2. IMPORTANT: Load the taskflow folder as a single folder, not as part of a workspace.

    3.  

    4.  

  4. TaskFlow loaded in a Dev Container

    1. CMD + Shift + PDev Containers: Reopen in Containers

    2. Or click the dialog box that should pop up

      1.  

TaskFlow

username: alice@example.com

password: password123

  1. Set up VS Code with Copilot in Agent Mode

    1. https://bitovi.atlassian.net/wiki/spaces/AIEnabledDevelopment/pages/1455849479

    2. Switch to Agent Mode - https://bitovi.atlassian.net/wiki/spaces/AIEnabledDevelopment/pages/1455849536

Group Discovery

  1. Create Groups Based on Codebase

    1. Participants should have selected a codebase they want to generate a context file for before the training began.

    2. Group up with others who are working on the same codebase.

      1. If there’s a large number of people working on the same codebase (10+), form subgroups.

  2. Choose a Partner

    • Find a pair programming partner that’s working on the same codebase as you.

  3. Create a Shared Collaboration Document

    • Open a shared document in Google Docs, Confluence, or another collaborative tool your team prefers.

    • Create one document for each codebase (or each codebase sub-group) using the template below:

Codebase: <link-to-codebase>


Initial Copilot Instructions

Initial version of copilot-instructions.md that one member of the group will generate for the codebase (leave this blank for now)


Pairs

A section for each programming pair, include a summary of the feature(s) being worked on and keep track of changes made to the instructions file.

Person 1 / Person 2

Features(s): <summarize the features you’re working on>

Change Log:

ex. Fixing bug FE-245

{Summary & Notes}

Instructions Additions:

Instructions Removed:

 

Final Instructions:

 

ex. Implementing feature FE-990

{Summary & Notes}

Instructions Additions:

Instructions Removed:

 

Final Instructions:

 


Final Copilot Instructions

Final version of copilot-instructions.md that combines insights from each pair.

 

Initial Instructions Generation

One member of your codebase group should follow the steps below to generate a copilot-instructions.md file that your group can use going forward in the workshop.

Bitovi's Intructions Generator

  1. Open your AI agent

  2. Run the kickoff prompt

    1. {output_folder} = .results {final_output_file} = /.github/copilot-instructions.md You are assisting with generating a {final_output_file} file using a multi-step prompt chain. 1. Open this repository on GitHub: https://github.com/bitovi/ai-enablement-prompts. 2. Navigate to the `/understanding-code/instruction-generation` folder within the repo. 3. Review all the prompt files in this folder WITHOUT executing them. - This will help you understand the full scope of the prompt chain. 4. Confirm you have a full understanding of the prompt chain sequence. 5. Once you're familiar with the flow, begin executing the prompts in numerical order: - 1-determine-techstack.md - 2-categorize-files.md - 3-identify-architecture.md - 4-domain-deep-dive.md - 5-styleguide-generation.md - 6-build-instructions.md 6. For each step, output results into a corresponding `{output_folder}/` folder. - Mirror the step’s filename e.g., `1-determine-techstack.md` > `{output_folder}/1-determine-techstack.md`. Stop ONLY when: - All `instruction-generation` steps are complete - A full `{final_output_file}` can be generated.
  3. Wait for Copilot to finish

    1. It should take ~10 minutes for Copilot to analyze the whole codebase and output the final file. While it runs, we’ll continue on with the workshop.

  4. Add Instructions to Group Document

    1. The member of the group that generated the instructions file should add it to the collaboration document once it’s done generating.

    2. This will be the starting point for everyone working on the codebase.

Core Context Engineering Concepts

Follow along with the presentation and slides to learn the basics of context engineering.

Copilot Instructions Iteration

In this phase, each team member will independently test and refine their team’s copilot-instructions.md file using real examples from their codebase. The goal is to observe how Copilot performs with the current instructions, identify gaps or misunderstandings, and iteratively improve the file so Copilot becomes more effective and consistent.

✏️ Steps

  1. Select a Feature, Bug, or Issue

    • Choose one or more past items from your project’s commit history.

    • Ideally, pick something you or your team have already solved — this gives you a clear benchmark for what a successful Copilot result looks like.

    • Each team member should pick a different issue if possible (but overlap is okay if multiple people want to explore the same example).

  2. Summarize the Feature/Bug/Issue

    1. The end goal is to have Copilot attempt this change on its own. You’ll need to a short summary of what is expected of Copilot or a description of the bug that needs fixing.

    2. This can be the original ticket for the issue, or something you write up quickly in the shared group doc.

  3. Review the Current Instructions File

    • Open your team’s generated copilot-instructions.md file.

    • Skim through it to familiarize yourself with how it describes the project’s architecture, components, and conventions.

    • Note any missing information that might confuse Copilot for your chosen task.

  4. Attempt the Task with Copilot

    • Use Copilot in Agent Mode and ask it to implement or fix the feature/bug, being sure to include the summary you compiled from step 2 — for example:

      “Using the project’s conventions, implement the fix for issue #123 that resolves the data validation bug. {SUMMARY}”

    • Observe how Copilot responds. Does it understand the architecture? Does it reference the right components? Does it make logical design decisions?

  5. Record Observations and Results

    • In your team’s shared document, under your individual section, write down:

      • What worked well (e.g., “Copilot understood the data model and used existing helpers”)

      • What didn’t (e.g., “Didn’t recognize our API structure”)

      • Any unclear or missing information in the instructions file.

    • Be specific — your notes will help the whole team improve the shared file later.

  6. Modify and Refine the Instructions File

    • Make targeted edits to copilot-instructions.md to fill in gaps or clarify misunderstood details.

    • Add or adjust sections (like architecture notes, naming conventions, or module overviews) as needed.

    • Keep the file concise — focus on improving clarity and coverage, not just adding more text.

  7. Re-Test with the Updated Instructions

    • Re-run your Copilot prompt using the modified file.

    • See if Copilot’s behavior improves — is it more accurate, aligned, or context-aware?

    • Repeat this cycle (test → observe → refine) as time allows.

  8. Maintain a Changelog of Revisions

    • In your individual notes, log each change you made to the instructions file:

      • What you changed

      • Why you changed it

      • What effect it had

    • This changelog will later help your team merge everyone’s findings into a single, final version.

Final Instructions File Synthesis

Now that each team member has tested and refined their own version of the copilot-instructions.md file, it’s time to come back together as a group. The goal of this phase is to consolidate what everyone learned, identify the most effective improvements, and merge them into a single, unified version of your instructions file that your team can continue to use and evolve.

Steps

  1. Regroup and Share Findings

    • Rejoin your team in your shared collaboration document.

    • Each pair briefly summarizes their iteration results:

      • What issues or features they worked on

      • What Copilot did well

      • What problems or misunderstandings they encountered

      • What specific changes they made to improve the instructions

  2. Compare and Discuss Changes

    • As a team, review everyone’s changelog entries and notes.

    • Identify patterns — for example:

      • Were there recurring issues across multiple features?

      • Did certain edits (like clarifying module names or adding architecture notes) consistently help?

      • Did anyone’s changes unintentionally make Copilot worse?

    • Use this conversation to surface the edits that made the biggest positive difference.

  3. Merge the Best Improvements

    • Open a clean copy of your shared copilot-instructions.md file.

    • Collaboratively integrate the strongest insights and modifications from everyone’s iterations.

    • Remove redundancies or conflicting sections as needed.

    • Aim for clarity and completeness, not just length — your goal is a balanced, maintainable file that captures the most useful context.

  4. Document the Final Version

    • Paste or link the final version of your file into the Final Version section of your shared document.

    • Add a short summary of the key takeaways — what changed, why, and how it improved Copilot’s behavior.

    • (Optional) Include a brief changelog summary highlighting the most impactful edits for future reference.