standards-testing
Skill0 starsChanged 4 months agoMITView on GitHub
Use this skill whenever you write or review unit, integration, or end-to-end tests, including test structure, isolation, fakes, and behavior-focused assertions, even when the user only asks for a quick test. Use role-qa-engineer for broader strategy, coverage planning, and edge-case analysis, and standards-go-testing for Go specifics.
In this repository34 other files it gives its agents.
- AGENTS.mdAGENTS.md
- mcpSkill
- pattern-orchestration-complexSkill
- pattern-task-breakdownSkill
- role-architectSkill
- role-code-reviewSkill
- role-data-engineerSkill
- role-developerSkill
- role-orchestratorSkill
- role-product-engineerSkill
- role-qa-engineerSkill
- role-security-auditorSkill
- role-site-reliability-engineerSkill
- role-technical-writerSkill
- standards-analysisSkill
- standards-api-designSkill
- standards-codeSkill
- standards-databaseSkill
- standards-documentationSkill
- standards-go-concurrencySkill
- standards-go-performanceSkill
- standards-goSkill
- standards-go-testingSkill
- standards-markdownSkill
- standards-observabilitySkill
- standards-pulumi-typescriptSkill
- standards-pythonSkill
- standards-securitySkill
- standards-shellSkill
- standards-skill-authoringSkill
- standards-typescriptSkill
- tool-storeSkill
- workflow-debuggingSkill
- workflow-pi-extensionSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
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
Golden Rule: If you can't test it easily, refactor it
- Distinctive: line 32
Independent tests: No shared state, run in any order
- Distinctive: line 132
Golden Rule: If you can't test it easily, refactor it.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Testing Standards
Provides: AAA pattern (Arrange-Act-Assert) structure, coverage goals, test level guidance, and testing checklists.
Quick Reference
Golden Rule: If you can't test it easily, refactor it
AAA Pattern: Arrange → Act → Assert
Test (✅ DO):
- Happy path, edge cases, error cases
- Business logic, public APIs
Don't Test (❌ DON'T):
- Third-party libraries, framework internals
- Simple getters/setters, private details
Coverage: Critical (100%), High (90%+), Medium (80%+)
Principles
Test behavior, not implementation: Focus on what code does, not how Keep tests simple: One assertion per test, clear names, minimal setup Independent tests: No shared state, run in any order Fast and reliable: Quick execution, no flaky tests, deterministic
Test Structure (AAA Pattern)
test('calculateTotal returns sum of item prices', () => {
// Arrange - Set up test data
const items = [{ price: 10 }, { price: 20 }, { price: 30 }];
// Act - Execute code
const result = calculateTotal(items);
// Assert - Verify result
expect(result).toBe(60);
});What to Test
✅ DO Test
- Happy path (normal usage)
- Edge cases (boundaries, empty, null, undefined)
- Error cases (invalid input, failures)
- Business logic (core functionality)
- Public APIs (exported functions)
❌ DON'T Test
- Third-party libraries
- Framework internals
- Simple getters/setters
- Private implementation details
Coverage Goals
- Critical: Business logic, data transformations (100%)
- High: Public APIs, user-facing features (90%+)
- Medium: Utilities, helpers (80%+)
- Low: Simple wrappers, configs (optional)
Testing Pure Functions
function add(a, b) { return a + b; }
test('add returns sum', () => {
expect(add(2, 3)).toBe(5);
expect(add(-1, 1)).toBe(0);
expect(add(0, 0)).toBe(0);
});Testing with Dependencies
// Testable with dependency injection
function createUserService(database) {
return {
getUser: (id) => database.findById('users', id)
};
}
// Test with mock
test('getUser retrieves from database', () => {
const mockDb = {
findById: jest.fn().mockReturnValue({ id: 1, name: 'John' })
};
const service = createUserService(mockDb);
const user = service.getUser(1);
expect(mockDb.findById).toHaveBeenCalledWith('users', 1);
expect(user).toEqual({ id: 1, name: 'John' });
});Test Naming
// ✅ Good: Descriptive, clear expectation
test('calculateDiscount returns 10% off for premium users', () => {});
test('validateEmail returns false for invalid format', () => {});
test('createUser throws error when email exists', () => {});
// ❌ Bad: Vague, unclear
test('it works', () => {});
test('test user', () => {});Best Practices
✅ Test one thing per test ✅ Use descriptive test names ✅ Keep tests independent ✅ Mock external dependencies ✅ Test edge cases and errors ✅ Make tests readable ✅ Run tests frequently ✅ Fix failing tests immediately
Golden Rule: If you can't test it easily, refactor it.
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.

