GitHub Copilot Testing Patterns

GitHub Copilot Testing Patterns is a skill for Claude Code, Codex from PramodDutta/qaskills. It costs 48 tokens per session (5,202 once invoked), scanned C, original, MIT.

A guide to using GitHub Copilot, an AI coding assistant, to create and maintain test code. It explains how to give Copilot useful project context and refine its suggested tests.

In plain words
What is it for?
Use it to generate test cases, add assertions, refactor test code, debug failures, and organize prompts and examples for better suggestions.
Why use it?
It helps reduce the manual work of writing repetitive tests while keeping suggestions aligned with existing code and testing conventions. It also provides ways to investigate failed tests with Copilot Chat.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/pramoddutta/qaskills/copilot-testing-patterns
Any agent
npx skills add PramodDutta/qaskills --skill copilot-testing-patterns
Clone the repo
git clone --depth 1 https://github.com/PramodDutta/qaskills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for GitHub Copilot Testing Patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/pramoddutta/qaskills/copilot-testing-patterns.svg)](https://agentmods.dev/skills/pramoddutta/qaskills/copilot-testing-patterns)
Your own site
<a href="https://agentmods.dev/skills/pramoddutta/qaskills/copilot-testing-patterns"><img src="https://agentmods.dev/badge/skills/pramoddutta/qaskills/copilot-testing-patterns.svg" alt="Measured on agentmods" height="20"></a>
Per session 48 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 5,202 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00048 $0.05202
Opus 5 $0.00024 $0.02601
Sonnet 5 $0.00010 $0.01040
Haiku 4.5 $0.00005 $0.00520

Measured yesterday against content hash 320b604dc7ac, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade C, and why

GitHub Copilot Testing Patterns scanned grade C with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Hidden instructionshighPrompt injection

Directives inside HTML comments, invisible characters or bidirectional overrides are read by the model and not by the person reviewing the file.

<!-- .github/copilot/instructions.md -->
seed-skills/copilot-testing-patterns/SKILL.md · 539 lines

How it starts

The opening of the file, as written. The whole thing — 539 lines — stays where its author put it; the contents beside it link to each section on GitHub.

GitHub Copilot Testing Patterns Skill

You are an expert in leveraging GitHub Copilot for test automation. When the user asks you to generate tests with Copilot, optimize Copilot suggestions for testing, use Copilot Chat for test debugging, or configure Copilot for testing workflows, follow these detailed instructions.

Core Principles

  1. Context is king -- Copilot generates better tests when it has access to the source code, existing test patterns, and project conventions. Keep relevant files open and organized.
  2. Comment-driven generation -- Write descriptive comments before test functions to guide Copilot's suggestions. The comment becomes the specification.
  3. Pattern establishment -- Write 2-3 example tests manually, then let Copilot follow the pattern. It excels at pattern continuation.
  4. Iterative refinement -- Accept Copilot's initial suggestion, then refine. It is faster to edit a 80% correct suggestion than to write from scratch.
  5. Chat for complex scenarios -- Use Copilot Chat for multi-step test generation, test refactoring, and debugging failed tests.
  6. Workspace awareness -- Copilot uses open files as context. Keep the source file and existing test file open when generating new tests.
  7. Review everything -- Copilot generates plausible but potentially incorrect tests. Every suggestion must be reviewed for correctness, completeness, and style.

Project Structure

src/
  services/
    user-service.ts
    user-service.test.ts    # Keep test next to source
  utils/
    validators.ts
    validators.test.ts
  components/
    Button/
      Button.tsx
      Button.test.tsx
.github/
  copilot/
    instructions.md         # Custom instructions for Copilot
    test-patterns.md        # Test pattern examples
.vscode/
  settings.json             # Copilot configuration

Copilot Custom Instructions for Testing

<!-- .github/copilot/instructions.md -->
# Test Generation Instructions

When generating tests, follow these conventions:
- Use vitest with TypeScript
- Follow Arrange-Act-Assert (AAA) pattern
- Name tests: "should [expected behavior] when [condition]"
- Group tests in describe blocks by function name
- Mock external dependencies using vi.mock()
- Include edge cases: null, undefined, empty values, boundaries
- Include error cases for every function that can throw
- Use strict TypeScript types (no `any`)
- Add meaningful assertion messages

Read the full file on GitHub · 539 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 539 lines · 48 tokens per session scan C 320b604dc7ac

Subscribe to this mod's changes

GitHub Copilot Testing Patterns is a skill published in the GitHub repository PramodDutta/qaskills (214 stars, last pushed 5d ago), licensed MIT. It adds 48 tokens to every session and 5,202 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it C with 1 finding (hidden instructions). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

cli-logging-ux

Use this skill when editing or creating CLI output, logging, warnings, error messages, progress indicators, or diagnostic summaries in the APM codebase. Activate whenever code touches console helpers (richsuccess, richwarning, richerror, richinfo, richecho), DiagnosticCollector, STATUSSYMBOLS, CommandLogger, or any…

microsoft/apm · 94 tokens

cut-release

Use this skill to cut an APM release from the current worktree: assess whether the cycle since the last tag warrants a patch or minor bump (semver discipline against the merged-since-last-tag diff), sanitize the [Unreleased] CHANGELOG block into a dated version block with one concise "so what" entry per merged PR…

microsoft/apm · 198 tokens

docs-sync

Use this skill whenever a pull request is opened, reopened, or synchronized in microsoft/apm to assess whether and how the documentation corpus must change to stay truthful with the proposed code change. Activate even when the PR title or body says nothing about docs -- the skill must run on every PR to detect silent…

microsoft/apm · 150 tokens

docs-impact-architect

Use this skill when the docs-impact-classifier returns a structural verdict, signalling that the documentation TOC must change to accommodate the PR. Proposes TOC deltas (new pages, moves, merges) and emits new-page outline stubs that the doc-sync panel later fleshes out. Holds the 3-promise narrative (consume /…

microsoft/apm · 85 tokens

lore

SpecStory Lore - mine your SpecStory coding histories (any agent - Claude Code, Codex, Cursor, Gemini, and more) into a persistent corpus, surface your reproducible workflows with corroborated evidence, and interactively forge the chosen ones into skills installed across all your agent harnesses. Use when the user…

specstoryai/getspecstory · 109 tokens

workthreads

SpecStory Workthreads - a weekly work-thread rollup across a team's repos from SpecStory coding histories (any agent - Claude Code, Codex, Cursor, Gemini, and more). It groups the window's sessions into threads of work per project and labels each new / open / recently closed, so a lead sees what shipped, what is still…

specstoryai/getspecstory · 126 tokens