testing-patterns
Skill8 starsChanged 19 days agoMITView on GitHub
Test structure, fixtures, factories, and mocking conventions. Use when writing or reviewing tests, or files named test_*, *_test, *.test.*, or *.spec.*.
44 other projects use a version of this.
Adopted by
Most recently taken up by
- xsovad06/sovatheir own version, first seen Nov 8, 2026
- gopalparashar421/agent-skillstheir own version, first seen Nov 8, 2026
- soilmass/motion-design-agenttheir own version, first seen Nov 8, 2026
- seandkendall/kiro-configtheir own version, first seen Nov 1, 2026
- svngoku/coding-agents-skillstheir own version, first seen Nov 1, 2026
- piomin/claude-ai-spring-boottheir own version, first seen Oct 25, 2026
Used with
Projects with it also use intelligent-routing, bash-linux 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.
SKB3002Skillintelligent-routing
Automatic agent selection and intelligent task routing. Analyzes user requests and automatically selects the best specialist agent(s) without requiring explicit user mentions.
Also in 5 projects that use this
xenitV1Skillbash-linux
Bash/Linux terminal patterns. Critical commands, piping, error handling, scripting. Use when working on macOS or Linux systems.
Also in 6 projects that use this
xenitV1Skillred-team-tactics
Red team tactics principles based on MITRE ATT&CK. Attack phases, detection evasion, reporting.
Also in 6 projects that use this
ChrisWilesSkillformik-patterns
Formik form handling with validation patterns. Use when building forms, implementing validation, or handling form submission.
Also in 3 projects that use this
SKB3002Skillnextjs-react-expert
React and Next.js performance optimization from Vercel Engineering. Use when building React components, optimizing performance, eliminating waterfalls, reducing bundle size, reviewing code for performance issues, or implementing server/client-side optimizations.
Also in 3 projects that use this
adybaSkillsafe-workflow
SAFe Agentic Workflow orchestrator. Teaches the full SAFe methodology adapted for AI agents: pattern discovery, exit states, quality gates, agent personas, and specs-driven development. Use when setting up a project with SAFe workflow, understanding the multi-agent methodology, or coordinating work across agent personas. Triggers: "SAFe workflow", "agent workflow", "safe harness", "specs-driven", "exit states", "quality gates", "multi-agent workflow".
Also in 3 projects that use this
- +4 more from xenitV1
Other versions44 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 44
- vudovn/ag-kit★ 8.2ksame name
- vudovn/antigravity-kit★ 8.2ksame name
- ChrisWiles/claude-code-showcase★ 6.1ksame name
- ag2ai/faststream★ 5.4ksame name
- piomin/claude-ai-spring-boot★ 1.4ksame name
- bybren-llc/safe-agentic-workflow★ 405same name
- dilolabs/nosia★ 211same name
- xenitV1/Antigravity-Workflows★ 130same name
- langchain-ai/skills-benchmarks★ 116same name
- leather-io/mono★ 28same name
34 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 repository20 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- home/CLAUDE.mdCLAUDE.md
- run-claude-code-configSkill
- adrSkill
- api-designSkill
- commitSkill
- django-patternsSkill
- docker-patternsSkill
- eow-reviewSkill
- git-workflowSkill
- hotfixSkill
- infrastructureSkill
- laterSkill
- mkdocs-styleSkill
- project-setupSkill
- prSkill
- refinementSkill
- security-patternsSkill
- standupSkill
- statusSkill
The file
We split this skill into the rules it gives an agent
8 rules. 0 are common, 7 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 29 edited versions we read keep these.
7
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 12
Every test should follow the AAA pattern with clear visual separation:
- Distinctive: line 43
Test names should describe the scenario and expected outcome:
- Distinctive: line 57
Never hardcode IDs or timestamps -- use factories to generate them
- Very specific: line 63
Use fresh database transactions per test (Django: TestCase with automatic rollback)
- Distinctive: line 85
Don't chase 100% -- focus on meaningful assertions over line coverage
- Distinctive: line 90
Prefer dependency injection over patching
- Distinctive: line 91
Verify mock interactions only when the side effect IS the behavior
- Distinctive: line 92
Don't mock the thing you're testing
“Common” is measured: kept by at least 6 in 10 of the 29 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 Patterns
Apply these patterns when writing or reviewing tests.
Structure: Arrange-Act-Assert (AAA)
Every test should follow the AAA pattern with clear visual separation:
def test_user_creation_with_valid_data():
# Arrange
user_data = {"email": "test@example.com", "name": "Test User"}
# Act
user = UserService.create(user_data)
# Assert
assert user.email == "test@example.com"
assert user.is_active is Trueit("creates a user with valid data", () => {
// Arrange
const userData = { email: "test@example.com", name: "Test User" };
// Act
const user = UserService.create(userData);
// Assert
expect(user.email).toBe("test@example.com");
expect(user.isActive).toBe(true);
});Naming Convention
Test names should describe the scenario and expected outcome:
- Python:
test_<unit>_<scenario>_<expected_result> - TypeScript:
"<unit> <scenario> <expected result>"
Good: test_login_with_invalid_password_returns_401
Bad: test_login, test_case_1
Test Data
Use Factories (not fixtures for mutable data)
- Python:
factory_boyor custom factory functions - TypeScript: builder pattern or factory functions
- Never hardcode IDs or timestamps -- use factories to generate them
- Share setup via factory defaults, override per-test as needed
Isolation
- Each test must be independent -- no shared mutable state
- Use fresh database transactions per test (Django:
TestCasewith automatic rollback) - Mock external services at the boundary (HTTP, email, queues)
What to Test
Must Test
- Happy path for every public function/endpoint
- Error/edge cases: null inputs, empty collections, boundary values
- Authorization: ensure protected routes reject unauthorized access
- Validation: verify invalid input is rejected with correct errors
Don't Test
- Private/internal methods directly (test through public interface)
- Framework code (Django ORM, React rendering engine)
- Trivial getters/setters with no logic
Coverage Expectations
- New code: aim for 80%+ line coverage
- Critical paths (auth, payments, data mutations): 95%+
- Don't chase 100% -- focus on meaningful assertions over line coverage
Mocking Guidelines
- Mock at boundaries: HTTP clients, databases, file systems, clocks
- Prefer dependency injection over patching
- Verify mock interactions only when the side effect IS the behavior
- Don't mock the thing you're testing
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.

