planetscale/planetscale-mcp-agent-operating-model
Configure safe agent behavior around PlanetScale MCP, Insights, schema recommendations, and repository work without autonomous production mutation.
npx skills add https://github.com/planetscale/skills --skill planetscale-mcp-agent-operating-model
Define how agents should use PlanetScale MCP safely. Agents should use production telemetry to generate useful work while avoiding autonomous production changes.
Use the PlanetScale MCP insights-only server when the task only needs Insights and Schema Recommendations.
Use the full PlanetScale MCP server only when the task explicitly requires database/schema access beyond Insights. Prefer read-only scopes.
The full MCP server has query execution tools. Treat write query tools as disabled unless the operator explicitly approves a specific non-production action or a carefully reviewed production action.
Two different documents both named AGENTS.md serve different purposes:
pscale (AGENTS.md in theplanetscale/cli repo, or
pscale agent-guide --format json). Covers auth, --format json, flag
placement, and pscale sql. Load skill 14-pscale-cli-automation for the
same conventions inside this skills pack.
AGENTS.md (orequivalent). Covers database targeting and approval policy for *this* app.
When working inside a repository, recommend adding a project database
targeting section to AGENTS.md or equivalent project instructions:
Do not edit AGENTS.md without approval.
Allowed by default:
Where a PR + deploy-request workflow exists, the default deliverable for a
schema recommendation is the complete reviewable unit: development branch
with the DDL applied, PR with evidence (fingerprint, metrics, expected
effect), and an open deploy request. The human action is the merge/deploy
decision, not shepherding the proposal into existence.
Not allowed by default (the review-gate actions and non-reviewable mutations):
warn budget proposal.The loops above run interactively. They can also run on a schedule with no
human in the loop, in two tiers. Tier 2 requires a standing authorization
per ../13-autonomous-execution-mode/SKILL.md; Tier 1 requires none.
Every scheduled loop, both tiers: re-read authorization at run start,
stream status to a configured delivery channel, persist a run log, and
avoid filing duplicates (do not re-file an issue that is already open
for the same fingerprint/recommendation ID).
via MCP; for each new one matching the workflow (additive or destructive
— the PR review is the gate), create a development branch, apply the
DDL, open a PR with fingerprint, metrics, and expected effect, and open
the deploy request. The reviewable unit is complete when a human can
ship it with one merge/deploy action. Output: branch + PR + deploy
request per recommendation.
against a stored baseline (p50/p99, rows read, execution count); on
material regression, identify the deploy SHA from query tags and file
a report linking pattern to commit range. Output: report.
carrying tags; list untagged high-cost patterns with likely code
paths; open or update a single tracking issue. Output: issue.
branch.anomaly,gather affected patterns, classify probable cause, post triage note to
the incident channel. Output: triage note.
webhook config, role list, and backup schedule against the last
assessment report; report any drift. Output: report.
deploy requests that match the allowlist — typically "additive DDL,
PR approved or authored from an open recommendation, deploy with revert
window, max N per run" — then verify via schema read-back and an
Insights follow-up on the target fingerprint. Destructive DDL deploys
autonomously only when the authorization states a runtime-verifiable
bound (e.g. "drop only indexes with zero reads in 30 days, confirmed
via Insights at run time"). Where the org requires PR approval before
deploy, an approved PR satisfies the review gate and the authorization
covers only the mechanical deploy.
authorized age bound with no open deploy request; never touch
production or protected branches.
budgets for newly identified expensive slices matching the allowlist;
report warn counts on existing budgets. Enforce mode is never entered
autonomously unless the authorization names the specific budget.
past the authorized max age, only where the authorization lists the
affected roles and a rotation runbook exists.
webhook as the trigger; use cron for baselines, sweeps, and audits.
rather than bounded operations.
with no per-run cap.
For read queries:
planetscale_execute_read_query routes reads to replicas by default when abranch has replicas configured (use_replica: true). Set
use_replica: false only when the task needs primary-read semantics, such
as checking immediately-after-write state or primary-only behavior.
EXPLAIN ANALYZE on production unless explicitly approved.uses pg_read_all_data and does not bypass RLS. If a read query returns zero
rows or a zero count and the MCP response warns that RLS may be filtering
results, treat the result as policy-filtered/unknown until confirmed through
an approved path; do not conclude the table is empty.
usage (via MCP where available, or sort=cpuTime on the Insights API).
CPU time metrics are Postgres-only; do not ask for the same CPU-sorted
view on Vitess.
For write queries:
Return:
End with:
“No MCP write tools or database mutations have been used.”
Take planetscale/planetscale-mcp-agent-operating-model from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.