This skill provides reusable patterns for testing authenticated HTTP routes (GET/POST/PUT/PATCH/DELETE) in a way that is repeatable, debuggable, and safe.
Purpose
Make route tests deterministic (same inputs 鈫?same observable results).
Prevent 鈥渨orks on my machine鈥?debugging loops by standardizing how URLs, auth, and verification are handled.
Ensure route changes are validated with both success and failure cases.
When to Use
Use this skill when:
Adding or modifying API endpoints
Debugging 401/403 authentication and authorization issues
Validating request/response contracts after refactors
Verifying side effects (DB writes, background jobs, notifications)
Preconditions (record these in workdocs)
Before testing, record:
Service base URL (host + port)
Route prefix (what the app mounts the router under)
If the service supports dev-only mock authentication:
Ensure it is strictly gated to development/test environments.
Document the required headers/env vars in workdocs, not SSOT.
Checklist
Identify the correct service and base URL
Confirm route prefix and construct the full URL
Prepare request body and headers
Acquire valid auth (or enable dev-only mock auth)
Test the success path
Test key failure paths:
invalid input (400)
missing/invalid auth (401)
insufficient permissions (403)
missing resource (404)
Verify side effects:
DB rows changed
monitoring events captured
logs show expected correlation/request ids
Debugging guide (common failures)
401 Unauthorized
Common causes:
Missing or malformed auth
Token expired or issued for the wrong audience/issuer
Cookie domain/path mismatch
Actions:
Re-acquire auth
Print and compare the raw request (headers/cookies)
Check server logs for auth middleware errors
403 Forbidden
Common causes:
Identity lacks required role/permission
Route guard configured incorrectly
Actions:
Verify required permissions and user roles
Add a minimal reproduction case and record it in workdocs
404 Not Found
Common causes:
Wrong prefix or route mount point
Service is not the one you think it is
Actions:
Check the route registration code (router mount)
Confirm the request hits the intended service
500 Internal Server Error
Actions:
Check structured logs and monitoring traces
Reduce the request to a minimal payload
Verify DB connectivity and configuration
Related
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: willyu1007-ai-first-template-route-testing-patterns3description: Route Tester4---5# Route Tester67This skill provides reusable patterns for testing authenticated HTTP routes (GET/POST/PUT/PATCH/DELETE) in a way that is repeatable, debuggable, and safe.89---1011## Purpose1213- Make route tests deterministic (same inputs 鈫?same observable results).14- Prevent 鈥渨orks on my machine鈥?debugging loops by standardizing how URLs, auth, and verification are handled.15- Ensure route changes are validated with both success and failure cases.1617---1819## When to Use2021Use this skill when:22- Adding or modifying API endpoints23- Debugging 401/403 authentication and authorization issues24- Validating request/response contracts after refactors25- Verifying side effects (DB writes, background jobs, notifications)2627---2829## Preconditions (record these in workdocs)3031Before testing, record:32- **Service base URL** (host + port)33- **Route prefix** (what the app mounts the router under)34- **Auth method** (cookie / bearer token / session / mTLS / API key)35- **Test identities** and required roles/permissions36- **Expected side effects** (tables, logs, monitoring events)3738Do not hardcode environment-specific details into long-term SSOT docs.3940---4142## Testing methods4344### Method 1: Dedicated test helper (recommended when present)4546If your repository provides a helper under `/scripts/` (or an ability surfaced via `ABILITY.md`), prefer it because it can:47- Acquire tokens/cookies48- Print an equivalent `curl` command49- Standardize logging and redaction5051### Method 2: Manual HTTP client (curl)5253Keep commands reproducible:5455```bash56curl -X POST "<BASE_URL><PREFIX>/your/route" \57 -H "Content-Type: application/json" \58 -H "Authorization: Bearer <TOKEN_IF_NEEDED>" \59 -b "<COOKIE_NAME>=<COOKIE_VALUE_IF_NEEDED>" \60 -d '{"example":"payload"}'61```6263### Method 3: Development-only mock auth (if supported)6465If the service supports dev-only mock authentication:66- Ensure it is strictly gated to `development`/`test` environments.67- Document the required headers/env vars in **workdocs**, not SSOT.6869---7071## Checklist72731. Identify the correct service and base URL742. Confirm route prefix and construct the full URL753. Prepare request body and headers764. Acquire valid auth (or enable dev-only mock auth)775. Test the success path786. Test key failure paths:79 - invalid input (400)80 - missing/invalid auth (401)81 - insufficient permissions (403)82 - missing resource (404)837. Verify side effects:84 - DB rows changed85 - monitoring events captured86 - logs show expected correlation/request ids8788---8990## Debugging guide (common failures)9192### 401 Unauthorized9394Common causes:95- Missing or malformed auth96- Token expired or issued for the wrong audience/issuer97- Cookie domain/path mismatch9899Actions:100- Re-acquire auth101- Print and compare the raw request (headers/cookies)102- Check server logs for auth middleware errors103104### 403 Forbidden105106Common causes:107- Identity lacks required role/permission108- Route guard configured incorrectly109110Actions:111- Verify required permissions and user roles112- Add a minimal reproduction case and record it in workdocs113114### 404 Not Found115116Common causes:117- Wrong prefix or route mount point118- Service is not the one you think it is119120Actions:121- Check the route registration code (router mount)122- Confirm the request hits the intended service123124### 500 Internal Server Error125126Actions:127- Check structured logs and monitoring traces128- Reduce the request to a minimal payload129- Verify DB connectivity and configuration130131---132133## Related134135---136> Converted and distributed by [TomeVault](https://tomevault.io/claim/willyu1007) — claim your Tome and manage your conversions.137<!-- tomevault:4.0:skill_md:2026-04-15 -->
Run npx skillmds@latest add tomevault-io/willyu1007-ai-first-template-route-testing-patterns 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.
Route Tester 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.