Query correctness and filtering/pagination behavior
Transactional behavior (multi-write operations)
3. Common anti-patterns
Tests that depend on real clocks (use time injection or fakes)
Tests that require external services without a stable harness
"Golden" snapshots for dynamic responses without normalization
4. Checklist (before merging changes)
Service logic covered by unit tests
At least one integration test covers the route(s) you changed
Failure paths are tested (validation/auth/not found)
Monitoring/error capture behavior is testable where possible
Related Skills
architecture-overview
services-and-repositories
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: willyu1007-ai-first-template-testing-guide3description: Testing Guide4---56# Testing Guide78This skill provides a pragmatic testing strategy for backend services.910---1112## 1. Principles1314- Prefer **fast unit tests** for business logic (service layer).15- Use **integration tests** for routes and repositories when needed.16- Keep tests deterministic (fixed inputs, stable fixtures, clear assertions).1718---1920## 2. What to test by layer2122### Routes/controllers2324- HTTP status codes and response shape25- Input validation behavior (invalid input → 400)26- Auth/permission behavior (missing/invalid auth → 401/403)2728### Services2930- Business rules and edge cases31- Idempotency and invariants32- Error conditions (typed domain errors)3334### Repositories3536- Query correctness and filtering/pagination behavior37- Transactional behavior (multi-write operations)3839---4041## 3. Common anti-patterns4243- Tests that depend on real clocks (use time injection or fakes)44- Tests that require external services without a stable harness45- "Golden" snapshots for dynamic responses without normalization4647---4849## 4. Checklist (before merging changes)5051- [ ] Service logic covered by unit tests52- [ ] At least one integration test covers the route(s) you changed53- [ ] Failure paths are tested (validation/auth/not found)54- [ ] Monitoring/error capture behavior is testable where possible5556---5758## Related Skills5960- `architecture-overview`61- `services-and-repositories`6263---64> Converted and distributed by [TomeVault](https://tomevault.io/claim/willyu1007) — claim your Tome and manage your conversions.65<!-- tomevault:4.0:skill_md:2026-04-16 -->
Run npx skillmds@latest add tomevault-io/willyu1007-ai-first-template-testing-guide in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Testing Guide It is listed under Coding & Dev Tools on SkillMD.
This skill has not completed SkillMD's automated safety review yet. Independent scanners report: SkillSpector: PASS, Skill Scanner: PASS. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
tomevault-io (@tomevault-io) published this skill. Their other Agent Skills are listed on their SkillMD profile.