Read-only inventory
Purpose
Build an evidence-backed inventory of a PlanetScale database without making changes.
Allowed actions
Allowed by default:
- List organizations, databases, branches, keyspaces, regions, and sizes.
- Read branch metadata.
- Read webhook configuration.
- Read schema recommendations.
- Read Query Insights, anomalies, and query patterns through MCP or API.
- Read traffic budgets and rules.
- Read Postgres roles and non-secret role metadata.
- Read backup schedules and restore metadata.
- Read branch schema.
- Inspect live connection/session metadata with the Connections CLI view.
- Inspect repository files for frameworks, ORMs, migrations, SQL tagging, and connection config.
- Inspect Terraform or other infrastructure-as-code definitions for
PlanetScale roles, backups, backup policies, Postgres parameters, and
supported extensions.
Not allowed without explicit approval:
- Any create, update, delete, enable, disable, reset, deploy, restore, promote, enforce, or apply operation.
- Any SQL mutation.
- Any command that emits new credentials unless the operator explicitly asked for credential work.
Interfaces and documentation grounding
Ground every command and endpoint in the official documentation instead of
guessing. PlanetScale publishes agent-readable docs:
Verify an endpoint path in the API reference before calling it. A 404 from
an unverified path is a wrong path, not a finding; do not record it as
platform state and do not conclude "not configured" from it.
Verified interface notes (recheck against the docs when a command fails):
pscale database show <database> --org <org> — the org is a flag, not a
positional argument.
pscale api <path> takes org-relative paths such as
organizations/{org}/databases/{db}/branches/{branch} — there is no
get subcommand and no /v1/ prefix. Pass query parameters with
-Q key=value flags; embedding ?/& in the path breaks under shell
globbing.
pscale webhook list <database> --org <org> — the database is a
positional argument. pscale backup list <database> <branch> requires
the branch.
pscale branch connections top <database> <branch> — live read-only
session inventory works for Postgres and Vitess over a reserved
administrative connection. Do not cancel queries or terminate connections
unless the operator explicitly approves that operational action.
- Query Insights is public API. Live query telemetry:
.../branches/{branch}/insights (per-pattern statistics; supports
from/to/period, q, sort, dir, tablet_type, type,
fields, and pagination). Related endpoints under the same branch path:
insights/errors, insights/anomalies, insights/tags,
insights/tags/summaries, insights/{fingerprint} (individual
executions), insights/{fingerprint}/summary, and
insights/{fingerprint}/traffic/budgets. The query-patterns path
returns generated report metadata, not live patterns.
- Traffic budgets:
.../branches/{branch}/traffic/budgets. The CLI has no
pscale traffic-control budget list; use the API for inventory.
- Postgres roles: list via
.../branches/{branch}/roles; fetch a single
role by ID, not name (pscale role get <db> <branch> <role-id>).
- IP restrictions: database-level
organizations/{org}/databases/{db}/cidrs. Branch-level IP-restriction
paths are not valid.
- Schema recommendations: database-level
.../databases/{db}/schema-recommendations (the branch-level path is
not valid). Requesting page=2 currently returns 404 even when the
response reports next_page; use the database object's
open_schema_recommendations_count as the authoritative total, treat
the returned page as a sample, and state in the report when the itemized
list covers only part of the total.
- PITR state and branch-level backup policies have no verified read path;
record backup posture from
pscale backup list and the database-level
backup policy, and mark PITR "not assessed in this run" rather than
probing paths.
- List endpoints paginate; follow the pagination parameters until
exhausted before reporting counts (except the schema-recommendations
case above).
Record access failures (403s, missing token scopes, timeouts) in the
internal run log for the operator. They are not findings and do not enter
the customer report (see ../planetscale-customer-report-template/SKILL.md).
Inventory checklist
Database identity
Record:
- Organization.
- Database.
- Branch.
- Engine: Vitess or Postgres.
- Region and cloud provider.
- Production/development branch status.
- Branch protection and safe workflow state.
- Size and cluster shape.
Branches and schema workflow
For Vitess, record:
- Production branch.
- Whether safe migrations are enabled for production and staging branches.
- Open deploy requests.
- Deploy request approval setting.
- Pending schema changes.
- Whether branch strategy has a staging branch with safe migrations enabled.
For Postgres, record:
- Branch list.
- Whether branches were created from backup or empty.
- Whether schema changes are managed manually, through migrations, or through an ORM.
- Whether a separate branch is used for migration testing.
- Whether the team expects Vitess-style deploy requests; if yes, flag that Postgres branches do not use deploy requests in the same way.
Observability
Record:
- Insights availability.
- Whether query tags are present.
- Which tags appear.
- Whether high-cardinality tags are present.
- Whether complete/raw query collection is enabled.
- Active anomalies.
- Query patterns with high latency, high rows read, high error rate, or high execution count.
- Postgres CPU-heavy query patterns and Vitess vindex-usage data when exposed
by the Insights interface in use.
- Whether application deploy identifiers are visible in comments or tags.
Recommendations
Record:
- Open schema recommendations.
- Recommendation type.
- Affected table/query.
- Proposed DDL or action.
- Whether a branch/deploy workflow exists to evaluate it safely.
- Whether the recommendation can be implemented as application code, ORM migration, or database DDL.
Webhooks and automation
Record:
- Configured webhooks.
- Subscribed events.
- Enabled state.
- Last delivery success or failure.
- Destination category: Slack, PagerDuty, internal automation, CI, agent queue, unknown.
- Whether webhook signature verification is documented or implemented.
- Whether webhook handling is idempotent and asynchronous.
Postgres Traffic Control
For Postgres only, record:
- Existing budgets and rules.
- Budget modes: off, warn, enforce.
- Limits: rate, capacity, burst, concurrency, warning threshold.
- Rules by fingerprint, keyspace, query kind, or tags.
- Whether rules are tied to meaningful SQLCommenter tags.
- Whether any production budget is in enforce mode.
Postgres safety
For Postgres only, record:
- Application role usage.
- Whether apps use the default role.
- Whether app roles are least-privilege.
- Whether pg_strict is enabled for application roles.
- Whether PgBouncer is used for appropriate workloads.
- Whether live connections show blockers, idle-in-transaction sessions, or
connection saturation during an active incident.
- Whether private connectivity and IP restrictions are configured.
- Whether backup retention and PITR meet the customer’s recovery expectations.
Vitess safety
For Vitess only, record:
- Safe migrations state.
- Deploy request workflow.
- Admin approval requirement.
- Gated deployment usage.
- Schema revert availability.
- Branch and keyspace topology.
- Sharding/vschema status.
- Whether sharded query patterns use relevant vindexes.
- Backups and restore posture.
Evidence format
For every finding, include evidence:
- Source: MCP, CLI, API, dashboard-observed, SQL read-only, repository file.
- Path or command used.
- Timestamp.
- Raw value or concise excerpt.
- Confidence: high, medium, low.
Output
Return:
- Inventory table.
- Missing evidence table.
- Risk flags.
- Recommended next skills to run.
End with:
“No changes have been applied.”
1---2name: planetscale-readonly-inventory3description: Collect read-only evidence about PlanetScale org, database, branches, webhooks, backups, roles, Insights, recommendations, and traffic configuration.4---5
6# Read-only inventory
7
8## Purpose
9
10Build an evidence-backed inventory of a PlanetScale database without making changes.
11
12## Allowed actions
13
14Allowed by default:
15
16- List organizations, databases, branches, keyspaces, regions, and sizes.
17- Read branch metadata.
18- Read webhook configuration.
19- Read schema recommendations.
20- Read Query Insights, anomalies, and query patterns through MCP or API.
21- Read traffic budgets and rules.
22- Read Postgres roles and non-secret role metadata.
23- Read backup schedules and restore metadata.
24- Read branch schema.
25- Inspect live connection/session metadata with the Connections CLI view.
26- Inspect repository files for frameworks, ORMs, migrations, SQL tagging, and connection config.
27- Inspect Terraform or other infrastructure-as-code definitions for
28 PlanetScale roles, backups, backup policies, Postgres parameters, and
29 supported extensions.
30
31Not allowed without explicit approval:
32
33- Any create, update, delete, enable, disable, reset, deploy, restore, promote, enforce, or apply operation.
34- Any SQL mutation.
35- Any command that emits new credentials unless the operator explicitly asked for credential work.
36
37## Interfaces and documentation grounding
38
39Ground every command and endpoint in the official documentation instead of
40guessing. PlanetScale publishes agent-readable docs:
41
42- Docs index: https://planetscale.com/docs/llms.txt
43- Any docs page as markdown: append `.md` to its URL
44- API reference: https://planetscale.com/docs/openapi.yaml (OpenAPI 3.0)
45
46Verify an endpoint path in the API reference before calling it. A 404 from
47an unverified path is a wrong path, not a finding; do not record it as
48platform state and do not conclude "not configured" from it.
49
50Verified interface notes (recheck against the docs when a command fails):
51
52- `pscale database show <database> --org <org>` — the org is a flag, not a
53 positional argument.
54- `pscale api <path>` takes org-relative paths such as
55 `organizations/{org}/databases/{db}/branches/{branch}` — there is no
56 `get` subcommand and no `/v1/` prefix. Pass query parameters with
57 `-Q key=value` flags; embedding `?`/`&` in the path breaks under shell
58 globbing.
59- `pscale webhook list <database> --org <org>` — the database is a
60 positional argument. `pscale backup list <database> <branch>` requires
61 the branch.
62- `pscale branch connections top <database> <branch>` — live read-only
63 session inventory works for Postgres and Vitess over a reserved
64 administrative connection. Do not cancel queries or terminate connections
65 unless the operator explicitly approves that operational action.
66- Query Insights is public API. Live query telemetry:
67 `.../branches/{branch}/insights` (per-pattern statistics; supports
68 `from`/`to`/`period`, `q`, `sort`, `dir`, `tablet_type`, `type`,
69 `fields`, and pagination). Related endpoints under the same branch path:
70 `insights/errors`, `insights/anomalies`, `insights/tags`,
71 `insights/tags/summaries`, `insights/{fingerprint}` (individual
72 executions), `insights/{fingerprint}/summary`, and
73 `insights/{fingerprint}/traffic/budgets`. The `query-patterns` path
74 returns generated report metadata, not live patterns.
75- Traffic budgets: `.../branches/{branch}/traffic/budgets`. The CLI has no
76 `pscale traffic-control budget list`; use the API for inventory.
77- Postgres roles: list via `.../branches/{branch}/roles`; fetch a single
78 role by ID, not name (`pscale role get <db> <branch> <role-id>`).
79- IP restrictions: database-level
80 `organizations/{org}/databases/{db}/cidrs`. Branch-level IP-restriction
81 paths are not valid.
82- Schema recommendations: database-level
83 `.../databases/{db}/schema-recommendations` (the branch-level path is
84 not valid). Requesting `page=2` currently returns 404 even when the
85 response reports `next_page`; use the database object's
86 `open_schema_recommendations_count` as the authoritative total, treat
87 the returned page as a sample, and state in the report when the itemized
88 list covers only part of the total.
89- PITR state and branch-level backup policies have no verified read path;
90 record backup posture from `pscale backup list` and the database-level
91 backup policy, and mark PITR "not assessed in this run" rather than
92 probing paths.
93- List endpoints paginate; follow the pagination parameters until
94 exhausted before reporting counts (except the schema-recommendations
95 case above).
96
97Record access failures (403s, missing token scopes, timeouts) in the
98internal run log for the operator. They are not findings and do not enter
99the customer report (see `../planetscale-customer-report-template/SKILL.md`).
100
101## Inventory checklist
102
103### Database identity
104
105Record:
106
107- Organization.
108- Database.
109- Branch.
110- Engine: Vitess or Postgres.
111- Region and cloud provider.
112- Production/development branch status.
113- Branch protection and safe workflow state.
114- Size and cluster shape.
115
116### Branches and schema workflow
117
118For Vitess, record:
119
120- Production branch.
121- Whether safe migrations are enabled for production and staging branches.
122- Open deploy requests.
123- Deploy request approval setting.
124- Pending schema changes.
125- Whether branch strategy has a staging branch with safe migrations enabled.
126
127For Postgres, record:
128
129- Branch list.
130- Whether branches were created from backup or empty.
131- Whether schema changes are managed manually, through migrations, or through an ORM.
132- Whether a separate branch is used for migration testing.
133- Whether the team expects Vitess-style deploy requests; if yes, flag that Postgres branches do not use deploy requests in the same way.
134
135### Observability
136
137Record:
138
139- Insights availability.
140- Whether query tags are present.
141- Which tags appear.
142- Whether high-cardinality tags are present.
143- Whether complete/raw query collection is enabled.
144- Active anomalies.
145- Query patterns with high latency, high rows read, high error rate, or high execution count.
146- Postgres CPU-heavy query patterns and Vitess vindex-usage data when exposed
147 by the Insights interface in use.
148- Whether application deploy identifiers are visible in comments or tags.
149
150### Recommendations
151
152Record:
153
154- Open schema recommendations.
155- Recommendation type.
156- Affected table/query.
157- Proposed DDL or action.
158- Whether a branch/deploy workflow exists to evaluate it safely.
159- Whether the recommendation can be implemented as application code, ORM migration, or database DDL.
160
161### Webhooks and automation
162
163Record:
164
165- Configured webhooks.
166- Subscribed events.
167- Enabled state.
168- Last delivery success or failure.
169- Destination category: Slack, PagerDuty, internal automation, CI, agent queue, unknown.
170- Whether webhook signature verification is documented or implemented.
171- Whether webhook handling is idempotent and asynchronous.
172
173### Postgres Traffic Control
174
175For Postgres only, record:
176
177- Existing budgets and rules.
178- Budget modes: off, warn, enforce.
179- Limits: rate, capacity, burst, concurrency, warning threshold.
180- Rules by fingerprint, keyspace, query kind, or tags.
181- Whether rules are tied to meaningful SQLCommenter tags.
182- Whether any production budget is in enforce mode.
183
184### Postgres safety
185
186For Postgres only, record:
187
188- Application role usage.
189- Whether apps use the default role.
190- Whether app roles are least-privilege.
191- Whether pg_strict is enabled for application roles.
192- Whether PgBouncer is used for appropriate workloads.
193- Whether live connections show blockers, idle-in-transaction sessions, or
194 connection saturation during an active incident.
195- Whether private connectivity and IP restrictions are configured.
196- Whether backup retention and PITR meet the customer’s recovery expectations.
197
198### Vitess safety
199
200For Vitess only, record:
201
202- Safe migrations state.
203- Deploy request workflow.
204- Admin approval requirement.
205- Gated deployment usage.
206- Schema revert availability.
207- Branch and keyspace topology.
208- Sharding/vschema status.
209- Whether sharded query patterns use relevant vindexes.
210- Backups and restore posture.
211
212## Evidence format
213
214For every finding, include evidence:
215
216- Source: MCP, CLI, API, dashboard-observed, SQL read-only, repository file.
217- Path or command used.
218- Timestamp.
219- Raw value or concise excerpt.
220- Confidence: high, medium, low.
221
222## Output
223
224Return:
225
226- Inventory table.
227- Missing evidence table.
228- Risk flags.
229- Recommended next skills to run.
230
231End with:
232
233“No changes have been applied.”