[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M75ENM4YX2JGXXQY7XSCN7JB":3,"skill-same:01M75ENM4YX2JGXXQY7XSCN7JB":51},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":28,"commitSha":29,"skillDirectory":30,"forksCount":31,"repositoryHtmlUrl":32,"repositoryHomepageUrl":33,"ownerHtmlUrl":34,"ownerBlogUrl":35,"ownerDescription":6,"updatedAt":36,"install":37,"resources":50},"01M75ENM4YX2JGXXQY7XSCN7JB","insforge-debug",null,"Use this skill when encountering errors, bugs, performance issues, or unexpected behavior in an InsForge project — from frontend SDK errors to backend infrastructure problems. Trigger on: SDK returning error objects, HTTP 4xx\u002F5xx responses, edge function failures or timeouts, slow database queries, authentication\u002Fauthorization failures, realtime channel issues, backend performance degradation (high CPU\u002Fmemory\u002Fslow responses), edge function deploy failures, or frontend Vercel deploy failures. This skill guides diagnostic command execution to locate problems. The manual scenarios surface logs\u002Fstatus only; the AI-assisted path (`diagnose --ai`) additionally returns suggested causes and solutions.","agisota\u002Fold-one","agisota","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F121413592?v=4","01M75B4BRNT67EC1NDRT8QZEP2","01M75B4BS7QR9VP580MSCPTS3X",3,"MIT","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Finsforge-debug\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: insforge-debug\ndescription: >-\n  Use this skill when encountering errors, bugs, performance issues, or\n  unexpected behavior in an InsForge project — from frontend SDK errors\n  to backend infrastructure problems. Trigger on: SDK returning error objects,\n  HTTP 4xx\u002F5xx responses, edge function failures or timeouts, slow database\n  queries, authentication\u002Fauthorization failures, realtime channel issues,\n  backend performance degradation (high CPU\u002Fmemory\u002Fslow responses),\n  edge function deploy failures, or frontend Vercel deploy failures.\n  This skill guides diagnostic command execution to locate problems.\n  The manual scenarios surface logs\u002Fstatus only; the AI-assisted path\n  (`diagnose --ai`) additionally returns suggested causes and solutions.\nlicense: MIT\nmetadata:\n  author: insforge\n  version: \"1.0.0\"\n  organization: InsForge\n  date: March 2026\n---\n\n# InsForge Debug\n\nDiagnose problems in InsForge projects — from frontend SDK errors to backend infrastructure issues. This skill helps you **locate** problems by running the right commands and surfacing logs\u002Fstatus. The manual scenarios below locate problems without suggesting fixes; the [AI-assisted path](#ai-assisted-diagnosis-fastest-path) additionally returns suggested causes and solutions.\n\n**Always use `npx @insforge\u002Fcli`** — never install the CLI globally.\n\n## AI-Assisted Diagnosis (Fastest Path)\n\nWhen the user gives a concrete description of the problem (error message, failing URL, HTTP status), hand it to the InsForge debug agent. It inspects backend state on its own and returns a diagnosis plus possible solutions.\n\n```bash\nnpx @insforge\u002Fcli diagnose --ai \"\u003Cissue description>\"\n```\n\n**When to use this path first**:\n- The user pastes an error, request URL, or status code and asks \"why?\"\n- You want a fast first pass before drilling into the manual scenarios below\n- The problem spans multiple subsystems (frontend + backend + database) and you're not sure where to start\n\n**Examples**:\n\n```bash\n# Edge function error\nnpx @insforge\u002Fcli diagnose --ai \"I invoked edge function https:\u002F\u002Fkttprzh4.functions.insforge.app\u002Fnewton, got error: 508: Loop Detected (LOOP_DETECTED)\\n\\nRecursive requests to the same deployment cannot be processed.\"\n\n# Slow database query\nnpx @insforge\u002Fcli diagnose --ai \"I query data with https:\u002F\u002Fkttprzh4.us-west.insforge.app\u002Fapi\u002Fdatabase\u002Frecords\u002Forder_customer_details?select=*&order=total_amount.desc, it costs 1.4s, why?\"\n\n# Unresponsive backend \u002F 504\nnpx @insforge\u002Fcli diagnose --ai \"my backend is unresponsive, request https:\u002F\u002Fkttprzh4.us-west.insforge.app\u002Fapi\u002Fdatabase\u002Frecords\u002Ftodo?select=*&order=created_at.desc got 504 error, why?\"\n```\n\nUnlike the other commands in this skill, `diagnose --ai` returns both a diagnosis and suggested solutions. Relay them to the user as a starting point, but verify against the underlying logs\u002Fmetrics (the scenarios below) before committing to a fix.\n\n## Quick Triage\n\nMatch the symptom to a scenario, then follow that scenario's steps.\n\n| Symptom | Scenario |\n|---------|----------|\n| SDK returns `{ data: null, error: {...} }` | [#1 SDK Error](#scenario-1-sdk-returns-error-object) |\n| HTTP 400 \u002F 401 \u002F 403 \u002F 404 \u002F 429 \u002F 500 | [#2 HTTP Status Code](#scenario-2-http-status-code-anomaly) |\n| Function throws or times out | [#3 Edge Function Failure](#scenario-3-edge-function-execution-failuretimeout) |\n| Query slow or hangs | [#4 Database Slow](#scenario-4-database-query-slow-or-unresponsive) |\n| Login fails \u002F token expired \u002F RLS denied | [#5 Auth Failure](#scenario-5-authenticationauthorization-failure) |\n| Channel won't connect \u002F messages missing | [#6 Realtime Issues](#scenario-6-realtime-channel-issues) |\n| High CPU\u002Fmemory, all responses slow | [#7 Backend Performance](#scenario-7-backend-performance-degradation) |\n| `functions deploy` fails | [#8 Function Deploy](#scenario-8-edge-function-deploy-failure) |\n| `deployments deploy` fails \u002F Vercel error | [#9 Frontend Deploy](#scenario-9-frontend-vercel-deploy-failure) |\n\n---\n\n## Scenario 1: SDK Returns Error Object\n\n**Symptoms**: SDK call returns `{ data: null, error: { code, message, details } }`. PostgREST error codes like `PGRST301`, `PGRST204`, etc.\n\n**Steps**:\n\n1. Read the error object — extract `code`, `message`, `details` from the SDK response.\n2. Check aggregated error logs to find matching backend errors:\n\n```bash\nnpx @insforge\u002Fcli diagnose logs\n```\n\n3. Based on the error code prefix, drill into the relevant log source:\n\n| Error pattern | Log source | Command |\n|---------------|------------|---------|\n| `PGRST*` (PostgREST) | postgREST.logs | `npx @insforge\u002Fcli logs postgREST.logs --limit 50` |\n| Database\u002FSQL errors | postgres.logs | `npx @insforge\u002Fcli logs postgres.logs --limit 50` |\n| Generic 500 \u002F server error | insforge.logs | `npx @insforge\u002Fcli logs insforge.logs --limit 50` |\n\n4. If the error is DB-related, check database health for additional context:\n\n```bash\nnpx @insforge\u002Fcli diagnose db --check connections,locks,slow-queries\n```\n\n**Information gathered**: Error code, backend log entries around the error timestamp, database health status.\n\n---\n\n## Scenario 2: HTTP Status Code Anomaly\n\n**Symptoms**: API calls return 400, 401, 403, 404, 429, or 500.\n\n**Steps**:\n\n1. Identify the status code from the response.\n2. Follow the path for that status code:\n\n| Status | What to check | Command |\n|--------|---------------|---------|\n| 400 | Request payload\u002Fparams malformed | `npx @insforge\u002Fcli logs postgREST.logs --limit 50` |\n| 401 | Auth token missing or expired | `npx @insforge\u002Fcli logs insforge.logs --limit 50` |\n| 403 | RLS policy or permission denied | `npx @insforge\u002Fcli logs insforge.logs --limit 50` |\n| 404 | Endpoint or resource doesn't exist | `npx @insforge\u002Fcli metadata --json` |\n| 429 | Rate limit hit — **no backend logs recorded** | See 429 note below |\n| 500 | Server-side error | `npx @insforge\u002Fcli diagnose logs` |\n\n3. For 500 errors, also check aggregate error logs across all sources:\n\n```bash\nnpx @insforge\u002Fcli diagnose logs\n```\n\n4. **429 Rate Limit**: The backend does not log 429 responses and does not return `Retry-After` or `X-RateLimit-*` headers. Checking logs will not help. Instead:\n   - Review client code for high-frequency request patterns: loops without throttling, missing debounce, retry without exponential backoff, or parallel calls that could be batched.\n   - Check overall backend load to see if the system is under heavy traffic:\n     ```bash\n     npx @insforge\u002Fcli diagnose metrics --range 1h\n     ```\n   - A 429 status confirms the request was rate-limited. The fix is always on the client side: reduce request frequency, add backoff\u002Fdebounce, or batch operations.\n\n**Information gathered**: Status code context, relevant log entries, request\u002Fresponse details from logs. For 429: client-side request patterns and backend load metrics.\n\n---\n\n## Scenario 3: Edge Function Execution Failure\u002FTimeout\n\n**Symptoms**: `functions invoke` returns error, function times out, or throws runtime exception.\n\n**Steps**:\n\n1. Check function execution logs:\n\n```bash\nnpx @insforge\u002Fcli logs function.logs --limit 50\n```\n\n2. Verify the function exists and is active:\n\n```bash\nnpx @insforge\u002Fcli functions list\n```\n\n3. Inspect the function source for obvious issues:\n\n```bash\nnpx @insforge\u002Fcli functions code \u003Cslug>\n```\n\n**Information gathered**: Function runtime errors, function status, source code, EC2 resource metrics.\n\n---\n\n## Scenario 4: Database Query Slow or Unresponsive\n\n**Symptoms**: Queries take too long, hang indefinitely, or connection pool is exhausted.\n\n**Steps**:\n\n1. Check database health — slow queries, active connections, locks:\n\n```bash\nnpx @insforge\u002Fcli diagnose db --check slow-queries,connections,locks\n```\n\n2. Check postgres logs for query errors or warnings:\n\n```bash\nnpx @insforge\u002Fcli logs postgres.logs --limit 50\n```\n\n3. Check index usage and table bloat:\n\n```bash\nnpx @insforge\u002Fcli diagnose db --check index-usage,bloat,cache-hit,size\n```\n\n4. If the whole system feels slow, check EC2 instance metrics:\n\n```bash\nnpx @insforge\u002Fcli diagnose metrics --range 1h\n```\n\n**Information gathered**: Slow query details, connection pool state, lock contention, index efficiency, table bloat, cache hit ratio, EC2 resource usage.\n\n---\n\n## Scenario 5: Authentication\u002FAuthorization Failure\n\n**Symptoms**: Login fails, signup errors, token expired, OAuth callback error, RLS policy denies access.\n\n**Steps**:\n\n1. Check insforge.logs for auth-related errors (login failures, token issues, OAuth errors):\n\n```bash\nnpx @insforge\u002Fcli logs insforge.logs --limit 50\n```\n\n2. Check postgREST.logs for RLS policy violations:\n\n```bash\nnpx @insforge\u002Fcli logs postgREST.logs --limit 50\n```\n\n3. Verify the project's auth configuration:\n\n```bash\nnpx @insforge\u002Fcli metadata --json\n```\n\n4. If RLS suspected, inspect current policies:\n\n```bash\nnpx @insforge\u002Fcli db policies\n```\n\n**Information gathered**: Auth error details, RLS violation logs, auth configuration state, active RLS policies.\n\n---\n\n## Scenario 6: Realtime Channel Issues\n\n**Symptoms**: WebSocket won't connect, channel subscription fails, messages not received or lost.\n\n**Steps**:\n\n1. Check insforge.logs for realtime\u002FWebSocket errors:\n\n```bash\nnpx @insforge\u002Fcli logs insforge.logs --limit 50\n```\n\n2. Verify the channel pattern exists and is enabled:\n\n```bash\nnpx @insforge\u002Fcli db query \"SELECT pattern, description, enabled FROM realtime.channels\"\n```\n\n3. If access is restricted, check RLS on realtime tables:\n\n```bash\nnpx @insforge\u002Fcli db policies\n```\n\n4. If the issue is widespread (all channels affected), check overall backend health:\n\n```bash\nnpx @insforge\u002Fcli diagnose\n```\n\n**Information gathered**: WebSocket error logs, channel configuration, realtime RLS policies, overall backend health.\n\n---\n\n## Scenario 7: Backend Performance Degradation\n\n**Symptoms**: All responses slow, high latency, intermittent failures across the board.\n\n**Steps**:\n\n1. Check EC2 instance metrics — CPU, memory, disk, network:\n\n```bash\nnpx @insforge\u002Fcli diagnose metrics --range 1h\n```\n\n2. Check database health (often the bottleneck):\n\n```bash\nnpx @insforge\u002Fcli diagnose db\n```\n\n3. Check aggregate error logs:\n\n```bash\nnpx @insforge\u002Fcli diagnose logs\n```\n\n4. Check advisor for known critical issues:\n\n```bash\nnpx @insforge\u002Fcli diagnose advisor --severity critical\n```\n\n**Information gathered**: CPU\u002Fmemory\u002Fdisk\u002Fnetwork metrics (current and trend), database health, error log summary, advisor warnings.\n\n---\n\n## Scenario 8: Edge Function Deploy Failure\n\n**Symptoms**: `functions deploy \u003Cslug>` command fails, function not appearing in the list after deploy.\n\n**Steps**:\n\n1. Re-run the deploy command and capture the error output:\n\n```bash\nnpx @insforge\u002Fcli functions deploy \u003Cslug>\n```\n\n2. Check deployment-related errors:\n\n```bash\nnpx @insforge\u002Fcli logs function-deploy.logs --limit 50\n```\n\n3. Verify whether the function exists in the list:\n\n```bash\nnpx @insforge\u002Fcli functions list\n```\n\n**Information gathered**: Deploy command error output, function deployment logs, function list status, backend error logs.\n\n---\n\n## Scenario 9: Frontend (Vercel) Deploy Failure\n\n**Symptoms**: `deployments deploy` command fails, deployment status shows error, Vercel build errors.\n\n**Steps**:\n\n1. Check recent deployment attempts:\n\n```bash\nnpx @insforge\u002Fcli deployments list\n```\n\n2. Get the status and error details for the failed deployment:\n\n```bash\nnpx @insforge\u002Fcli deployments status \u003Cid> --json\n```\n\nThe `--json` output includes a `metadata` object with Vercel-specific context: `target`, `fileCount`, `projectId`, `startedAt`, `envVarKeys`, `webhookEventType` (e.g., `deployment.succeeded` or `deployment.error`), etc. This metadata captures the full deployment context and can be used for debugging or AI-assisted investigation.\n\n3. Verify the local build succeeds before investigating further:\n\n```bash\nnpm run build\n```\n\n**Information gathered**: Deployment history, deployment metadata (Vercel context, status, webhook events), local build output, backend deployment API logs.\n\n---\n\n## Command Quick Reference\n\n### Logs\n\n```bash\nnpx @insforge\u002Fcli logs \u003Csource> [--limit \u003Cn>]\n```\n\n| Source | Description |\n|--------|-------------|\n| `insforge.logs` | Main backend logs |\n| `postgREST.logs` | PostgREST API layer logs |\n| `postgres.logs` | PostgreSQL database logs |\n| `function.logs` | Edge function execution logs |\n| `function-deploy.logs` | Edge function deployment logs |\n\nSource names are case-insensitive.\n\n### Diagnostics\n\n```bash\n# Full health report (all checks)\nnpx @insforge\u002Fcli diagnose\n\n# AI-powered diagnosis from a natural-language problem description\n# Returns diagnosis + suggested solutions\nnpx @insforge\u002Fcli diagnose --ai \"\u003Cissue description>\"\n\n# EC2 instance metrics (CPU, memory, disk, network)\nnpx @insforge\u002Fcli diagnose metrics [--range 1h|6h|24h|7d] [--metrics \u003Clist>]\n\n# Advisor scan results\nnpx @insforge\u002Fcli diagnose advisor [--severity critical|warning|info] [--category security|performance|health] [--limit \u003Cn>]\n\n# Database health checks\nnpx @insforge\u002Fcli diagnose db [--check \u003Cchecks>]\n# checks: connections, slow-queries, bloat, size, index-usage, locks, cache-hit (default: all)\n\n# Aggregate error logs from all sources\nnpx @insforge\u002Fcli diagnose logs [--source \u003Cname>] [--limit \u003Cn>]\n```\n\n### Supporting Commands\n\n```bash\n# Project metadata (auth config, tables, buckets, functions, etc.)\nnpx @insforge\u002Fcli metadata --json\n\n# Edge functions\nnpx @insforge\u002Fcli functions list\nnpx @insforge\u002Fcli functions code \u003Cslug>\n\n# Secrets\nnpx @insforge\u002Fcli secrets list [--all]\nnpx @insforge\u002Fcli secrets get \u003Ckey>\nnpx @insforge\u002Fcli secrets add \u003Ckey> \u003Cvalue> [--reserved] [--expires \u003CISO date>]\n\n# Database\nnpx @insforge\u002Fcli db policies\nnpx @insforge\u002Fcli db query \"\u003Csql>\"\n\n# Deployments\nnpx @insforge\u002Fcli deployments list\nnpx @insforge\u002Fcli deployments status \u003Cid> --json\n```\n","# InsForge Debug\n\nDiagnose problems in InsForge projects — from frontend SDK errors to backend infrastructure issues. This skill helps you **locate** problems by running the right commands and surfacing logs\u002Fstatus. The manual scenarios below locate problems without suggesting fixes; the [AI-assisted path](#ai-assisted-diagnosis-fastest-path) additionally returns suggested causes and solutions.\n\n**Always use `npx @insforge\u002Fcli`** — never install the CLI globally.\n\n## AI-Assisted Diagnosis (Fastest Path)\n\nWhen the user gives a concrete description of the problem (error message, failing URL, HTTP status), hand it to the InsForge debug agent. It inspects backend state on its own and returns a diagnosis plus possible solutions.\n\n```bash\nnpx @insforge\u002Fcli diagnose --ai \"\u003Cissue description>\"\n```\n\n**When to use this path first**:\n- The user pastes an error, request URL, or status code and asks \"why?\"\n- You want a fast first pass before drilling into the manual scenarios below\n- The problem spans multiple subsystems (frontend + backend + database) and you're not sure where to start\n\n**Examples**:\n\n```bash\n# Edge function error\nnpx @insforge\u002Fcli diagnose --ai \"I invoked edge function https:\u002F\u002Fkttprzh4.functions.insforge.app\u002Fnewton, got error: 508: Loop Detected (LOOP_DETECTED)\\n\\nRecursive requests to the same deployment cannot be processed.\"\n\n# Slow database query\nnpx @insforge\u002Fcli diagnose --ai \"I query data with https:\u002F\u002Fkttprzh4.us-west.insforge.app\u002Fapi\u002Fdatabase\u002Frecords\u002Forder_customer_details?select=*&order=total_amount.desc, it costs 1.4s, why?\"\n\n# Unresponsive backend \u002F 504\nnpx @insforge\u002Fcli diagnose --ai \"my backend is unresponsive, request https:\u002F\u002Fkttprzh4.us-west.insforge.app\u002Fapi\u002Fdatabase\u002Frecords\u002Ftodo?select=*&order=created_at.desc got 504 error, why?\"\n```\n\nUnlike the other commands in this skill, `diagnose --ai` returns both a diagnosis and suggested solutions. Relay them to the user as a starting point, but verify against the underlying logs\u002Fmetrics (the scenarios below) before committing to a fix.\n\n## Quick Triage\n\nMatch the symptom to a scenario, then follow that scenario's steps.\n\n| Symptom | Scenario |\n|---------|----------|\n| SDK returns `{ data: null, error: {...} }` | [#1 SDK Error](#scenario-1-sdk-returns-error-object) |\n| HTTP 400 \u002F 401 \u002F 403 \u002F 404 \u002F 429 \u002F 500 | [#2 HTTP Status Code](#scenario-2-http-status-code-anomaly) |\n| Function throws or times out | [#3 Edge Function Failure](#scenario-3-edge-function-execution-failuretimeout) |\n| Query slow or hangs | [#4 Database Slow](#scenario-4-database-query-slow-or-unresponsive) |\n| Login fails \u002F token expired \u002F RLS denied | [#5 Auth Failure](#scenario-5-authenticationauthorization-failure) |\n| Channel won't connect \u002F messages missing | [#6 Realtime Issues](#scenario-6-realtime-channel-issues) |\n| High CPU\u002Fmemory, all responses slow | [#7 Backend Performance](#scenario-7-backend-performance-degradation) |\n| `functions deploy` fails | [#8 Function Deploy](#scenario-8-edge-function-deploy-failure) |\n| `deployments deploy` fails \u002F Vercel error | [#9 Frontend Deploy](#scenario-9-frontend-vercel-deploy-failure) |\n\n---\n\n## Scenario 1: SDK Returns Error Object\n\n**Symptoms**: SDK call returns `{ data: null, error: { code, message, details } }`. PostgREST error codes like `PGRST301`, `PGRST204`, etc.\n\n**Steps**:\n\n1. Read the error object — extract `code`, `message`, `details` from the SDK response.\n2. Check aggregated error logs to find matching backend errors:\n\n```bash\nnpx @insforge\u002Fcli diagnose logs\n```\n\n3. Based on the error code prefix, drill into the relevant log source:\n\n| Error pattern | Log source | Command |\n|---------------|------------|---------|\n| `PGRST*` (PostgREST) | postgREST.logs | `npx @insforge\u002Fcli logs postgREST.logs --limit 50` |\n| Database\u002FSQL errors | postgres.logs | `npx @insforge\u002Fcli logs postgres.logs --limit 50` |\n| Generic 500 \u002F server error | insforge.logs | `npx @insforge\u002Fcli logs insforge.logs --limit 50` |\n\n4. If the error is DB-related, check database health for additional context:\n\n```bash\nnpx @insforge\u002Fcli diagnose db --check connections,locks,slow-queries\n```\n\n**Information gathered**: Error code, backend log entries around the error timestamp, database health status.\n\n---\n\n## Scenario 2: HTTP Status Code Anomaly\n\n**Symptoms**: API calls return 400, 401, 403, 404, 429, or 500.\n\n**Steps**:\n\n1. Identify the status code from the response.\n2. Follow the path for that status code:\n\n| Status | What to check | Command |\n|--------|---------------|---------|\n| 400 | Request payload\u002Fparams malformed | `npx @insforge\u002Fcli logs postgREST.logs --limit 50` |\n| 401 | Auth token missing or expired | `npx @insforge\u002Fcli logs insforge.logs --limit 50` |\n| 403 | RLS policy or permission denied | `npx @insforge\u002Fcli logs insforge.logs --limit 50` |\n| 404 | Endpoint or resource doesn't exist | `npx @insforge\u002Fcli metadata --json` |\n| 429 | Rate limit hit — **no backend logs recorded** | See 429 note below |\n| 500 | Server-side error | `npx @insforge\u002Fcli diagnose logs` |\n\n3. For 500 errors, also check aggregate error logs across all sources:\n\n```bash\nnpx @insforge\u002Fcli diagnose logs\n```\n\n4. **429 Rate Limit**: The backend does not log 429 responses and does not return `Retry-After` or `X-RateLimit-*` headers. Checking logs will not help. Instead:\n   - Review client code for high-frequency request patterns: loops without throttling, missing debounce, retry without exponential backoff, or parallel calls that could be batched.\n   - Check overall backend load to see if the system is under heavy traffic:\n     ```bash\n     npx @insforge\u002Fcli diagnose metrics --range 1h\n     ```\n   - A 429 status confirms the request was rate-limited. The fix is always on the client side: reduce request frequency, add backoff\u002Fdebounce, or batch operations.\n\n**Information gathered**: Status code context, relevant log entries, request\u002Fresponse details from logs. For 429: client-side request patterns and backend load metrics.\n\n---\n\n## Scenario 3: Edge Function Execution Failure\u002FTimeout\n\n**Symptoms**: `functions invoke` returns error, function times out, or throws runtime exception.\n\n**Steps**:\n\n1. Check function execution logs:\n\n```bash\nnpx @insforge\u002Fcli logs function.logs --limit 50\n```\n\n2. Verify the function exists and is active:\n\n```bash\nnpx @insforge\u002Fcli functions list\n```\n\n3. Inspect the function source for obvious issues:\n\n```bash\nnpx @insforge\u002Fcli functions code \u003Cslug>\n```\n\n**Information gathered**: Function runtime errors, function status, source code, EC2 resource metrics.\n\n---\n\n## Scenario 4: Database Query Slow or Unresponsive\n\n**Symptoms**: Queries take too long, hang indefinitely, or connection pool is exhausted.\n\n**Steps**:\n\n1. Check database health — slow queries, active connections, locks:\n\n```bash\nnpx @insforge\u002Fcli diagnose db --check slow-queries,connections,locks\n```\n\n2. Check postgres logs for query errors or warnings:\n\n```bash\nnpx @insforge\u002Fcli logs postgres.logs --limit 50\n```\n\n3. Check index usage and table bloat:\n\n```bash\nnpx @insforge\u002Fcli diagnose db --check index-usage,bloat,cache-hit,size\n```\n\n4. If the whole system feels slow, check EC2 instance metrics:\n\n```bash\nnpx @insforge\u002Fcli diagnose metrics --range 1h\n```\n\n**Information gathered**: Slow query details, connection pool state, lock contention, index efficiency, table bloat, cache hit ratio, EC2 resource usage.\n\n---\n\n## Scenario 5: Authentication\u002FAuthorization Failure\n\n**Symptoms**: Login fails, signup errors, token expired, OAuth callback error, RLS policy denies access.\n\n**Steps**:\n\n1. Check insforge.logs for auth-related errors (login failures, token issues, OAuth errors):\n\n```bash\nnpx @insforge\u002Fcli logs insforge.logs --limit 50\n```\n\n2. Check postgREST.logs for RLS policy violations:\n\n```bash\nnpx @insforge\u002Fcli logs postgREST.logs --limit 50\n```\n\n3. Verify the project's auth configuration:\n\n```bash\nnpx @insforge\u002Fcli metadata --json\n```\n\n4. If RLS suspected, inspect current policies:\n\n```bash\nnpx @insforge\u002Fcli db policies\n```\n\n**Information gathered**: Auth error details, RLS violation logs, auth configuration state, active RLS policies.\n\n---\n\n## Scenario 6: Realtime Channel Issues\n\n**Symptoms**: WebSocket won't connect, channel subscription fails, messages not received or lost.\n\n**Steps**:\n\n1. Check insforge.logs for realtime\u002FWebSocket errors:\n\n```bash\nnpx @insforge\u002Fcli logs insforge.logs --limit 50\n```\n\n2. Verify the channel pattern exists and is enabled:\n\n```bash\nnpx @insforge\u002Fcli db query \"SELECT pattern, description, enabled FROM realtime.channels\"\n```\n\n3. If access is restricted, check RLS on realtime tables:\n\n```bash\nnpx @insforge\u002Fcli db policies\n```\n\n4. If the issue is widespread (all channels affected), check overall backend health:\n\n```bash\nnpx @insforge\u002Fcli diagnose\n```\n\n**Information gathered**: WebSocket error logs, channel configuration, realtime RLS policies, overall backend health.\n\n---\n\n## Scenario 7: Backend Performance Degradation\n\n**Symptoms**: All responses slow, high latency, intermittent failures across the board.\n\n**Steps**:\n\n1. Check EC2 instance metrics — CPU, memory, disk, network:\n\n```bash\nnpx @insforge\u002Fcli diagnose metrics --range 1h\n```\n\n2. Check database health (often the bottleneck):\n\n```bash\nnpx @insforge\u002Fcli diagnose db\n```\n\n3. Check aggregate error logs:\n\n```bash\nnpx @insforge\u002Fcli diagnose logs\n```\n\n4. Check advisor for known critical issues:\n\n```bash\nnpx @insforge\u002Fcli diagnose advisor --severity critical\n```\n\n**Information gathered**: CPU\u002Fmemory\u002Fdisk\u002Fnetwork metrics (current and trend), database health, error log summary, advisor warnings.\n\n---\n\n## Scenario 8: Edge Function Deploy Failure\n\n**Symptoms**: `functions deploy \u003Cslug>` command fails, function not appearing in the list after deploy.\n\n**Steps**:\n\n1. Re-run the deploy command and capture the error output:\n\n```bash\nnpx @insforge\u002Fcli functions deploy \u003Cslug>\n```\n\n2. Check deployment-related errors:\n\n```bash\nnpx @insforge\u002Fcli logs function-deploy.logs --limit 50\n```\n\n3. Verify whether the function exists in the list:\n\n```bash\nnpx @insforge\u002Fcli functions list\n```\n\n**Information gathered**: Deploy command error output, function deployment logs, function list status, backend error logs.\n\n---\n\n## Scenario 9: Frontend (Vercel) Deploy Failure\n\n**Symptoms**: `deployments deploy` command fails, deployment status shows error, Vercel build errors.\n\n**Steps**:\n\n1. Check recent deployment attempts:\n\n```bash\nnpx @insforge\u002Fcli deployments list\n```\n\n2. Get the status and error details for the failed deployment:\n\n```bash\nnpx @insforge\u002Fcli deployments status \u003Cid> --json\n```\n\nThe `--json` output includes a `metadata` object with Vercel-specific context: `target`, `fileCount`, `projectId`, `startedAt`, `envVarKeys`, `webhookEventType` (e.g., `deployment.succeeded` or `deployment.error`), etc. This metadata captures the full deployment context and can be used for debugging or AI-assisted investigation.\n\n3. Verify the local build succeeds before investigating further:\n\n```bash\nnpm run build\n```\n\n**Information gathered**: Deployment history, deployment metadata (Vercel context, status, webhook events), local build output, backend deployment API logs.\n\n---\n\n## Command Quick Reference\n\n### Logs\n\n```bash\nnpx @insforge\u002Fcli logs \u003Csource> [--limit \u003Cn>]\n```\n\n| Source | Description |\n|--------|-------------|\n| `insforge.logs` | Main backend logs |\n| `postgREST.logs` | PostgREST API layer logs |\n| `postgres.logs` | PostgreSQL database logs |\n| `function.logs` | Edge function execution logs |\n| `function-deploy.logs` | Edge function deployment logs |\n\nSource names are case-insensitive.\n\n### Diagnostics\n\n```bash\n# Full health report (all checks)\nnpx @insforge\u002Fcli diagnose\n\n# AI-powered diagnosis from a natural-language problem description\n# Returns diagnosis + suggested solutions\nnpx @insforge\u002Fcli diagnose --ai \"\u003Cissue description>\"\n\n# EC2 instance metrics (CPU, memory, disk, network)\nnpx @insforge\u002Fcli diagnose metrics [--range 1h|6h|24h|7d] [--metrics \u003Clist>]\n\n# Advisor scan results\nnpx @insforge\u002Fcli diagnose advisor [--severity critical|warning|info] [--category security|performance|health] [--limit \u003Cn>]\n\n# Database health checks\nnpx @insforge\u002Fcli diagnose db [--check \u003Cchecks>]\n# checks: connections, slow-queries, bloat, size, index-usage, locks, cache-hit (default: all)\n\n# Aggregate error logs from all sources\nnpx @insforge\u002Fcli diagnose logs [--source \u003Cname>] [--limit \u003Cn>]\n```\n\n### Supporting Commands\n\n```bash\n# Project metadata (auth config, tables, buckets, functions, etc.)\nnpx @insforge\u002Fcli metadata --json\n\n# Edge functions\nnpx @insforge\u002Fcli functions list\nnpx @insforge\u002Fcli functions code \u003Cslug>\n\n# Secrets\nnpx @insforge\u002Fcli secrets list [--all]\nnpx @insforge\u002Fcli secrets get \u003Ckey>\nnpx @insforge\u002Fcli secrets add \u003Ckey> \u003Cvalue> [--reserved] [--expires \u003CISO date>]\n\n# Database\nnpx @insforge\u002Fcli db policies\nnpx @insforge\u002Fcli db query \"\u003Csql>\"\n\n# Deployments\nnpx @insforge\u002Fcli deployments list\nnpx @insforge\u002Fcli deployments status \u003Cid> --json\n```\n",{"name":5,"license":14,"metadata":23,"description":7},{"date":24,"author":25,"version":26,"organization":27},"March 2026","insforge","1.0.0","InsForge","main","f37de8f681f0c0ca0e0ebab6e5fddf764ca7553d","skills\u002Finsforge-debug",1,"https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one","https:\u002F\u002Fagisota.github.io\u002Fold-one\u002F","https:\u002F\u002Fgithub.com\u002Fagisota","pzd.world","2026-07-04 22:32:06",{"source":8,"skillName":5,"commands":38,"prompt":48,"zipAvailable":49},[39,42,45],{"tool":40,"command":41},"npx","npx skills add agisota\u002Fold-one --skill insforge-debug",{"tool":43,"command":44},"bunx","bunx skills add agisota\u002Fold-one --skill insforge-debug",{"tool":46,"command":47},"pnpm","pnpm dlx skills add agisota\u002Fold-one --skill insforge-debug","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Finsforge-debug\u002FSKILL.md",true,[],[52,59,66,75,82,89],{"skillNo":53,"name":54,"nameZh":6,"description":55,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":56,"categories":57,"keywords":58,"publishedAt":18},"01M75KRGZWQWE9JDBS6RX42NWV","zoom-out","Tell the agent to zoom out and give broader context or a higher-level perspective. Use when you're unfamiliar with a section of code or need to understand how it fits into the bigger picture.","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fzoom-out\u002FSKILL.md",[],[],{"skillNo":60,"name":61,"nameZh":6,"description":62,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":63,"categories":64,"keywords":65,"publishedAt":18},"01M75KRCZHKE0ZYAQFFYHS0YNP","zeroize-audit","Detects missing zeroization of sensitive data in source code and identifies zeroization removed by compiler optimizations, with assembly-level analysis, and control-flow verification. Use for auditing C\u002FC++\u002FRust code handling secrets, keys, passwords, or other sensitive data.","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fzeroize-audit\u002FSKILL.md",[],[],{"skillNo":67,"name":68,"nameZh":6,"description":69,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":70,"licenseFileUrl":71,"sourceHtmlUrl":72,"categories":73,"keywords":74,"publishedAt":18},"01M75KR94KYQ30DTE1P9WNDAE0","yeet","Use only when the user explicitly asks to stage, commit, push, and open a GitHub pull request in one flow using the GitHub CLI (`gh`).","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fyeet\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fyeet\u002FSKILL.md",[],[],{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":18},"01M75KR3H13YJ9QHMD49818FA1","yara-rule-authoring","Guides authoring of high-quality YARA-X detection rules for malware identification. Use when writing, reviewing, or optimizing YARA rules. Covers naming conventions, string selection, performance optimization, migration from legacy YARA, and false positive reduction. Triggers on: YARA, YARA-X, malware detection, threat hunting, IOC, signature, crx module, dex module.","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fyara-rule-authoring\u002FSKILL.md",[],[],{"skillNo":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":18},"01M75KQMPY8A4Y8XTDD2DT0M9T","x-twitter-growth","X\u002FTwitter growth engine for building audience, crafting viral content, and analyzing engagement. Use when the user wants to grow on X\u002FTwitter, write tweets or threads, analyze their X profile, research competitors on X, plan a posting strategy, or optimize engagement. Complements social-content (generic multi-platform) with X-specific depth: algorithm mechanics, thread engineering, reply strategy, profile optimization, and competitive intelligence via web search.","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fx-twitter-growth\u002FSKILL.md",[],[],{"skillNo":90,"name":91,"nameZh":6,"description":92,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":18},"01M75KQHNZ0ANZNJGZY6M8MDAK","x-api","X\u002FTwitter API integration for posting tweets, threads, reading timelines, search, and analytics. Covers OAuth auth patterns, rate limits, and platform-native content posting. Use when the user wants to interact with X programmatically.","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fx-api\u002FSKILL.md",[],[]]