Agent skill
di-mockable-services
Design injectable, mockable services (interfaces + composition root)
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/di-mockable-services
Metadata
Additional technical details for this skill
- stack
- node-react-next
- style
- solid-clean-code
SKILL.md
What I do
Je standardise la DI (injection de dépendances) et la conception mockable.
Core rules
- Écrire le contrat d'abord :
IUserApi,UserRepository, etc. - Les hooks/use-cases dépendent des interfaces.
- Les implémentations concrètes vivent dans
infra/. - Le seul endroit qui instancie l'infra est le
composition root.
Example (frontend service)
export interface IUserApi {
getById(id: string): Promise<UserDTO>;
}
export class UserApi implements IUserApi {
constructor(private readonly http: HttpClient) {}
getById(id: string) { return this.http.get(`/users/${id}`); }
}
export class FakeUserApi implements IUserApi {
async getById(id: string) { return { id, name: 'Test' }; }
}
Testing guidance
- En test, remplacer via le container :
container.userApi = new FakeUserApi(). - Éviter les mocks globaux non typés.
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?