Agent skill
test-repository
Guide for testing repository layer. Use when asked to test repositories or data access layer. Directs to implementation-specific testing skills.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/test-repository
SKILL.md
Test Repository
Important: We Test Implementations, Not Interfaces
Repository interfaces (I{Entity}Repository) define contracts but contain no logic to test. We test the implementations that fulfill these contracts.
When to Test
Test repository implementations after you have:
- Created the repository interface (
create-repositoryskill) - Implemented at least one concrete implementation
Which Skill to Use
| Implementation | Skill | Location |
|---|---|---|
| MockDB (in-memory) | test-mockdb-repository |
tests/repositories/{entity}.mockdb.repository.test.ts |
| MongoDB | test-mongodb-repository |
tests/repositories/{entity}.mongodb.repository.test.ts |
Testing Strategy
Each implementation should be tested to verify it correctly fulfills the interface contract:
- CRUD operations: create, findById, findAll, update, remove
- Query features: filtering, pagination, sorting, search
- Edge cases: not found returns null, delete non-existent returns false
- Implementation-specific: MongoDB indexes, MockDB in-memory behavior
See Also
test-mockdb-repository- Testing MockDB implementationstest-mongodb-repository- Testing MongoDB implementations (includes test infrastructure setup)
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?