03-postgres-safety-review

用于评估 PlanetScale Postgres 在流量控制、查询标签、角色、pg_strict、备份/时间点恢复(PITR)、私有连接、Webhook、分支以及安全代理操作方面表现的评估技能。

仓库最近推送
GitHub Stars
137
Forks
7
Issues / PRs
2

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "03-postgres-safety-review":https://skillpi.com/zh/skills/deepskill-b736ee48ccbe41bfca4b598ba092e789171401eeecdebf815a54cf376d178199。安装前核对上游来源和版本:https://github.com/planetscale/skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

github.com

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

用于评估 PlanetScale Postgres 在流量控制、查询标签、角色、pg_strict、备份/时间点恢复(PITR)、私有连接、Webhook、分支以及安全代理操作方面表现的评估技能。

0 下载

介绍来源: third_party · planetscale · 1.0.0 参考来源

SkillPi 解读

能完成的任务
翻译待完成,请参阅来源文档。
适合谁
来源文档未说明。
输入和输出
翻译待完成,请参阅来源文档。
软件、账号及付费要求
来源文档未说明。
限制与区别
来源文档未说明。
实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: planetscale-postgres-safety-review
description: Review PlanetScale Postgres for Traffic Control, query tags, roles, pg_strict, backups/PITR, private connectivity, webhooks, branches, and safe agent operation.

Postgres safety review

Purpose

Recommend best practices for a PlanetScale Postgres database. Focus on availability protection, application isolation, recovery, safe automation, and observability. Do not apply changes.

Branch and schema workflow

PlanetScale Postgres branches do not use Vitess-style deploy requests. Schema changes are made directly to each branch, and production schema changes should be managed through the application’s normal migration workflow with a branch validation step.

Check:

  • Whether a development or test branch exists.
  • Whether branches are empty or restored from backup.
  • Whether migrations are tested against a branch before production.
  • Whether application migrations are reversible or have a documented rollback strategy.
  • Whether production DDL is manually reviewed.

Recommend:

  • Create or use a non-production branch for migration testing.
  • Run migration validation and application tests against that branch.
  • Treat production migration application as an explicit human-approved deployment step.
  • Use PITR/backup restore branches for incident recovery, not as an automatic rollback mechanism.

Do not create branches, run migrations, or restore backups without approval.

Roles and least privilege

Check whether the application connects with the default role. Flag this as a safety gap.

Recommend:

  • Use user-defined application roles, not the default role, for application servers.
  • Separate roles by service, environment, and access pattern.
  • Use read-only roles for analytics, dashboards, reporting, and agents that do not need writes.
  • Use short-lived or purpose-limited roles for automation.
  • When Terraform manages PlanetScale Postgres roles, prefer planetscale_postgres_redacted_branch_role for roles whose password should stay out of Terraform state; reset the password through the API or dashboard and store it in the team's secret manager.
  • Document credential rotation without application downtime.

Do not create, reset, delete, or rotate roles without approval.

pg_strict

Check whether pg_strict is enabled for application roles.

Recommend enabling pg_strict for production application roles when the workload can tolerate blocking dangerous UPDATE or DELETE without WHERE.

Recommended rollout:

  1. Enable warning mode or evaluate in non-production where possible.
  2. Fix queries that would be blocked.
  3. Enable strict blocking for application roles.
  4. Document approved one-off override procedure.

Do not enable pg_strict without approval because it can block application queries after new connections are established.

Query Insights and pginsights

Review:

  • Slow queries.
  • High rows-read queries.
  • High CPU query patterns (sort=cpuTime or sort=percentCpuTime on the Insights API).
  • High-frequency queries.
  • Erroring queries.
  • Active anomalies.
  • Query tags.
  • Whether literal/raw query collection is enabled.

Raw query collection is governed by the pginsights.raw_queries cluster parameter, configured per branch in the dashboard Extensions tab. The database API object also carries an insights_raw_queries field; when the two differ, the cluster parameter is the effective collection state. Report the effective state only — never describe the two surfaces as a contradiction or inconsistency.

Recommend:

  • Treat raw query collection as a capability, per ../04-query-insights-and-tags/SKILL.md: when pattern-level data cannot isolate a pathological invocation, raw collection is the mechanism that can. Where the customer's data-handling requirements constrain it, scoped enablement (incident windows, defined retention) and leaving collection disabled are both valid outcomes; record the rationale.
  • Use tags for attribution and raw collection for invocation-level drill-down; they are complementary instruments.
  • Use deploy SHA and route/job tags to correlate regressions with application deploys.

Query tags

Evaluate whether SQL comments contain structured SQLCommenter tags.

Recommend tags that support both Insights and Traffic Control:

  • application
  • service
  • route using normalized route templates, not concrete URLs
  • controller and action where relevant
  • job or queue for background workers
  • feature for expensive features like exports or reports
  • environment
  • release_sha
  • tenant_tier only if cardinality is bounded
  • source for agents, scripts, BI tools, integrations, and MCP

Avoid high-cardinality or sensitive tags:

  • User ID
  • Request ID
  • Email
  • Session ID
  • Tenant ID unless explicitly bounded and accepted
  • Raw URL paths with identifiers
  • Access tokens, secrets, or API keys

Database Traffic Control

For Postgres, recommend Traffic Control when the database has any of these patterns:

  • Public or customer-triggered expensive features.
  • Exports, reports, analytics, or ad hoc search sharing the OLTP database.
  • Background jobs that can starve interactive traffic.
  • Third-party integrations with unpredictable query volume.
  • Agent-generated queries.
  • Known query fingerprints that occasionally run away.
  • Tenant or route classes that need bounded database resource use.

Default recommendation:

  • Start budgets in warn mode.
  • Use query tags where possible.
  • Use fingerprint-specific rules for known offenders.
  • Use enforce mode only after observing warnings and confirming no critical traffic is blocked.
  • Maintain an emergency disable procedure.

Do not create budgets or enforce rules without approval.

Backups and PITR

Check:

  • Automated backup schedule.
  • Retention window.
  • WAL/PITR availability.
  • Manual backups that prevent deletion.
  • Restore drill history.
  • Recovery runbook.

Recommend:

  • Confirm default backups meet the customer’s RPO/RTO.
  • Increase retention or add backup schedules if the customer’s recovery window exceeds defaults.
  • If Terraform is the customer's source of truth, manage backup policies in Terraform so retention and schedule changes are reviewed with the rest of the infrastructure code.
  • Run a restore drill to a new branch.
  • Document the exact application cutover procedure after restore.

Do not restore or create emergency backups without approval. Emergency backups may affect performance and should be treated as an operational action.

Connections, pooling, and network safety

Check:

  • Whether app uses direct port 5432 or PgBouncer port 6432.
  • Whether connection pool size matches runtime and deployment model.
  • Whether serverless or edge environments can create connection storms.
  • Live connection/session pressure through pscale branch connections top, including blockers and idle-in-transaction sessions when diagnosing active incidents.
  • Whether private connectivity is configured.
  • Whether IP restrictions are configured.
  • Whether public access remains available unexpectedly.

Recommend:

  • Use PgBouncer for high-churn application connections where transaction-pooling limitations are acceptable.
  • Use direct connections for session-dependent features that PgBouncer transaction mode cannot support.
  • Use AWS PrivateLink or GCP Private Service Connect for private network requirements.
  • Use IP restrictions to reduce public exposure.
  • Be explicit that private connectivity does not automatically block public access; IP restrictions or equivalent controls are required for private-only posture.

Do not change network restrictions without approval. Network changes can break application connectivity.

Extensions

Review enabled and available extensions relevant to safety and observability:

  • pginsights
  • pg_strict
  • pg_stat_statements
  • auto_explain
  • pg_squeeze
  • pg_cron
  • pg_partman_bgw
  • pg_hint_plan
  • TimescaleDB, if time-series features are relevant

Recommend extensions only when use case is clear. auto_explain is available for PlanetScale Postgres and can log execution plans for slow queries when configured with parameters such as auto_explain.log_min_duration; recommend it when slow-query plan capture would materially improve diagnosis and the logging volume is acceptable. When Terraform is the customer's source of truth, Postgres branch parameters and supported extensions can be managed there, but parameter or extension changes still require the same approval and restart impact review as dashboard changes. Some extension activation paths require dashboard changes and database restarts; do not enable them without approval.

Webhook recommendations for Postgres

Evaluate and recommend webhooks for:

  • branch.anomaly
  • branch.out_of_memory
  • branch.primary_promoted
  • branch.ready
  • branch.start_maintenance
  • cluster.storage
  • database.access_request
  • branch.schema_recommendation if available
  • webhook.test for setup validation

Recommended automation behavior:

  • Alerts: anomaly, out-of-memory, primary promotion, storage, maintenance.
  • Agent intake: anomaly, schema recommendation.
  • Human approval: any generated Traffic Control, schema, role, or network change.

Output

Return:

  • Current Postgres safety posture.
  • Highest-risk availability gaps.
  • Recommended Traffic Control plan.
  • Recommended role and pg_strict plan.
  • Recommended backup/PITR plan.
  • Recommended network posture plan.
  • Recommended query tagging plan.
  • Proposed changes requiring approval.

End with:

“No Postgres changes have been applied.”

当前收录版本

1.0.0

核对来源版本 ↗

安全与评测信息

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值95/100

亮点

  • 提供全面的 PlanetScale Postgres 安全性和可用性审查,涵盖多个关键领域。
  • 内容详实,具有明确的检查项和推荐实践,直接解决生产环境中的核心痛点。
  • 显著提升数据库运维的安全性和可靠性。
触发精准95/100

亮点

  • description 清晰描述了 Skill 的核心功能,触发词精准完整。
  • frontmatter 中的 name 和 description 与顶层一致,覆盖多种变体,边界清晰。
结构规范95/100

亮点

  • 结构非常清晰,分为多个逻辑性强的章节,易于理解执行流程。
  • 每个章节都包含明确的 Check 和 Recommend 部分,frontmatter 完整。
执行可靠95/100

亮点

  • 内容基于 PlanetScale Postgres 的官方功能和最佳实践,工具来源明确。
  • 所有推荐都强调了审批机制,覆盖了主要异常情况,并提供了详细的操作建议。
证据可验 (前四项均值)95/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

100 / 100 · skillpi-20261123-no-r3-v1

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

  • 账号、密钥或授权

    使用专用、最小权限账号,不把密钥粘贴到公开内容或命令日志;核对接收数据的服务与租户。

    主文档提及 · 第 47 行

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

来源文档未说明。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。