Install any skill in seconds. Free to start, no credit card required.
Get Started Free →xu-xiang/postgres-patterns
PostgreSQL 数据库模式,用于查询优化、架构设计、索引和安全性。基于 Supabase 最佳实践。
Passed 21 of 22 test cases with the skill, and 20 of 22 without it.
2 fixed19 passed either way0 still failing1 broke
Tokens, turns and time describe resource use, not a dollar price.
One of 2 test cases the skill fixed. Same model, same prompt, with and without the skill.
We need a SQL query for a background worker queue in PostgreSQL. The query should select one pending job, mark it as processing, avoid blocking other workers trying to fetch work concurrently, and return the row.
| Checked | Without skill | With skill |
|---|---|---|
| Uses FOR UPDATE SKIP LOCKED to prevent locking contention between concurrent workers. | Passed | Passed |
| Uses a scalar subquery in the WHERE clause rather than a common table expression to identify the job ID. | Missed | Passed |
The instructions your model reads when the skill loads.
PostgreSQL 最佳实践快速参考。如需详细指导,请使用 database-reviewer 智能体。
| 查询模式 | 索引类型 | 示例 |
|---|---|---|
WHERE col = value | B-tree(默认) | CREATE INDEX idx ON t (col) |
WHERE col > value | B-tree | CREATE INDEX idx ON t (col) |
WHERE a = x AND b > y | 复合索引 | CREATE INDEX idx ON t (a, b) |
WHERE jsonb @> '{}' | GIN | CREATE INDEX idx ON t USING gin (col) |
WHERE tsv @@ query | GIN | CREATE INDEX idx ON t USING gin (col) |
| 时间序列范围查询 | BRIN | CREATE INDEX idx ON t USING brin (col) |
| 使用场景 | 正确类型 | 避免使用 |
|---|---|---|
| ID | bigint | int,随机 UUID |
| 字符串 | text | varchar(255) |
| 时间戳 | timestamptz | timestamp |
| 货币 | numeric(10,2) | float |
| 标志位 | boolean | varchar,int |
复合索引顺序:
test cases passed, vs 20 / 22 without
Published skills whose descriptions closely match this one, with their headline benchmark lift.
More skills from the same source and nearby in the registry, with their headline benchmark lift.