Loading...
Loading...
Use this skill whenever the user needs backend infrastructure management — creating database tables, running SQL, deploying serverless functions, managing storage buckets, deploying frontend apps, adding secrets, setting up cron jobs, checking logs, or running backend diagnostics — especially if the project uses InsForge. Trigger on any of these contexts: creating or altering database tables/schemas, writing RLS policies via SQL, deploying or invoking edge functions, creating storage buckets, deploying frontends to hosting, managing secrets/env vars, setting up scheduled tasks/cron, viewing backend logs, diagnosing backend health or performance issues, or exporting/importing database backups. If the user asks for these operations generically (e.g., "create a users table", "deploy my app", "set up a cron job", "check backend health") and you're unsure whether they use InsForge, consult this skill and ask. For writing frontend application code with the InsForge SDK (@insforge/sdk), use the insforge skill instead.
npx skill4agent add insforge/insforge-skills insforge-clinpm install -g @insforge/clinpxnpx @insforge/cli <command>npx @insforge/cli whoami # verify authentication
npx @insforge/cli current # verify linked projectnpx @insforge/cli loginnpx @insforge/cli createnpx @insforge/cli link| Flag | Description |
|---|---|
| Structured JSON output (for scripts and agents) |
| Skip confirmation prompts |
All examples below use. Never callnpx @insforge/clidirectly.insforge
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | General error (e.g., HTTP 400+ from function invoke) |
| 2 | Not authenticated |
| 3 | Project not linked |
| 4 | Resource not found |
| 5 | Permission denied |
| Variable | Description |
|---|---|
| Override stored access token |
| Override linked project ID |
| Email for non-interactive login |
| Password for non-interactive login |
npx @insforge/cli login--emailnpx @insforge/cli logoutnpx @insforge/cli whoaminpx @insforge/cli createnpx @insforge/cli linknpx @insforge/cli currentnpx @insforge/cli listnpx @insforge/cli metadata--jsonnpx @insforge/cli dbnpx @insforge/cli db query <sql>npx @insforge/cli db tables / indexes / policies / triggers / functionsnpx @insforge/cli db rpc <fn> [--data <json>]npx @insforge/cli db exportnpx @insforge/cli db import <file>npx @insforge/cli functionsnpx @insforge/cli functions listnpx @insforge/cli functions code <slug>npx @insforge/cli functions deploy <slug>npx @insforge/cli functions invoke <slug> [--data <json>] [--method GET|POST]npx @insforge/cli functions delete <slug>npx @insforge/cli storagenpx @insforge/cli storage bucketsnpx @insforge/cli storage create-bucket <name> [--private]npx @insforge/cli storage delete-bucket <name>npx @insforge/cli storage list-objects <bucket> [--prefix] [--search] [--limit] [--sort]npx @insforge/cli storage upload <file> --bucket <name> [--key <objectKey>]npx @insforge/cli storage download <objectKey> --bucket <name> [--output <path>]npx @insforge/cli deploymentsnpx @insforge/cli deployments deploy [dir]npx @insforge/cli deployments listnpx @insforge/cli deployments status <id> [--sync]npx @insforge/cli deployments cancel <id>npx @insforge/cli secretsnpx @insforge/cli secrets list [--all]--allnpx @insforge/cli secrets get <key>npx @insforge/cli secrets add <key> <value> [--reserved] [--expires <ISO date>]npx @insforge/cli secrets update <key> [--value] [--active] [--reserved] [--expires]npx @insforge/cli secrets delete <key>--active truenpx @insforge/cli schedulesnpx @insforge/cli schedules listnpx @insforge/cli schedules get <id>npx @insforge/cli schedules create --name --cron --url --method [--headers <json>] [--body <json>]npx @insforge/cli schedules update <id> [--name] [--cron] [--url] [--method] [--headers] [--body] [--active]npx @insforge/cli schedules delete <id>npx @insforge/cli schedules logs <id> [--limit] [--offset]npx @insforge/cli diagnosenpx @insforge/cli diagnosenpx @insforge/cli diagnose metrics [--range 1h|6h|24h|7d] [--metrics <list>]1hnpx @insforge/cli diagnose advisor [--severity critical|warning|info] [--category security|performance|health] [--limit <n>]npx @insforge/cli diagnose db [--check <checks>]connectionsslow-queriesbloatsizeindex-usagelockscache-hitallnpx @insforge/cli diagnose logs [--source <name>] [--limit <n>]npx @insforge/cli logsnpx @insforge/cli logs <source> [--limit <n>]| Source | Description |
|---|---|
| Main backend logs |
| PostgREST API layer logs |
| PostgreSQL database logs |
| Edge function execution logs |
Source names are case-insensitive:works the same aspostgrest.logs.postgREST.logs
npx @insforge/cli docsnpx @insforge/cli docsnpx @insforge/cli docs instructionsnpx @insforge/cli docs <feature> <language>db / storage / functions / auth / ai / realtimetypescript / swift / kotlin / rest-apiFor writing application code with the InsForge SDK, use the insforge (SDK) skill instead, and use theto get specific SDK documentation.npx @insforge/cli docs <feature> <language>
{oss_host}/functions/{slug}/api/functions/{slug}npx @insforge/cli secrets update KEY --active true--allsecrets list--data--dataminute hour day month day-of-week${{secrets.KEY_NAME}}npx @insforge/cli db query "CREATE TABLE posts (
id UUID DEFAULT gen_random_uuid() PRIMARY KEY,
title TEXT NOT NULL,
content TEXT,
author_id UUID REFERENCES auth.users(id),
created_at TIMESTAMPTZ DEFAULT now()
)"
npx @insforge/cli db query "ALTER TABLE posts ENABLE ROW LEVEL SECURITY"
npx @insforge/cli db query "CREATE POLICY \"public_read\" ON posts FOR SELECT USING (true)"
npx @insforge/cli db query "CREATE POLICY \"owner_write\" ON posts FOR INSERT WITH CHECK (auth.uid() = author_id)"FK to users: always. RLS current user:auth.users(id).auth.uid()
# Default source path: insforge/functions/{slug}/index.ts
npx @insforge/cli functions deploy my-handler
npx @insforge/cli functions invoke my-handler --data '{"action": "test"}'# 1. Build locally first
npm run build
# 2. Deploy
npx @insforge/cli deployments deploy ./dist --env '{"VITE_API_URL": "https://my-app.us-east.insforge.app"}'| Framework | Prefix | Example |
|---|---|---|
| Vite | | |
| Next.js | | |
| Create React App | | |
| Astro | | |
| SvelteKit | | |
npm run buildnode_modules.git.env.insforgedist/build/.next/npx @insforge/cli db export --output backup.sql
npx @insforge/cli db import backup.sql# Create a schedule that calls a function every 5 minutes
npx @insforge/cli schedules create \
--name "Cleanup Expired" \
--cron "*/5 * * * *" \
--url "https://my-app.us-east.insforge.app/functions/cleanup" \
--method POST \
--headers '{"Authorization": "Bearer ${{secrets.API_TOKEN}}"}'
# Check execution history
npx @insforge/cli schedules logs <id>┌─────────────── minute (0-59)
│ ┌───────────── hour (0-23)
│ │ ┌─────────── day of month (1-31)
│ │ │ ┌───────── month (1-12)
│ │ │ │ ┌─────── day of week (0-6, Sunday=0)
│ │ │ │ │
* * * * *| Expression | Description |
|---|---|
| Every minute |
| Every 5 minutes |
| Every hour (at minute 0) |
| Daily at 9:00 AM |
| Every Monday at 9:00 AM |
| First day of every month at midnight |
| Weekdays at 2:30 PM |
${{secrets.KEY_NAME}}{
"headers": {
"Authorization": "Bearer ${{secrets.API_TOKEN}}",
"X-API-Key": "${{secrets.EXTERNAL_API_KEY}}"
}
}*/5 * * * *${{secrets.KEY_NAME}}https://your-project.region.insforge.app/functions/{slug}status: "active"| Mistake | Solution |
|---|---|
| Using 6-field cron (with seconds) | Use 5-field format only: |
| Referencing non-existent secret | Create the secret first via secrets API |
| Targeting non-existent function | Verify function exists and is |
| Schedule not running | Check |
1. Create secrets if needed -> `npx @insforge/cli secrets add KEY VALUE`
2. Create/verify target function -> `npx @insforge/cli functions list`
3. Create schedule -> `npx @insforge/cli schedules create`
4. Verify schedule is active -> `npx @insforge/cli schedules get <id>`
5. Monitor execution logs -> `npx @insforge/cli schedules logs <id>`# Full health report (all checks)
npx @insforge/cli diagnose
# Check specific areas
npx @insforge/cli diagnose metrics --range 24h # CPU/memory/disk over last 24h
npx @insforge/cli diagnose advisor --severity critical # critical issues only
npx @insforge/cli diagnose db --check bloat,slow-queries # specific DB checks
npx @insforge/cli diagnose logs # aggregate errors from all sourcesnpx @insforge/cli logs function.logs # function execution issues
npx @insforge/cli logs postgres.logs # database query problems
npx @insforge/cli logs insforge.logs # API / auth errors
npx @insforge/cli logs postgrest.logs --limit 50| Problem | Check |
|---|---|
| Function not working | |
| Database query failing | |
| Auth issues | |
| API returning 500 errors | |
| General health / performance | |
| Database bloat / slow queries | |
| Security / config issues | |
INSFORGE_EMAIL=$EMAIL INSFORGE_PASSWORD=$PASSWORD npx @insforge/cli login --email -y
npx @insforge/cli link --project-id $PROJECT_ID --org-id $ORG_ID -y
npx @insforge/cli db query "SELECT count(*) FROM users" --jsoncreatelink.insforge/project.json{
"project_id": "...",
"appkey": "...",
"region": "us-east",
"api_key": "ik_...",
"oss_host": "https://{appkey}.{region}.insforge.app"
}oss_hostapi_keyNever commit this file to version control or share it publicly. Do not edit this file manually. Useto switch projects.npx @insforge/cli link