Want better AI outputs? Try context engineering.
#AI

Want better AI outputs? Try context engineering.

Rust Reporter
3 min read

Context engineering is the evolution of prompt engineering, focused on providing the right information in the right format to large language models. This article explores three practical techniques—custom instructions, reusable prompts, and custom agents—that developers can use with GitHub Copilot to shape, guide, and improve AI-assisted development.

If you've ever felt like GitHub Copilot could be even stronger with just a little more context, you're right. Context engineering is quickly becoming one of the most important ways developers shape, guide, and improve AI-assisted development.

Featured image

What is context engineering?

Context engineering is the evolution of prompt engineering. It's focused less on clever phrasing and more, as Braintrust CEO Ankur Goyal puts it, on "bringing the right information (in the right format) to the LLM."

At GitHub Universe this past fall, Harald Kirschner—principal product manager at Microsoft and longtime VS Code and GitHub Copilot expert—outlined three practical ways developers can apply context engineering today:

  1. Custom instructions
  2. Reusable prompts
  3. Custom agents

Each technique gives Copilot more of the information it needs to produce code matching your expectations, your architecture, and your team's standards.

Let's explore all three, so you can see how providing better context helps Copilot work the way you do.

1. Custom instructions: Give Copilot the rules it should follow

Custom instruction files help Copilot understand your:

  • Coding conventions
  • Language preferences
  • Naming standards
  • Documentation style

You can use:

  • Global rules: .github/copilot-instructions.md
  • Task-specific rules: .github/instructions/*.instructions.md

For example, you might define how React components should be structured, how errors should be handled in a Node service, or how you want API documentation formatted. Copilot then applies those rules automatically as Copilot works.

Learn how to set up custom instructions

2. Reusable prompts: Standardize your common workflows

Reusable prompt files let you turn frequent tasks—like code reviews, scaffolding components, generating tests, or initializing projects—into prompts that you can call instantly and consistently.

Use:

  • Prompt files: .github/prompts/*.prompts.md
  • Slash commands such as /create-react-form to trigger structured tasks

This helps teams enforce consistency, speed up onboarding, and execute repeatable workflows the same way every time.

See examples of reusable prompt files

Decorative background featuring floating green cubes, including one with the GitHub invertocat logo.

3. Custom agents: Create task-specific AI personas

Custom agents allow you to build specialized AI assistants with well-defined responsibilities and scopes. For example:

  • An API design agent to review interfaces
  • A security agent that performs static analysis tasks
  • A documentation agent that rewrites comments or generates examples

Agents can include their own tools, instructions, constraints, and behavior models. And yes, you can even enable handoff between agents for more complex workflows.

Learn how to create and configure custom agents

Why context engineering matters

The goal isn't just better outputs, it's better understanding by Copilot. When you provide Copilot with clearer context:

  • You get more accurate and reliable code
  • You reduce back-and-forth prompting
  • You increase consistency across files and repositories
  • You stay in flow longer instead of rewriting or correcting results

And the more you experiment with context engineering, the more you'll discover how deeply it can shape your development experience.

Get started with context engineering in GitHub Copilot

More resources

A clean header with the GitHub logo features the bold text “Top blog posts of 2025.” Below it, a grid of glowing green and translucent cubes forms a geometric landscape. GitHub’s colorful Mona mascot sits on one cube near an icon resembling a refresh or sync symbol. The design uses soft gradients and bright highlights to create a modern, tech‑themed look.


Christina Warren is a senior developer advocate at GitHub, where she works to make GitHub the best place for developers.

Comments

Loading comments...