$npx -y skills add InsForge/insforge-skills --skill 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, deployments, compute, secrets, config, schedules, logs, diagnostics, import/export, A
| 1 | # InsForge CLI |
| 2 | |
| 3 | Use this skill whenever someone needs a backend, or when managing InsForge backend and cloud infrastructure with the InsForge CLI. For application code that calls InsForge from a frontend, backend, or edge function, use the `insforge` app-integration skill instead. |
| 4 | |
| 5 | ## Core Rules |
| 6 | |
| 7 | - Always run the CLI through `npx @insforge/cli <command>`. Do not install or call a global `insforge` binary. |
| 8 | - If the project is already linked, use the current linked project. Run login, project creation, link, project discovery, organization listing, or cloud project commands only when connection setup is actually needed. |
| 9 | - When a task needs a backend and no project is linked yet, do connection setup FIRST — before writing any app code: (1) log in (`whoami` to check; in sandboxes use the two-step device login below), (2) `create` a new project or `link` an existing one, (3) then build against the real project URL and keys from the CLI. Never scaffold with placeholder credentials like `your-project.region.insforge.app` — get the real values first. |
| 10 | - Treat InsForge API keys as full-access admin keys. Keep them server-only and out of frontend/public env vars. |
| 11 | - Prefer CLI commands and documented project config over raw backend HTTP calls. If `config apply` reports unsupported/skipped fields, surface that result instead of bypassing the CLI with direct API calls. |
| 12 | - Use `--json` when structured output or non-interactive value collection is needed. Use `--yes` for confirmation prompts when the user has approved the action. |
| 13 | - At the start of a non-trivial task on a linked project, run `npx @insforge/cli memory list` (cheap, no AI call) and recall any title relevant to the task before designing or debugging. Record decisions and gotchas with `memory remember` at the moment they happen. See `references/memory.md`. |
| 14 | |
| 15 | ## Global Options |
| 16 | |
| 17 | | Flag | Use | |
| 18 | | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
| 19 | | `--json` | Structured JSON output and skip value-collection prompts such as text/select prompts. Errors if any required value is missing. Combine with `-y` for destructive commands that also ask for Y/N confirmation. | |
| 20 | | `-y`, `--yes` | Auto-accept Y/N confirmation prompts such as delete or overwrite prompts. Does not skip value-collection prompts; use `--json` for that. | |
| 21 | |
| 22 | ## Exit Codes |
| 23 | |
| 24 | | Code | Meaning | |
| 25 | | ---- | ------------------------------------------------------- | |
| 26 | | 0 | Success | |
| 27 | | 1 | General error, including HTTP 400+ from function invoke | |
| 28 | | 2 | Not authenticated | |
| 29 | | 3 | Project not linked | |
| 30 | | 4 | Resource not found | |
| 31 | | 5 | Permission denied | |
| 32 | |
| 33 | ## Environment Variables |
| 34 | |
| 35 | | Variable | Use | |
| 36 | | ----------------------- | ---------------------------------- | |
| 37 | | `INSFORGE_ACCESS_TOKEN` | Override stored access token | |
| 38 | | `INSFORGE_PROJECT_ID` | Override linked project ID | |
| 39 | | `INSFORGE_EMAIL` | Email for non-interactive login | |
| 40 | | `INSFORGE_PASSWORD` | Password for non-interactive login | |
| 41 | |
| 42 | ## Connection Setup |
| 43 | |
| 44 | If a task needs project access and the connection state is unknown, start with `npx @insforge/cli current`. Use `npx @insforge/cli whoami` when the authenticated identity matters or when `current` reports that the CLI is not authenticated. |
| 45 | |
| 46 | If not authenticated, run `npx @insforge/cli login` (opens a browser). For headless / agent / CI contexts with no browser, authenticate non-interactively with a user API key: `npx @insforge/cli login --user-api-key "$INSFORGE_USER_API_KEY"` (the user creates the key in the dashboard under Profile → API Keys). In sandboxes where the user has a browser but it cannot reach |