testing
Skill4 starsChanged 9 months agoMITView on GitHub
Use this skill when writing or improving tests of any kind — unit tests, integration tests, end-to-end (E2E) tests, API tests, or test coverage analysis. Trigger on keywords: test, spec, unit test, integration test, E2E, Playwright, Jest, Vitest, pytest, mock, coverage, TDD, test suite, assertion.
194 other projects use a version of this.
Adopted by
Most recently taken up by
- siemens/elementtheir own version, first seen Nov 30, 2026
- mphaxise/gstack-port-for-codextheir own version, first seen Nov 29, 2026
- siberiacancode/agent-skillstheir own version, first seen Nov 29, 2026
- rshankras/claude-code-apple-skillstheir own version, first seen Nov 29, 2026
- microsoft/vs-solutionpersistencetheir own version, first seen Nov 29, 2026
- atstaeff/ai-agentstheir own version, first seen Nov 29, 2026
Used with
Projects with it also use bundle-dependency-prs, update-library-template and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
MicrosoftSkillbundle-dependency-prs
Fix broken dependency update PRs and aggregate the ones that work into one PR.
Also in 8 projects that use this
MicrosoftSkillupdate-library-template
Merges the latest Library.Template into this repo (at position of HEAD) and resolves conflicts.
Also in 8 projects that use this
NVIDIA-NeMoSkillbuild-and-dependency
Dev environment setup for Megatron Bridge — container-based development, uv package management, lockfile regeneration, adding dependencies, Slurm container usage, and common build pitfalls.
Also in 3 projects that use this
timmo001Skillchangeset-scope
Keep all scoped code work contained to the user-defined changeset. Use for implementation, fixes, diagnosis, refactoring, cleanup, and review when explicit instructions, named files, diffs, branches, pull requests, or injected work scopes define the boundary.
Also in 3 projects that use this
JetBrainsSkillmodule-dependencies
Add or modify IntelliJ module dependencies in `.iml` files.
Also in 3 projects that use this
CES-LtdSkilloss-pr
Use when creating a pull request, after committing changes, or when user invokes /oss-pr. Covers branch management, quality checks, commit, push, and PR creation.
Also in 3 projects that use this
Other versions194 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 194
- modelcontextprotocol/servers★ 92ksame name
- lobehub/lobe-chat★ 86ksame name
- lobehub/lobehub★ 86ksame name
- penpot/penpot★ 63ksame name
- meteor/meteor★ 45ksame name
- iOfficeAI/AionUi★ 34ksame name
- garrytan/gbrain★ 34ksame name
- OpenZeppelin/openzeppelin-contracts★ 27ksame name
- tursodatabase/turso★ 25ksame name
- redis/go-redis★ 22ksame name
184 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository37 other files it gives its agents.
- .github/copilot-instructions.mdCopilot instructions
- ai-agent-designSkill
- ai-assisted-learningSkill
- ai-prompting-patternsSkill
- api-designSkill
- backend-devSkill
- career-growthSkill
- client-communicationSkill
- code-explanationSkill
- code-readingSkill
- code-reviewSkill
- cross-functional-collabSkill
- database-designSkill
- debugging-mindsetSkill
- devops-cicdSkill
- doc-creationSkill
- focus-productivitySkill
- frontend-designSkill
- git-workflowSkill
- incident-responseSkill
- internal-commsSkill
- interview-prepSkill
- mcp-builderSkill
- performance-reviewSkill
- problem-solvingSkill
- prompt-engineeringSkill
- research-synthesisSkill
- resume-portfolioSkill
- self-healing-mindsetSkill
- side-project-planningSkill
- sprint-planningSkill
- system-designSkill
- technical-communicationSkill
- technical-mentoringSkill
- tech-researchSkill
- threat-modelingSkill
- web-artifacts-builderSkill
The file
We split this skill into the rules it gives an agent
12 rules. 0 are common, 12 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 175 edited versions we read keep these.
12
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 12
The Verify Output Principle: Every piece of AI-generated code should pass through an AI-generated but human-reviewed test suite before …
- Distinctive: line 37
Test behavior, not implementation details
- Distinctive: line 39
Use the AAA pattern: Arrange → Act → Assert
- Distinctive: line 41
Test edge cases: null, empty, boundary values, error paths
- Distinctive: line 75
Test the contract between components, not their internals
- Distinctive: line 76
Use a real (but isolated) database — not mocks
- Distinctive: line 78
Test API endpoints with realistic payloads
- Distinctive: line 96
Test request/response contracts
- Distinctive: line 97
Test authentication and authorization flows
- Distinctive: line 99
Test pagination and filtering
- Distinctive: line 106
Use Playwright for E2E testing — it supports all major browsers, has auto-wait built in, and works well with AI agent verification.
- Distinctive: line 151
Always mock external API calls in unit/integration tests:
“Common” is measured: kept by at least 6 in 10 of the 175 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Testing
Core Philosophy
AI-generated code is untrusted until it passes a human-reviewed test suite. Tests are not optional — they are the safety net that makes refactoring and agentic code generation safe. Treat test code with the same quality standards as production code.
The Verify Output Principle: Every piece of AI-generated code should pass through an AI-generated but human-reviewed test suite before being considered complete.
Test Pyramid
/\
/E2E\ ← Few, slow, high confidence
/------\
/Integr. \ ← Some, medium speed
/------------\
/ Unit Tests \ ← Many, fast, isolated
/------------------\- Unit tests — 70% of your suite. Fast, isolated, no external dependencies.
- Integration tests — 20%. Test how components work together.
- E2E tests — 10%. Test real user flows from browser to DB.
Unit Testing
Principles
- Test behavior, not implementation details
- One assertion concept per test
- Use the AAA pattern: Arrange → Act → Assert
- Mock all external dependencies (APIs, databases, file system)
- Test edge cases: null, empty, boundary values, error paths
Structure
describe('ComponentOrFunction', () => {
describe('methodName', () => {
it('should [expected behavior] when [condition]', () => {
// Arrange
const input = ...
// Act
const result = functionUnderTest(input)
// Assert
expect(result).toBe(expectedValue)
})
})
})What to Test
| Scenario | Priority |
| Happy path (expected behavior) | Must have |
| Edge cases (null, empty, boundary) | Must have |
| Error paths (exceptions, failures) | Must have |
| Invalid inputs | Must have |
| Performance-critical paths | Nice to have |
Integration Testing
Integration Principles
- Test the contract between components, not their internals
- Use a real (but isolated) database — not mocks
- Clean up test data after each test
- Test API endpoints with realistic payloads
Database Integration Tests
# Python example
def test_create_user_persists_to_db(db_session):
# Arrange
user_data = {"name": "James", "email": "james@test.com"}
# Act
user = create_user(db_session, user_data)
# Assert
saved = db_session.query(User).filter_by(id=user.id).first()
assert saved.email == "james@test.com"API Integration Tests
- Test request/response contracts
- Test authentication and authorization flows
- Test error responses (400, 401, 403, 404, 500)
- Test pagination and filtering
End-to-End (E2E) Testing
Tool Recommendation
Use Playwright for E2E testing — it supports all major browsers, has auto-wait built in, and works well with AI agent verification.
Selector Priority (Most to Least Robust)
getByRole()— ARIA roles (most resilient)getByText()— visible textgetByTestId()— data-testid attributesgetByLabel()— form labels- CSS selectors — (avoid, brittle)
E2E Test Structure
test('user can complete checkout flow', async ({ page }) => {
// Navigate
await page.goto('/products')
// Interact
await page.getByRole('button', { name: 'Add to Cart' }).first().click()
await page.getByRole('link', { name: 'Checkout' }).click()
// Fill form
await page.getByLabel('Email').fill('test@example.com')
// Assert
await expect(page.getByText('Order confirmed')).toBeVisible()
})What to Cover with E2E
- Critical user journeys (signup, login, core feature flows)
- Payment or checkout flows
- Authentication flows (login, logout, password reset)
- Error states visible to users
Mocking & Test Doubles
| Type | When to Use |
| Mock | Verify a function was called with specific arguments |
| Stub | Replace a function with a fixed return value |
| Spy | Observe calls without replacing behavior |
| Fake | Lightweight working implementation (e.g., in-memory DB) |
Mock External APIs
Always mock external API calls in unit/integration tests:
jest.mock('../services/paymentService', () => ({
chargeCard: jest.fn().mockResolvedValue({ success: true })
}))Test Coverage Guidelines
| Coverage Level | Meaning |
| < 60% | Dangerous — high risk of regressions |
| 60–80% | Acceptable for early-stage projects |
| 80–90% | Good — production ready |
| 90–95% | Excellent |
| > 95% | Diminishing returns — focus on quality not quantity |
Coverage doesn't equal quality. 95% coverage with weak assertions is worse than 80% coverage with strong assertions.
Testing AI-Generated Code
- Generate tests before or alongside the code — don't test after
- Review AI-generated tests critically — they often miss edge cases
- Add tests for every bug found — regression coverage
- Test the behavior described in the spec, not just what the code does
- Mutation testing — use tools like Stryker to verify tests actually catch bugs
Framework Quick Reference
| Language | Unit | Integration | E2E |
| TypeScript/JS | Jest / Vitest | Supertest + Jest | Playwright |
| Python | pytest | pytest + SQLAlchemy | Playwright |
| Java | JUnit 5 | Spring Boot Test | Playwright |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

