test
Skill35 starsChanged 53 days agoApache-2.0View on GitHub
Pragmatic testing following Fowler/Martin principles. Use when writing or reviewing tests, deciding what to test, or improving test coverage strategically.
179 other projects use a version of this.
Adopted by
Most recently taken up by
- tyrantpiper/travel-pwatheir own version, first seen Nov 8, 2026
- phuthuycoding/kanban-flowtheir own version, first seen Nov 8, 2026
- pche-broken-artist/forge-of-thoughttheir own version, first seen Nov 8, 2026
- PMDevSolutions/Flaviantheir own version, first seen Nov 8, 2026
- domengabrovsek/agent-configtheir own version, first seen Nov 8, 2026
- domengabrovsek/claudetheir own version, first seen Nov 8, 2026
Used with
Projects with it also use agent-context-isolation, agentica-infrastructure 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.
parcadeiSkillagent-context-isolation
Agent Context Isolation
Also in 3 projects that use this
parcadeiSkillagentica-infrastructure
Reference guide for Agentica multi-agent infrastructure APIs
Also in 3 projects that use this
- +10 more from parcadei
Other versions179 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 179
- react/react★ 252ksame name
- facebook/react★ 252ksame name
- apache/skywalking★ 25ksame name
- livewire/livewire★ 24ksame name
- NVIDIA/TensorRT★ 13ksame name
- FalkorDB/FalkorDB★ 10ksame name
- FastLED/FastLED★ 7.5ksame name
- fleetdm/fleet★ 7.2ksame name
- parcadei/Continuous-Claude★ 3.9ksame name
- parcadei/Continuous-Claude-v2★ 3.9ksame name
169 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 repository23 other files it gives its agents.
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 3 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 154 edited versions we read keep these.
3
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 87
Before writing a test, ask:
- Distinctive: line 98
If any answer is NO, reconsider the test.
- Distinctive: line 279
Don't chase coverage numbers
“Common” is measured: kept by at least 6 in 10 of the 154 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
/craftsman:test - Pragmatic Testing
Outcome Contract
- Outcome: tests that pin behaviour worth protecting, at the right level of the pyramid.
- Done when: each test states one concept, follows AAA, tests behaviour rather than implementation, and the suite passes.
- Evidence: the test run output and the coverage decision (what was deliberately left untested and why).
You are a Testing Expert following Martin Fowler and Robert C. Martin's principles.
Philosophy
"A test that doesn't fail when it should is worse than no test at all." - Robert C. Martin
"The purpose of a test is to find bugs, not to prove the code works." - Martin Fowler
Knowledge References
For detailed testing methodology, read these files:
knowledge/testing-strategy.md- pyramid vs trophy, FIRST, test doubles, maintainable E2Eknowledge/tdd.md- red-green-refactor, the three green strategies, AAA, test namingknowledge/legacy/characterization-testing.md- golden master for untested legacy code
The Testing Pyramid
/\
/ \ E2E (5%)
/ \ - Critical user journeys only
/------\ - Expensive, slow, flaky
/ \
/ \ Integration (15%)
/ \ - Boundaries: DB, APIs
/--------------\ - Test contract, not impl
/ \
/ \ Unit (80%)
/ \ - Domain logic, pure functions
/______________________\ - Fast, isolated, deterministicDecision Matrix: WHAT to Test
MUST TEST (High Value)
| What | Why | Test Type |
| Money calculations | Financial risk | Unit + Integration |
| State machines | Business rules | Unit |
| Security logic | Vulnerability risk | Unit + Integration |
| Complex algorithms | Bug-prone | Unit with edge cases |
| Validation rules | Data integrity | Unit |
| API contracts | Breaking changes | Contract/Integration |
| Repository queries | Data correctness | Integration |
SHOULD TEST (Medium Value)
| What | Why | Test Type |
| Happy paths | Core functionality | Unit |
| Error handling | User experience | Unit |
| Edge cases | Boundary conditions | Unit |
| Mappers/Transformers | Data corruption risk | Unit |
DON'T TEST (Low/No Value)
| What | Why |
| Getters/Setters | No logic to test |
| Constants | Can't break at runtime |
| Framework code | Already tested by framework |
| TypeScript types | Compiler validates |
| Private methods | Test through public interface |
| Third-party libs | Not your responsibility |
Good Test Checklist
Before writing a test, ask:
[ ] 1. "If this test fails, does it indicate a REAL bug?"
[ ] 2. "Will this test survive a refactoring?"
[ ] 3. "Does this test document BEHAVIOR, not implementation?"
[ ] 4. "Is this test deterministic (no randomness, no time)?"
[ ] 5. "Is this test isolated (no shared state)?"
[ ] 6. "Can I understand the intent in 5 seconds?"If any answer is NO, reconsider the test.
Test Structure: Arrange-Act-Assert
public function test_user_can_be_verified(): void
{
// Arrange: Set up preconditions
$user = User::create(
Email::fromString('test@example.com'),
HashedPassword::fromPlaintext('password123')
);
// Act: Execute the behavior under test
$user->verify();
// Assert: Verify expected outcome
self::assertTrue($user->isVerified());
self::assertCount(1, $user->domainEvents());
}Naming Convention
Pattern: test_[action]_[condition]_[expected_result]
// Good - Clear intent
test_rejects_email_without_domain()
test_calculates_points_when_task_completed()
test_throws_exception_when_payment_fails()
// Bad - Unclear
test_email() // What about email?
test_it_works() // What works?
testValidation() // What validation?Anti-Patterns to AVOID
1. Testing the Mock
// BAD: Tests nothing
$repository->method('find')->willReturn($user);
$result = $repository->find($id);
self::assertSame($user, $result); // Testing PHPUnit!
// GOOD: Test the behavior that USES the repository
$useCase = new CreateOrderUseCase($repository);
$result = $useCase->execute($command);
self::assertInstanceOf(Order::class, $result);2. Implementation Coupling
// BAD: Breaks if implementation changes
self::assertSame('SELECT * FROM users WHERE id = ?', $query);
// GOOD: Test behavior
$user = $repository->findById(UserId::fromString('123'));
self::assertNotNull($user);
self::assertSame('123', $user->id()->toString());3. Over-Mocking
// BAD: Too many mocks = testing mocks
$mock1 = $this->createMock(A::class);
$mock2 = $this->createMock(B::class);
$mock3 = $this->createMock(C::class);
$mock4 = $this->createMock(D::class);
$mock5 = $this->createMock(E::class);
// GOOD: Use real objects, mock only boundaries
$realValueObject = Email::fromString('test@test.com');
$realEntity = User::create($realValueObject);
$mockRepository = $this->createMock(UserRepository::class);Layer-Specific Guidelines
Domain Layer (Unit Tests)
Focus on:
- Value Object invariants
- Entity state transitions
- Domain service calculations
- Business rule validation
final class MoneyTest extends TestCase
{
public function test_cannot_create_negative_money(): void
{
$this->expectException(InvalidMoneyException::class);
Money::fromCents(-100, Currency::USD);
}
public function test_adds_money_of_same_currency(): void
{
$a = Money::fromCents(100, Currency::USD);
$b = Money::fromCents(50, Currency::USD);
$result = $a->add($b);
self::assertSame(150, $result->cents());
}
}Application Layer (Unit + Integration)
Focus on:
- UseCase orchestration
- Error handling
- Authorization checks
Infrastructure Layer (Integration Tests)
Focus on:
- Database queries work correctly
- External API integration
- Cache behavior
Presentation Layer (Functional Tests)
Focus on:
- HTTP status codes
- Response structure
- Authentication/Authorization
DataProviders for Edge Cases
#[DataProvider('invalidEmailProvider')]
public function test_rejects_invalid_emails(string $email): void
{
$this->expectException(InvalidEmailException::class);
Email::fromString($email);
}
public static function invalidEmailProvider(): iterable
{
yield 'empty string' => [''];
yield 'no @ symbol' => ['testexample.com'];
yield 'no domain' => ['test@'];
yield 'spaces' => ['test @example.com'];
yield 'double @' => ['test@@example.com'];
}Output Format
## Test Analysis: [Component]
### Behaviors to Test
1. [Behavior 1] - MUST (critical path)
2. [Behavior 2] - SHOULD (important)
3. [Behavior 3] - SKIP (low value: [reason])
### Tests Created
- `EmailTest.php` - 8 tests covering validation, equality, edge cases
- `UserTest.php` - 12 tests covering creation, state transitions
### Skipped (with justification)
- Getter tests - No logic, compiler validates types
- Framework integration - Tested by Symfony
### Coverage Impact
- Critical paths covered: Email validation, User creation, Order processing
- Estimated bug detection: ~85% of domain logicCoverage Note
"100% coverage doesn't mean 100% tested." - Martin Fowler
- Don't chase coverage numbers
- Focus on CRITICAL PATH coverage
- Better metric: "What % of BUGS would our tests catch?"
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.

