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

Which agent this was written for is unclear — built for aider. Also seen: mentions Codex; built for aider; mentions Gemini CLI.

Good fit Use it to generate test cases, add assertions, refactor test code, debug failures, and organize prompts and examples for better suggestions.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/pramoddutta/qaskills/copilot-testing-patterns
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.

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/github.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/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for GitHub Copilot Testing Patterns

Your own site · 80×15
<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="Reviewed on agentmods" width="80" 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. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00048 $0.05202
Opus 5.5 $0.00019 $0.02081
Sonnet 5.5 $0.00010 $0.01040
Haiku 4.5 $0.00005 $0.00520

Measured 1mo ago against content hash 320b604dc7ac, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 1mo ago.

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. 1mo ago 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 (238 stars, last pushed 9d ago), licensed MIT. It adds 48 tokens to every session and 5,202 once invoked, about $0.0002 per session on Opus 5.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

hotfix

Fixes an observed defect with reproducible evidence in one call: writes a short trace doc before touching code, implements the fix, and backs it with a regression test written before the fix. Production incidents are the motivating case, not a gate. When blocked, it halts by name and saves the doc for a later call to…

pe-menezes/vibeflow · 102 tokens

analyze-failures

Triage Katalon True Platform/TestOps test failures and file defects. Use when you need to investigate failed test results, classify each failure as product defect vs automation defect vs environment/data issue, cluster failures by common signature, find likely root cause from execution data, and optionally create…

katalon-labs/true-skills · 131 tokens

vibeflow-hotfix

Fixes an observed defect with reproducible evidence in one call: writes a short trace doc before touching code, implements the fix, and backs it with a regression test written before the fix. Use when a defect was observed and the evidence is in hand — an error message, a failing log, real data misbehaving — wherever…

pe-menezes/vibeflow · 103 tokens

code-review

Reviews code for bugs, security issues, and best practices.

promptfoo/promptfoo · 11 tokens

quality-postmortem

Analyze escaped defects and test suite health through blameless postmortems. Covers bug pattern analysis, test suite health reviews, 5 Whys root cause analysis, process improvement cycles, and postmortem/retro meeting templates with action item tracking. Use when: "QA retro," "escaped bugs," "postmortem," "quality…

petrkindlmann/qa-skills · 140 tokens

bug-reproducer

Find likely software bugs in a codebase, rank concrete bug candidates, and prove or reject them with focused regression tests before proposing a fix. Also turn bug reports, stack traces, screenshots, failing behavior, support tickets, and regressions into minimal reproducible cases with red-to-green evidence. Use when…

AnastasiyaW/codex-claude-code-config · 147 tokens