planetscale-schema-recommendations-agent-loop

作成者: planetscale

PlanetScaleのスキーマレコメンデーションを安全にトリアージし、本番環境への変更を適用せずに、レビュー済みのブランチ、マイグレーション、イシュー、またはプルリクエストに変換します。

npx skills add https://github.com/planetscale/skills --skill planetscale-schema-recommendations-agent-loop

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のその他のスキル

neki
planetscale
PlanetScaleによるシャーディングされたPostgres製品Nekiの概要と情報。Neki関連のタスクやスケーリング・シャーディングの必要性がある場合に読み込む…
vitess
planetscale
Vitessのベストプラクティス、クエリ最適化、およびPlanetScale Vitessデータベースの接続トラブルシューティング。Vitessデータベース、シャーディングを扱う際に読み込んでください…
planetscale-autonomous-execution-mode
planetscale
オペレーターが明示的にリスクを認識した場合、承認されたPlanetScaleの変更をステップごとの承認なしでエンドツーエンドで実行します。定義する…
planetscale-best-practices-matrix
planetscale
エンジンごとに適用可能なPlanetScaleの安全性、可観測性、自動化の推奨事項を判断するための簡潔な機能マトリックス。
planetscale-change-gates-and-approval-contract
planetscale
PlanetScale、データベース、リポジトリ、認証情報、ネットワーク、または自動化の変更に対して、明示的な承認ゲートを適用します。
planetscale-codebase-sqlcommenter-instrumentation
planetscale
PlanetScaleに接続されたアプリケーションリポジトリを検査し、SQLCommenter互換のクエリタグ付けパッケージと規約を推奨します。
planetscale-customer-report-template
planetscale
インベントリと関連するレビュースキルを実行した後、最終的なPlanetScaleのベストプラクティスレポートを作成します。
planetscale-mcp-agent-operating-model
planetscale
PlanetScale MCP、Insights、スキーマ推奨、およびリポジトリ作業において、自律的な本番環境の変更を行わずに安全なエージェント動作を設定します。