Use this skill when contributing to InsForge's backend package. This is for maintainers editing backend routes, services, providers, auth, database logic, realtime, schedules, or backend tests in the InsForge monorepo.
Use this skill for backend/ work in the InsForge repository.
backend/src/api/**backend/src/services/**backend/src/providers/**backend/src/infra/**backend/tests/**Keep the route -> service -> provider/infra split intact.
Follow backend conventions.
.js import specifiers in TypeScript source.@insforge/shared-schemas when contracts cross packages.safeParse plus AppError for invalid input.successResponse.verifyAdmin, verifyUser, and verifyApiKey.any type. Prefer precise interfaces, schema-derived types, unknown, or constrained generics.backend/src/infra/database/migrations/.Write idempotent migrations. Every SQL migration must be safe to re-run.
CREATE TABLE IF NOT EXISTS, CREATE INDEX IF NOT EXISTS, ADD COLUMN IF NOT EXISTS.ALTER TABLE ... RENAME TO — it fails if the target name already exists. Wrap renames in a DO block that checks information_schema.tables for both source and target.DROP TRIGGER IF EXISTS before CREATE TRIGGER.DROP COLUMN behind information_schema.columns checks when the column may already be gone.ON CONFLICT or WHERE NOT EXISTS for seed INSERT statements.Preserve existing behavior around mutation flows.
Always write unit tests for new code.
tests/unit/redirect-url-whitelist-migration.test.ts for the pattern).cd backend && npm test.cd backend && npm testcd backend && npm run buildFor contract changes, also validate packages/shared-schemas/ and any affected dashboard consumers.