/insforge:insforge-debugfrom insforge
Diagnoses problems in InsForge projects using observability primitives (logs, metrics, DB health, advisor) for reactive failures and proactive audits.
Ships in insforge. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Diagnose problems in InsForge projects by combining the backend's observability primitives — logs, metrics, db-health, advisor, policies, metadata, error objects, deploy state, and AI assist. This skill provides:
references/)Always use npx -y @insforge/cli — never install the CLI globally.
When the user gives a concrete description (error message, failing URL, HTTP status), hand it to the InsForge debug agent. Unlike the other primitives, this one returns suggestions, not just observations — verify the diagnosis against the primitives it cites before acting on it.
npx -y @insforge/cli diagnose --ai "<issue description>"
See references/ai-assisted.md for when to use this first vs when to skip, and how to verify the output.
Each primitive is one independently-queryable observability surface backed by a distinct underlying data source. Real diagnoses are compositions of primitives.
All commands run via npx -y @insforge/cli .... The (command) shown next to each primitive is the actual CLI command — primitive names are concept labels, not CLI subcommand names (e.g., "DB health" is diagnose db, not diagnose db-health; "Policies" is db policies, not diagnose policies).
| Primitive (command) | What you see | Reference |
|---|---|---|
Logs (logs <source>; diagnose logs for cross-source aggregate) | Time-stream of events from 5 backend sources (insforge.logs / postgREST.logs / postgres.logs / function.logs / function-deploy.logs) | references/logs.md |
Metrics (diagnose metrics) | EC2 instance time-series (CPU / memory / disk / network) over 1h / 6h / 24h / 7d | references/metrics.md |
DB health (diagnose db) | Current Postgres state via 7 named checks (connections / slow-queries / bloat / size / index-usage / locks / cache-hit) | references/db-health.md |
Advisor (diagnose advisor --json) | Static-scan issues across 3 categories (security / performance / health) with ruleId / affectedObject / recommendation | references/advisor.md |
Policies (db policies) | Active RLS rules from pg_policies (USING / WITH CHECK per cmd per role) — returns all policies as a dump | references/policies.md |
Metadata (metadata --json) | Declarative backend state dump (auth config / tables / buckets / functions / AI models / realtime channels) | references/metadata.md |
| Error objects (no command — read SDK / HTTP response) | SDK error envelope + HTTP status — the routing table from a client-visible error to the right log source | references/error-objects.md |
Deploy state (deployments list + deployments status <id> --json + logs function-deploy.logs) | Frontend (Vercel) deployment history + per-deploy metadata, plus edge function deploy logs | references/deploy-state.md |
AI assist (diagnose --ai "<description>") | LLM agent that combines the other primitives — returns a diagnosis with suggestions | references/ai-assisted.md |
Each recipe is a primitive call sequence with one-line "look for X" at each step. Command syntax, flags, and deep interpretation are in the per-primitive references above.
{ data: null, error: { code, message } }PGRST*, route by prefix using the table in the reference.connections, locks, slow-queries) — only if the error suggests DB issue (PostgREST timeout, lock conflict).Same bug, two surfacings. Writes (INSERT / UPDATE / DELETE) fail loudly with 403. Reads (SELECT) fail silently with an empty array — PostgREST filters denied rows out instead of returning 403, so the request looks successful with zero rows. Diagnosis path is the same except step 1 only applies to the 403 variant.
postgREST.logs) — 403 variant only: find the policy violation event with table and role context. Empty-result variant: skip — no error is logged for silently-filtered rows.auth.uid() / requesting_user_id(); for third-party auth like Clerk/Auth0, is the provider registered as a JWT issuer?).db query "<sql>") — empty-result variant only: confirm rows that should be visible actually exist by querying as service role (not as the user): npx -y @insforge/cli db query "SELECT id, user_id FROM <table>". Distinguishes "RLS filtered everything" from "no matching data exists".insforge.logs) — find auth errors with timestamp and provider context.function.logs) — get the error stack and execution context.status: "active".npx -y @insforge/cli functions code <slug> — inspect the source for obvious issues.functions deploy failedfunction-deploy.logs) — find the build/push error.deployments deploy failed (Vercel)deployments list + status <id> --json) — read status, metadata.webhookEventType, and envVarKeys.npm run build — reproduce the same error locally for faster iteration.postgres.logs) — find the query text and timestamp.slow-queries, index-usage) — slow-queries only catches it while still running (>5s snapshot); check index-usage for a missing index. Already finished? advisor (--category performance --json) has the pg_stat_statements text + mean time; step 1 has the timestamp.--range 24h) — only a rising trend or OOM kills/restarts change the answer.
OOM evidence lives in postgres.logs as the crash-recovery aftermath ("terminating connection
because of crash of another server process" / "automatic recovery in progress").--range 1h) — confirm system-wide pressure (CPU / memory / disk).connections, locks, slow-queries.diagnose logs aggregate) — error patterns across sources at the spike timestamp.--severity critical) — pre-existing known issues that may explain the degradation.insforge.logs) — WebSocket errors and subscription failures.enabled: true.Retry-After header is returned. Don't waste time grepping logs.--range 1h) — overall backend load context.Route by URL subsystem before drilling:
| URL pattern | Drill into |
|---|---|
/api/database/records/... | logs (postgREST.logs → postgres.logs) + db-health (locks, slow-queries) |
/functions/<slug> | logs (function.logs) — function may be crash-looping |
/api/auth/... | logs (insforge.logs) |
| Any path during system-wide spike | metrics (--range 1h) |
504s across unrelated paths on a small instance: suspect OOM first. Intermittent gateway timeouts hitting database, auth, and functions alike are the classic out-of-memory signature on the smallest instance sizes: the kernel kills Postgres, every in-flight request times out at the gateway while crash recovery runs, and it repeats on the next load spike.
Fast path: npx -y @insforge/cli diagnose incident (Platform login required). The report is
built entirely on the cloud side — Prometheus scrape history, platform records, an outbound
database probe — so it works even while the instance is down or wedged, exactly when
diagnose logs stops answering. It returns a verdict (oom_likely,
platform_operation_in_progress, paused_or_suspended, metrics_stopped, down_unknown,
no_incident_detected) with the evidence and the recommended action; oom_likely already means
the restart/memory correlation checks below passed on the platform side.
If the command is unavailable (older CLI/backend, --api-key link mode), confirm manually in
logs (postgres.logs) via the crash-recovery aftermath — "terminating connection because of
crash of another server process" / "automatic recovery in progress" — time-correlated with the
5xx burst: recovery evidence alone only proves an unclean Postgres restart, so the timestamps
must line up before OOM becomes the leading diagnosis
(references/metrics.md). With that evidence the fix is headroom, not a
retry loop:
npx -y @insforge/cli projects upgrade-instance <type>
(nano → micro → small → medium → large → xl), or dashboard → Project Settings →
Compute & Disk. On the free plan, upgrade to a paid plan first, then pick the size. The
resize changes the bill and the CLI asks for interactive confirmation — get the user's
go-ahead first, then run unattended with the CLI-level --yes (the -y in npx -y is
npm's install flag, not the confirm-skip). The resize is async — poll projects get until
operation_status clears before declaring the incident resolved.Requires Platform login (
npx -y @insforge/cli login). Not available when the project is linked via--api-key— fall back todb-health+policies+metadatafor a manual audit in that case.
--severity critical first, then warnings.--category security) — focus on security issues; cross-verify with policies (RLS coverage) and metadata (auth config, public buckets, secret presence).--category performance) — cross-verify with db-health (slow-queries, index-usage, bloat).--category health) — cross-verify with metrics (resource trends over 7d).isResolved: true for each addressed ruleId.diagnose --ai "<error or URL>") — get a starting hypothesis.Some diagnoses end at an InsForge-side defect, not a project misconfiguration: a platform bug or regression, an SDK call that misbehaves, docs or a skill that contradict observed behavior, or a missing capability. A debug session is exactly where these get confirmed — report them while the evidence is in hand:
npx -y @insforge/cli feedback --json \
--type bug --component backend --area db \
--title "<one-line summary>" \
--detail "<what happened vs expected, minimal repro>" \
--command "<the failing call>" \
--error "<verbatim error from logs>" \
--workaround "<what you did instead>"
No login required; common PII patterns (emails, credential/key formats, public IPs, home-directory usernames) are redacted locally — pattern-based, so still keep user data out. Use --component sdk --language <lang> for SDK defects; --component docs or --component skills with --doc and --expected when documentation contradicts reality; --type feature-request when the finding is "not supported". Then continue the user's task with the workaround — never block on the report, and never file feedback for problems in the user's own app code or config. Full flag reference: the insforge-cli skill's Feedback section.
agents/openai.yaml (opens in a new tab)references/advisor.md (opens in a new tab)references/ai-assisted.md (opens in a new tab)references/db-health.md (opens in a new tab)references/deploy-state.md (opens in a new tab)references/error-objects.md (opens in a new tab)references/logs.md (opens in a new tab)references/metadata.md (opens in a new tab)references/metrics.md (opens in a new tab)references/policies.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub insforge/insforge-skills --plugin insforge4 skills in this plugin
/insforgeUse this skill when writing app code with InsForge or @insforge/sdk: database CRUD, auth, storage uploads/storage RLS, functions, OpenRouter AI, realtime, emails, Stripe or Razorpay payments, or pointing S3-compatible tooling (aws CLI, AWS SDKs, rclone, Terraform, boto3) at InsForge Storage. Trigger on requests like add auth, fetch data, upload files, make a bucket public, add checkout, sell subscriptions, or send email. For infrastructure, SQL migrations, CLI commands, or payment provider setup, use insforge-cli instead./insforge-cliUse this skill whenever someone needs a backend, or a task touches InsForge backend or cloud infrastructure through the InsForge CLI: projects, SQL, migrations, RLS policies, functions, storage, backups, deployments, compute, secrets, config, schedules, logs, diagnostics, advisor scans and suppressions, import/export, AI/OpenRouter setup and usage overview, Stripe/Razorpay payments, Apify web scraping / data sources, PostHog product analytics, backend branches, organization membership (invite, leave, delete), agent memory (remember/recall project facts and decisions), reporting InsForge-side bugs or doc discrepancies (feedback), or CLI docs. For app code with InsForge or @insforge/sdk, use the insforge app-integration skill instead./insforge-integrationsUse when wiring an external auth provider (Clerk, Auth0, WorkOS, Kinde, Stytch, Better Auth) into InsForge for JWT-based RLS, or when adding the OKX x402 payment facilitator for onchain pay-per-use billing.Other plugins' skills for the same job