Strategies for Using GitHub Copilot Effectively

Where to start

Successful large-scale change benefits from a deliberate, lightweight plan and strong anchors for behaviour.

  1. Anchor with documentation: Create a concise docs/architecture.md describing structure, key modules, critical paths, and important dependencies. Reference it in .github/copilot-instructions.md so Copilot can consult it automatically.
  2. Anchor with tests: Where possible, improve baseline test coverage of critical flows. Tests provide objective signals for behaviour before, during, and after change.
  3. Co-design the plan: Ask Copilot to propose a plan to chunk and sequence the work, then refine it with a domain expert who understands the system and goals.
  4. Calibrate autonomy and risk: Decide which tasks are safe to automate repeatedly (for example, happy-path unit tests) and which require closer human guidance.
  5. Validate continuously: Keep feedback loops tight. Run tests frequently, review small changes quickly, and adjust prompts and patterns as you learn.

Prompt engineering for large changes

Work within model context limits and make intent explicit.

Token window considerations:

Chunking

Chunking makes work fit model limits and human review. Choose boundaries that preserve behaviour and reduce coupling. See Chapter 4 for detailed strategies. Common patterns:

Chaining prompts (iterative workflows)

Avoid “one prompt to do it all”. Use repeatable chains.

Example: Increasing test coverage for a module

  1. Update docs/architecture.md with a brief module overview and critical paths.
  2. Using existing tests and recent test output, ask for a coverage improvement plan focused on high-risk paths.
  3. Generate and run new unit tests; mock external dependencies.
  4. Address issues revealed by the tests with minimal, well-reviewed code changes.
  5. Add integration tests for key collaboration points; keep mocks local to unit tests.
  6. Update CI to run integration tests appropriately (for example, without mocks in system environments).
  7. Repeat for the next module; refine prompts as patterns emerge.

Shared prompt libraries

Standardise effective prompts and make them discoverable.

Prompt files (use cases)

Prompt files help encode repeatable tasks such as:

Keep prompt files short and point to .github/copilot-instructions.md, architecture docs, and standards to avoid duplication.

Plan-driven and agent-mode workflows

Use a lightweight plan.md to capture intent and track progress between sessions. In agent modes (where available), keep changes small and human-in-the-loop:

Risks and guardrails

Key Takeaways