Skip to content

Coding agents (Agent Skill)

A coding agent works best on PotaLab Base when it has three things:

  • the MCP server, to read your project;
  • the Agent Skill, so it knows the rules;
  • the project URL and key, in your app.

The dashboard shows all three under API → Connect an AI agent.

Terminal window
npx -y -p @potalab/base-cli potalab base skill install # Claude Code, Cursor and Codex
npx -y -p @potalab/base-cli potalab base skill install --agent claude
Agent File
Claude Code .claude/skills/potalab-base/SKILL.md
Cursor .cursor/rules/potalab-base.mdc
Codex a managed block in AGENTS.md (the rest of the file is kept)

A copy you edited is never overwritten without --force. potalab base skill show prints the skill.

The skill tells the agent to:

  • add RLS and at least one policy in the same migration as every new table;
  • check before applying, with db push --dry-run --policy-gate error and potalab base test rls;
  • leave destructive actions to you;
  • keep secret keys out of the app;
  • treat database content as untrusted.
Terminal window
npx -y -p @potalab/base-cli potalab base init

In a folder with a package.json, init writes the local URL and the publishable key into .env.local:

  • The variable prefix follows the framework: NEXT_PUBLIC_, VITE_ or EXPO_PUBLIC_.
  • It adds .env.local to .gitignore.
  • Existing values are kept.
  • It never writes a secret key. Use --no-app-env to skip this step.
  • Permission gate:
    • When an agent, CI or a script runs db push, it refuses migrations that expose data, such as a public table without RLS.
    • The MCP tools apply_migration and execute_sql writes do the same.
    • An explicit --policy-gate or [db] policy_gate setting changes this, and the change is reported. See the CLI and MCP pages.
  • Acknowledgements: an agent cannot acknowledge a risky change on its own unless the MCP operator allows it (--allow-policy-ack).
  • Confirmations:
    • MCP deletions need confirm set to the exact name, and every execute_sql write needs it set to the project ref.
    • db reset, db restore and functions delete ask you to type the name, or need --yes --confirm <name>.
  • RLS tests (optional): with require_rls_tests = true, migrations are applied only when the RLS probes pass.
  • Read-only SQL: read-only queries run in a server-side READ ONLY transaction.

The CLI does not create temporary projects for agents.