Planetscale Schema Recommendations Agent Loop

planetscale/skills/planetscale-schema-recommendations-agent-loop

作者 planetscale999045cfbad7无许可证133 个星标收录于 2026年10月8日更新于 2026年10月8日仓库昨天更新

Safely triage PlanetScale schema recommendations and turn them into reviewed branches, migrations, issues, or pull requests without applying production changes.

AI 生成的概览

将 PlanetScale 架构建议分诊为经过审查的分支、迁移、议题或拉取请求,而不应用生产变更。

功能
引导智能体收集未处理的 PlanetScale 架构建议、对其类型进行分类,并回答关于相关性、触发查询、应用代码路径、迁移框架适配性、影响和回滚的分诊问题。它为 Vitess 和 Postgres 提供特定引擎的实施路径,将建议与代码仓库关联,并执行阻止直接应用的安全检查。输出是每条建议的结构化报告,涵盖证据、受影响的架构、建议的 DDL、安全实施路径、验证计划、回滚计划和审批要求,并以未应用任何建议的声明结尾。
适用场景
适用于审查 PlanetScale 架构建议并规划安全、经过审查的变更(如分支、迁移、议题或拉取请求)时。适合希望将建议转化为实施方案而非直接应用到生产的团队。
运行要求
仅为说明性内容,不附带脚本。需要访问 PlanetScale 架构建议和 Insights 证据,并了解应用代码仓库、迁移系统、引擎(Vitess 或 Postgres)和目标分支。未指定凭据或网络访问要求。

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/skills位于planetscale-schema-recommendations-agent-loop提交999045c

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架