Phase 1: DISCOVER
Sub-Agent: APIScout (model: haiku)
- Tools: Grep, Glob, Read
- Prompt: Find all routes in src/server.js and src/routes/. List handlers, middleware. Find missing validation or error handling patterns.
- Output:
{ endpoints[], handlers[], missing_validation[], missing_error_format[] }
- Gate: endpoints listed
Phase 2: PLAN
Sub-Agent: BackendPlanner (model: sonnet)
- Prompt: Design which endpoints to add/modify. For each: validation rules, error format, retry config, logging. Create checklist.
- Output:
{ endpoint_plan[{path, method, validation, errors, retry}], checklist[] }
- Gate: plan has >= 1 endpoint
Phase 3: IMPLEMENT
Sub-Agent: RouteBuilder (model: haiku)
- Tools: Read, Write, Edit, Bash
- Prompt: Implement ONE endpoint at a time. Order: validation → handler → error format → logging. Copy-paste error template from skill (never invent). Run
npm test after each edit.
- Output:
{ endpoint, files_changed[], test_pass: boolean }
- Gate: endpoint works AND test passes
Phase 4: VERIFY
Sub-Agent: APITester (model: haiku)
- Tools: Bash, Read
- Prompt: Run
npm test. Restart server (pkill -f "node src/server"; sleep 2; npm start &). Test happy/error/retry paths. Verify health: curl http://localhost:3000/health.
- Output:
{ test_output, endpoints_verified[], health_ok: boolean, coverage }
- Gate: all endpoints respond correctly AND health returns 200
Phase 5: DELIVER
Sub-Agent: BackendPackager (model: haiku)
- Prompt: Update CHANGELOG. Commit. Notify user: server status, endpoints added, health check result.
- Output:
{ commit_sha, server_status, health_ok, endpoints_added[] }
- Gate: committed AND health verified
Contingency
IF endpoint breaks existing tests → contingency L1 (fix that endpoint only). IF health check fails after restart → check server logs, fix, retry (max 2).
Live Feedback Handler
IF user reports "API returns 500" or "endpoint broken" → classify as High → hotfix the specific route → restart server → verify health → notify user "Fixed. Refresh."
Server Lifecycle
MUST restart server after ANY file edit in src/. Express does not hot-reload. Always verify with curl http://localhost:3000/health after restart.
Backend Engineer Skill
Purpose: Enable backend domain expertise for production APIs and server logic.
When to use: Creating or reviewing backend features, API routes, handlers, pipeline logic, or external integrations.
Project customization: Add .claude/skills/backend-engineer/PROJECT.md with project-specific rules (route patterns, error format, validation schemas). See docs/SKILLSETS.md → "Add Skills to Customize FE/BE".
Create → Handle → Run (E2E)
Create
- Add routes in
src/server.js or src/routes/
- Add pipeline logic in
src/local-pipeline.js
- Add custom skills in
src/custom-skills/
- Validate inputs, add retry/timeout for externals
- Structure errors: type, message, traceId, suggestion, retryable
Handle
- Every endpoint: validation → processing → response
- External calls: retry with backoff, timeout, fallback
- Log critical ops with structured format
- Ensure every new endpoint reachable from UI
Run
npm test # Must pass
npm start # Server on :3000
curl http://localhost:3000/health
- Restart server after backend changes (no hot-reload)
- Verify health endpoint
- Test error paths (400, 403, 404, 503)
- Capture test output for CONFIDENCE_SCORE
Domain Expertise
As a backend engineer with this skill, you are expert in:
- Express/Node.js patterns
- Request validation and error responses
- Retry with exponential backoff
- Timeout control
- Structured logging
- Idempotency for unsafe operations
- Graceful degradation
Must-Do Checklist
1. Validation
Every endpoint must:
- Validate required fields and types
- Return
400 + message for invalid input
- Return
403 for unauthorized
- Return
404 if resource missing
- Validate state before transitions
2. Error Format
Every error must include:
{
error: 'error_code_name',
message: 'User-friendly message',
traceId: 'trace-xxx', // when available
status: 400|403|404|500|503,
suggestion: 'What to do next',
retryable: true|false,
retryAfter: 2 // seconds, if retryable
}
3. External Calls
- Retry with exponential backoff (max 2 retries)
- Timeout (default 60s)
- Graceful fallback on failure
4. Structured Logging
logger.info('operation_name', {
traceId, userId, input: sanitizedInput, timestamp
});
5. Idempotency
For unsafe operations, use request ID to prevent double-processing.
6. API Surface
- Every supported endpoint must be reachable from the UI
- Restart server after backend changes (no hot-reload)
- Verify with
curl http://localhost:3000/health
File Locations
| Type |
Path |
| Server |
src/server.js |
| Routes |
src/routes/ or inline in server |
| Pipeline |
src/local-pipeline.js |
| Custom skills |
src/custom-skills/ |
Related Skills
backend-reliability – Full reliability checklist
evidence-proof – Run tests before claiming done
Verification
Before claiming done:
Source: jimmymalhan/codereview-pilot — distributed by TomeVault.
1---2name: jimmymalhan-codereview-pilot-backend-engineer3description: Phase 1: DISCOVER4---56## Phase 1: DISCOVER7### Sub-Agent: `APIScout` (model: haiku)8- **Tools**: Grep, Glob, Read9- **Prompt**: Find all routes in src/server.js and src/routes/. List handlers, middleware. Find missing validation or error handling patterns.10- **Output**: `{ endpoints[], handlers[], missing_validation[], missing_error_format[] }`11- **Gate**: endpoints listed1213## Phase 2: PLAN14### Sub-Agent: `BackendPlanner` (model: sonnet)15- **Prompt**: Design which endpoints to add/modify. For each: validation rules, error format, retry config, logging. Create checklist.16- **Output**: `{ endpoint_plan[{path, method, validation, errors, retry}], checklist[] }`17- **Gate**: plan has >= 1 endpoint1819## Phase 3: IMPLEMENT20### Sub-Agent: `RouteBuilder` (model: haiku)21- **Tools**: Read, Write, Edit, Bash22- **Prompt**: Implement ONE endpoint at a time. Order: validation → handler → error format → logging. Copy-paste error template from skill (never invent). Run `npm test` after each edit.23- **Output**: `{ endpoint, files_changed[], test_pass: boolean }`24- **Gate**: endpoint works AND test passes2526## Phase 4: VERIFY27### Sub-Agent: `APITester` (model: haiku)28- **Tools**: Bash, Read29- **Prompt**: Run `npm test`. Restart server (`pkill -f "node src/server"; sleep 2; npm start &`). Test happy/error/retry paths. Verify health: `curl http://localhost:3000/health`.30- **Output**: `{ test_output, endpoints_verified[], health_ok: boolean, coverage }`31- **Gate**: all endpoints respond correctly AND health returns 2003233## Phase 5: DELIVER34### Sub-Agent: `BackendPackager` (model: haiku)35- **Prompt**: Update CHANGELOG. Commit. Notify user: server status, endpoints added, health check result.36- **Output**: `{ commit_sha, server_status, health_ok, endpoints_added[] }`37- **Gate**: committed AND health verified3839## Contingency40IF endpoint breaks existing tests → contingency L1 (fix that endpoint only). IF health check fails after restart → check server logs, fix, retry (max 2).4142## Live Feedback Handler43IF user reports "API returns 500" or "endpoint broken" → classify as High → hotfix the specific route → restart server → verify health → notify user "Fixed. Refresh."4445## Server Lifecycle46MUST restart server after ANY file edit in src/. Express does not hot-reload. Always verify with `curl http://localhost:3000/health` after restart.4748---4950# Backend Engineer Skill5152**Purpose**: Enable backend domain expertise for production APIs and server logic.5354**When to use**: Creating or reviewing backend features, API routes, handlers, pipeline logic, or external integrations.5556**Project customization**: Add `.claude/skills/backend-engineer/PROJECT.md` with project-specific rules (route patterns, error format, validation schemas). See docs/SKILLSETS.md → "Add Skills to Customize FE/BE".5758## Create → Handle → Run (E2E)5960### Create61- Add routes in `src/server.js` or `src/routes/`62- Add pipeline logic in `src/local-pipeline.js`63- Add custom skills in `src/custom-skills/`64- Validate inputs, add retry/timeout for externals65- Structure errors: type, message, traceId, suggestion, retryable6667### Handle68- Every endpoint: validation → processing → response69- External calls: retry with backoff, timeout, fallback70- Log critical ops with structured format71- Ensure every new endpoint reachable from UI7273### Run74```bash75npm test # Must pass76npm start # Server on :300077curl http://localhost:3000/health78```79- Restart server after backend changes (no hot-reload)80- Verify health endpoint81- Test error paths (400, 403, 404, 503)82- Capture test output for CONFIDENCE_SCORE8384## Domain Expertise8586As a backend engineer with this skill, you are expert in:87- Express/Node.js patterns88- Request validation and error responses89- Retry with exponential backoff90- Timeout control91- Structured logging92- Idempotency for unsafe operations93- Graceful degradation9495## Must-Do Checklist9697### 1. Validation98Every endpoint must:99- Validate required fields and types100- Return `400` + message for invalid input101- Return `403` for unauthorized102- Return `404` if resource missing103- Validate state before transitions104105### 2. Error Format106Every error must include:107```javascript108{109 error: 'error_code_name',110 message: 'User-friendly message',111 traceId: 'trace-xxx', // when available112 status: 400|403|404|500|503,113 suggestion: 'What to do next',114 retryable: true|false,115 retryAfter: 2 // seconds, if retryable116}117```118119### 3. External Calls120- Retry with exponential backoff (max 2 retries)121- Timeout (default 60s)122- Graceful fallback on failure123124### 4. Structured Logging125```javascript126logger.info('operation_name', {127 traceId, userId, input: sanitizedInput, timestamp128});129```130131### 5. Idempotency132For unsafe operations, use request ID to prevent double-processing.133134### 6. API Surface135- Every supported endpoint must be reachable from the UI136- Restart server after backend changes (no hot-reload)137- Verify with `curl http://localhost:3000/health`138139## File Locations140141| Type | Path |142|------|------|143| Server | `src/server.js` |144| Routes | `src/routes/` or inline in server |145| Pipeline | `src/local-pipeline.js` |146| Custom skills | `src/custom-skills/` |147148## Related Skills149150- `backend-reliability` – Full reliability checklist151- `evidence-proof` – Run tests before claiming done152153## Verification154155Before claiming done:156- [ ] All inputs validated157- [ ] All errors have type, message, suggestion158- [ ] External calls have retry + timeout159- [ ] Structured logging for critical ops160- [ ] `npm test` passes161- [ ] Health endpoint verified162- [ ] Every new endpoint reachable from UI163- [ ] Aligns with `.claude/rules/backend.md` and `backend-proof.md`164165---166> Source: [jimmymalhan/codereview-pilot](https://github.com/jimmymalhan/codereview-pilot) — distributed by [TomeVault](https://tomevault.io).167<!-- tomevault:4.0:skill_md:2026-05-22 -->