Skip to main content
skill CX Codex

planetscale-schema-recommendations-agent-loop — Claude Code skill

Turns open PlanetScale schema recommendations into a plan, issue, branch or PR. It never applies production changes on its own.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add planetscale/skills --skill planetscale-schema-recommendations-agent-loop -a claude-code
Open on GitHub

What planetscale-schema-recommendations-agent-loop does

The skill takes open PlanetScale schema recommendations and sorts them by type: an index for a slow query, a redundant index, primary key ID exhaustion, an unused table, a legacy charset. For each one the agent works through triage questions — is it still relevant, which query patterns triggered it, which code paths produce those queries, can the change be expressed in the app's migration framework.

The path then splits by engine. On Vitess: a development branch, the schema change applied there only after approval, a deploy request, then review of schema, shard impact, data-loss warnings and conflicts. On Postgres: DDL moved into the app's migration framework, tested against a non-production branch, application tests run, PR opened. Before approval the default output is an issue or PR with a migration proposal, not a live deploy request. When a repository is available, the skill searches for table and column names, ORM models, migrations, query fingerprints and route names.

There is a safety block. Direct application is blocked when the recommendation is stale, the table is small enough that the benefit is unclear, the index duplicates an existing one or hurts write-heavy workloads, or when owner confirmation and a test plan are missing. That last part is worth checking against your team's ownership of the schema before you point the loop at a real database.

What it helps with

  • triage open PlanetScale schema recommendations by type
  • trace the queries that triggered a recommendation back to code
  • build a safe migration plan with a rollback path
  • file a proposal as an issue or PR instead of deploying
  • check whether a new index duplicates an existing one

Example prompts for the agent

  • triage the open PlanetScale schema recommendations and propose a migration plan
  • find the code that issues these queries and file an issue
  • open a Postgres migration PR with a rollback plan

How to install planetscale-schema-recommendations-agent-loop

1Skills CLI (Vercel)

npx skills add planetscale/skills --skill planetscale-schema-recommendations-agent-loop -a claude-code

2Manually: put the files in place

~/.claude/skills/planetscale-schema-recommendations-agent-loop/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/planetscale-schema-recommendations-agent-loop/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about planetscale-schema-recommendations-agent-loop

How do I install planetscale-schema-recommendations-agent-loop in Claude?

Run npx skills add planetscale/skills --skill planetscale-schema-recommendations-agent-loop -a claude-code. The skill lands in ~/.claude/skills/planetscale-schema-recommendations-agent-loop/SKILL.md.

What does planetscale-schema-recommendations-agent-loop do?

It triages PlanetScale schema recommendations and turns them into an implementation plan, issue, branch, migration or PR. It does not apply the recommendations itself.

Does the skill apply changes to production?

No. Before approval it produces an issue or PR with a migration proposal, and the production migration runs only after sign-off.

Source text

SKILL.md · MIT
---
name: planetscale-schema-recommendations-agent-loop
description: Safely triage PlanetScale schema recommendations and turn them into reviewed branches, migrations, issues, or pull requests without applying production changes.
---

# Schema recommendations agent loop

## Purpose

Use PlanetScale schema recommendations as high-quality input to agents. Convert recommendations into safe implementation plans, issues, branches, migrations, or pull requests. Do not apply recommendations directly.

## Inputs

Collect:

- Open schema recommendations.
- Recommendation type.
- Affected table, keyspace, schema, and query pattern.
- Suggested DDL.
- Supporting Insights evidence.
- Application repository and migration system.
- Engine: Vitess or Postgres.
- Target branch.

## Recommendation types to recognize

- Add index for inefficient query.
- Remove redundant index.
- Prevent primary key ID exhaustion.
- Drop unused table.
- Upgrade legacy charset or collation.
- Other DDL recommendation.

## Triage questions

For each recommendation, answer:

- Is this still open and relevant?
- Which query patterns triggered it?
- Which application code paths generate those queries?
- Is the recommendation safely expressible in the application’s migration framework?
- Does the ORM/schema source of truth need to change?
- Can it be tested on a non-production branch?
- What is the expected impact on reads, writes, storage, and deploy time?
- Is there a rollback or revert path?
- Is there a competing recommendation or migration?

## Engine-specific implementation path

### Vitess

Recommended path:

1. Create or use a development branch.
2. Apply the schema change to that branch only after approval.
3. Open a deploy request only after approval.
4. Use deploy request review to inspect schema, shard impact, data-loss warnings, lint errors, and conflicts.
5. Use normal safe migration path unless instant deployment is explicitly justified.
6. Deploy only after approval.
7. Monitor Insights and anomaly state after deployment.

Default output before approval: issue or PR with migration proposal, not a live deploy request.

### Postgres

Recommended path:

1. Convert DDL into the application’s migration framework where possible.
2. Test against a non-production branch.
3. Run application tests and relevant query checks.
4. Open PR.
5. Apply production migration only after approval.
6. Use backups/PITR runbook as recovery plan, not as a substitute for migration review.

Default output before approval: migration PR or issue, not production DDL.

## Codebase correlation

When a repository is available:

- Search for the table and column names.
- Search for ORM model definitions.
- Search for migrations.
- Search for query fingerprints, route tags, job names, and controller/action names from Insights.
- Identify whether the recommendation should be implemented in database DDL, ORM schema, raw migration, or application query code.

## Safety checks before proposing implementation

Block direct application when:

- The recommendation is stale or already addressed.
- The affected table is small enough that the benefit is unclear.
- The index would be redundant with an existing index.
- The index would hurt write-heavy workloads without enough read benefit.
- The table appears unused but repository references are ambiguous.
- Dropping a table or index lacks owner confirmation.
- The migration framework has a different schema source of truth.
- The recommendation targets production and no branch/test plan exists.

## Output

For each recommendation, produce:

- Recommendation ID/number.
- Type.
- Severity and expected benefit.
- Evidence from Insights.
- Affected schema.
- Suggested DDL.
- Application code owner or likely location.
- Safe implementation path.
- Validation plan.
- Rollback/revert plan.
- Approval requirement.

End with:

“No schema recommendations have been applied.”

© planetscale · MIT · planetscale/skills

Similar skills

All skills for Data and databases →

From the same set14

planetscale-mcp-agent-operating-model Configures safe agent operations with PlanetScale MCP. It lets agents inspect telemetry and open migration PRs while blocking direct changes to production. CX Codex +1 2,400installs planetscale-autonomous-execution-mode Lets an agent carry approved PlanetScale changes through plan, execution, verification and reporting without per-step approval. The operator accepts the risk once, for a named scope. CX Codex +1 1,800installs planetscale-safe-orchestrator Runs the complete PlanetScale best-practices assessment across engines and code, then compiles a unified report. Helpful before schema changes or production traffic tuning. CX Codex +1 1,800installs planetscale-query-insights-and-tags A skill that reads PlanetScale Insights to find expensive and risky queries, then recommends SQLCommenter tags so you can trace load back to a route or job. CX Codex +1 1,800installs planetscale-postgres-safety-review Reviews PlanetScale Postgres setups across roles, pg_strict, Traffic Control, and backups. It flags database reliability gaps without applying unapproved changes. CX Codex +1 1,800installs planetscale-best-practices-matrix The skill maps database findings to PlanetScale recommendations and tells you what applies to Vitess and what to Postgres. CX Codex +1 1,800installs planetscale-vitess-safety-review Reviews a PlanetScale Vitess database for safe migrations, deploy requests, Insights and webhooks. Produces a report, applies nothing. CX Codex +1 1,700installs planetscale-webhook-automation-recommendations Recommends PlanetScale webhook subscriptions and safe automation patterns for database alerts, anomalies, and deploy requests. CX Codex +1 1,700installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor