route-research-for-testing — Claude Code command: test API routes
route-research-for-testing is a Claude Code command that collects changed routes from the current session and tests them via cURL to check edited API endpoints.
MIT ★ 10,055 updated 2026-07-13
.claude/commands/route-research-for-testing.mdWhat route-research-for-testing does
The command scans .claude/tsc-cache logs for edited files, extracts those in /routes/, merges them with user-provided paths, and deduplicates. It resolves route prefixes by reading your app entry point (src/app.ts, src/server.ts, or similar). For each route, it builds a JSON record with path, HTTP method, expected request and response shapes, plus valid and invalid payload examples. Then it tests each route via cURL: sends a request with the right method and body, collects status codes and response shape, flags errors.
Requires a running dev server on localhost. You must know the port your app listens on and provide it when running tests.
What it helps with
- collect changed routes from the current session into one list
- merge auto-detected routes with user-provided paths
- test API endpoints with different HTTP methods and payloads
- generate a test report with status codes and errors
Example prompts for the agent
- Test all routes you edited in this session
- Test routes from /api/users and /api/posts
- Run tests with extra paths /custom/endpoint
How to install route-research-for-testing
Manually: put the files in place
.claude/commands/route-research-for-testing.mdCall it with /route-research-for-testing. For all projects use ~/.claude/commands/
Manually: put the files in place
~/.codex/prompts/route-research-for-testing.mdCall it with /prompts:route-research-for-testing. Codex marks this format deprecated in favour of skills
Manually: put the files in place
.github/prompts/route-research-for-testing.prompt.mdManually: put the files in place
.gemini/commands/route-research-for-testing.tomlGemini stores commands as TOML: the prompt text goes into the prompt field
Questions about route-research-for-testing
How do I install route-research-for-testing in Claude Code?
Copy .claude/commands/route-research-for-testing.md from diet103/claude-code-infrastructure-showcase into your project's .claude/commands folder.
What does route-research-for-testing do?
It identifies routes you changed in this session, generates test cases for each, and runs them via cURL. Returns status codes and any errors found.
What tools does this command need?
Uses cat, awk, grep, sort, xargs, and sed. Your dev server must be running on localhost; you provide the port.
Source text
route-research-for-testing.md · MIT
---
description: Map edited routes & launch tests
argument-hint: "[/extra/path …]"
allowed-tools: Bash(cat:*), Bash(awk:*), Bash(grep:*), Bash(sort:*), Bash(xargs:*), Bash(sed:*)
model: sonnet
---
## Context
Changed route files this session (auto-generated):
!cat "$CLAUDE_PROJECT_DIR/.claude/tsc-cache"/\*/edited-files.log \
| awk -F: '{print $2}' \
| grep '/routes/' \
| sort -u
User-specified additional routes: `$ARGUMENTS`
## Your task
Follow the numbered steps **exactly**:
1. Combine the auto list with `$ARGUMENTS`, dedupe, and resolve any prefixes
defined in your API entry point (e.g. `src/app.ts`, `src/server.ts`, or
wherever routes are registered).
2. For each final route, output a JSON record with the path, method, expected
request/response shapes, and valid + invalid payload examples.
3. **Now test each route** using cURL or your project's test script:
```bash
# For each route, test with appropriate method and payload
curl -X GET http://localhost:<YOUR_PORT>/api/route-path
curl -X POST -H "Content-Type: application/json" -d '{"key":"value"}' http://localhost:<YOUR_PORT>/api/route-path
```
Substitute `<YOUR_PORT>` with your project's actual dev server port.
Report results for each route: status code, response shape, and any errors found.
© diet103 · MIT · diet103/claude-code-infrastructure-showcase