| name | autojudge-api-changes |
| description | Use when adding or modifying AutoJudge API routes, model classes, auth checks, MySQL-backed entity behavior, or API Jest coverage. Covers the route-model-helper-test workflow used in api/. |
| user-invocable | true |
| argument-hint | API route, model, or auth change to implement or review |
AutoJudge API Changes
Use this skill for backend work in api/.
What To Inspect First
- The mounted route in
api/app.js.
- The owning route file in
api/route/.
- The matching model class in
api/model/.
- The nearest unit or integration test in
api/tests/.
Workflow
- Keep transport logic in the route and persistence or relation logic in the model.
- Reuse
CustomError and existing auth middleware before introducing new status or auth patterns.
- Preserve the current JSON response style with a
message field and explicit status codes.
- Update the narrowest existing Jest coverage that proves the changed behavior.
- Validate with
cd api && npx jest --config jest.unit.config.mjs or cd api && NODE_ENV=test npx jest --config jest.integration.config.mjs, depending on the changed slice.
Notes
- Integration tests depend on MySQL and
NODE_ENV=test semantics.
- If a change needs Compose networking or service DNS names, validate in Docker or state that the check was not runnable.
- Use
AGENTS.md for shared repo commands and environment constraints.