@tamsensedev/runner 0.10.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +5 -5
- package/README.md +61 -50
- package/dist/cli.js +1188 -324
- package/dist/cli.js.map +1 -1
- package/dist/recorder.cjs +42 -6
- package/dist/recorder.cjs.map +1 -1
- package/library/.claude-plugin/plugin.json +5 -5
- package/library/THIRD_PARTY_NOTICES.md +123 -123
- package/library/agents/code-architect.md +67 -67
- package/library/agents/code-explorer.md +61 -61
- package/library/agents/code-reviewer.md +73 -73
- package/library/agents/code-simplifier.md +62 -62
- package/library/agents/design-critic.md +52 -52
- package/library/agents/second-opinion.md +64 -64
- package/library/agents/security-auditor.md +86 -86
- package/library/agents/silent-failure-hunter.md +70 -70
- package/library/agents/test-coverage-analyzer.md +78 -78
- package/library/agents/test-runner.md +48 -48
- package/library/agents/ui-tester.md +50 -50
- package/library/licenses/Apache-2.0.txt +202 -202
- package/library/skills/accessibility/SKILL.md +144 -144
- package/library/skills/accessibility/references/wcag-checks.md +168 -168
- package/library/skills/addressing-review-feedback/SKILL.md +109 -109
- package/library/skills/app-screens/SKILL.md +96 -96
- package/library/skills/app-screens/references/shell-kpis-charts.md +108 -108
- package/library/skills/app-screens/references/states-density-phone.md +54 -54
- package/library/skills/app-screens/references/tables-forms-settings.md +104 -104
- package/library/skills/avoiding-generic-ai-design/SKILL.md +92 -92
- package/library/skills/avoiding-generic-ai-design/references/tells.md +112 -112
- package/library/skills/clean-commits/SKILL.md +85 -85
- package/library/skills/design-review/SKILL.md +107 -107
- package/library/skills/design-review/references/critique-passes.md +101 -101
- package/library/skills/design-review/references/screenshot-procedure.md +121 -121
- package/library/skills/differential-security-review/LICENSE +427 -427
- package/library/skills/differential-security-review/SKILL.md +105 -105
- package/library/skills/differential-security-review/references/adversarial.md +115 -115
- package/library/skills/differential-security-review/references/methodology.md +145 -145
- package/library/skills/differential-security-review/references/patterns.md +108 -108
- package/library/skills/false-positive-check/LICENSE +427 -427
- package/library/skills/false-positive-check/SKILL.md +95 -95
- package/library/skills/false-positive-check/references/bug-class-verification.md +128 -128
- package/library/skills/false-positive-check/references/deep-verification.md +113 -113
- package/library/skills/false-positive-check/references/evidence-templates.md +93 -93
- package/library/skills/false-positive-check/references/false-positive-patterns.md +122 -122
- package/library/skills/false-positive-check/references/gate-reviews.md +36 -36
- package/library/skills/false-positive-check/references/standard-verification.md +80 -80
- package/library/skills/focused-implementation/SKILL.md +104 -104
- package/library/skills/implementation-plan/SKILL.md +66 -66
- package/library/skills/interface-design/SKILL.md +144 -144
- package/library/skills/interface-design/references/craft-defaults.md +130 -130
- package/library/skills/interface-design/references/new-direction.md +62 -62
- package/library/skills/interface-design/references/writing.md +52 -52
- package/library/skills/interface-polish/SKILL.md +103 -103
- package/library/skills/interface-polish/references/detail-rules.md +154 -154
- package/library/skills/interface-polish/references/worst-case-data.md +158 -158
- package/library/skills/motion-design/SKILL.md +106 -106
- package/library/skills/motion-design/references/recipes.md +243 -243
- package/library/skills/postgres-performance/SKILL.md +97 -97
- package/library/skills/postgres-performance/references/rules.md +265 -265
- package/library/skills/project-orientation/SKILL.md +77 -77
- package/library/skills/reviewing-changes/SKILL.md +183 -183
- package/library/skills/safe-database-changes/SKILL.md +111 -111
- package/library/skills/safe-database-changes/references/backfills.md +75 -75
- package/library/skills/safe-database-changes/references/migration-tools.md +69 -69
- package/library/skills/safe-database-changes/references/postgres-ddl.md +199 -199
- package/library/skills/security-review/SKILL.md +132 -132
- package/library/skills/security-review/references/checks-by-area.md +107 -107
- package/library/skills/security-review/references/do-not-report.md +86 -86
- package/library/skills/spec-writing/SKILL.md +144 -144
- package/library/skills/systematic-debugging/SKILL.md +130 -130
- package/library/skills/systematic-debugging/references/flaky-tests.md +51 -51
- package/library/skills/systematic-debugging/references/root-cause-tracing.md +55 -55
- package/library/skills/task-interview/SKILL.md +84 -84
- package/library/skills/test-driven-development/SKILL.md +116 -116
- package/library/skills/test-driven-development/references/writing-good-tests.md +85 -85
- package/library/skills/ui-testing/SKILL.md +102 -102
- package/library/skills/ui-testing/references/headless-check.md +295 -280
- package/library/skills/ui-testing/references/local-stand.md +51 -51
- package/library/skills/ui-testing/references/playwright-patterns.md +134 -134
- package/library/skills/ui-testing/references/recording.md +61 -58
- package/library/skills/verification-before-completion/SKILL.md +113 -113
- package/library/skills/web-interface-guidelines/SKILL.md +202 -202
- package/package.json +46 -46
|
@@ -1,97 +1,97 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: postgres-performance
|
|
3
|
-
description: Use when writing or reviewing PostgreSQL queries, ORM data access, indexes, pagination, row-level security policies or connection handling, or when an endpoint or page is slow. Checks missing indexes, N+1 queries, OFFSET pagination, long transactions, racy upserts and pool misuse, and verifies fixes with EXPLAIN on a local database.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# PostgreSQL performance
|
|
7
|
-
|
|
8
|
-
Most slow Postgres code comes from a short list of mistakes: a query without a usable index, a query inside a loop, deep OFFSET pages, transactions held open across network calls, and connections opened per request. This skill finds them in a diff or in slow code and proves the fix with a query plan.
|
|
9
|
-
|
|
10
|
-
The project's conventions win (naming, ORM style, how indexes are declared, which database version it targets). Schema changes that come out of this work, such as new indexes, must follow the `safe-database-changes` skill (build indexes without blocking writes, separate migration).
|
|
11
|
-
|
|
12
|
-
## Safety
|
|
13
|
-
|
|
14
|
-
- Never connect to a real, shared or production database to "check" a plan. Work on a throwaway local database (see `safe-database-changes` for how to get one) or reason from the code.
|
|
15
|
-
- `EXPLAIN ANALYZE` executes the statement. For INSERT, UPDATE or DELETE, run it only on the throwaway database, inside `BEGIN; ... ROLLBACK;`.
|
|
16
|
-
- Do not change server settings (`ALTER SYSTEM`, `max_connections`, pooler config) from a task run. Put recommended settings in the report.
|
|
17
|
-
|
|
18
|
-
## Process
|
|
19
|
-
|
|
20
|
-
### 1. Find the SQL that actually runs
|
|
21
|
-
|
|
22
|
-
ORMs hide the real queries. Read the data-access code and, when you can run it locally, turn on query logging for one request or test: Prisma `log: ['query']`, Django `connection.queries` or `DEBUG` SQL logging, Rails log output, SQLAlchemy `echo=True`, Sequelize `logging`, TypeORM `logging: true`, Drizzle `logger: true`, or `log_statement = 'all'` on the throwaway database. Count queries per request, not just their speed.
|
|
23
|
-
|
|
24
|
-
### 2. Check against the list, highest impact first
|
|
25
|
-
|
|
26
|
-
| Priority | Look for | Rule |
|
|
27
|
-
|---|---|---|
|
|
28
|
-
| 1 | Filters, joins and sorts on columns with no matching index | [Indexes](references/rules.md#indexes) |
|
|
29
|
-
| 1 | A query per item inside a loop, or lazy-loaded relations in a list | [N+1](references/rules.md#n1-queries) |
|
|
30
|
-
| 1 | A new connection or client per request; a pool per module | [Connections](references/rules.md#connections) |
|
|
31
|
-
| 1 | RLS policies calling a function per row, unindexed policy columns | [Row-level security](references/rules.md#row-level-security) |
|
|
32
|
-
| 2 | Composite index in the wrong column order; foreign key without an index | [Indexes](references/rules.md#indexes) |
|
|
33
|
-
| 2 | Deep `OFFSET` pagination | [Pagination](references/rules.md#pagination) |
|
|
34
|
-
| 2 | Unbounded `SELECT` (no `LIMIT`) on growing tables; `SELECT *` on wide rows | [Query shape](references/rules.md#query-shape) |
|
|
35
|
-
| 2 | Transactions held across HTTP calls or user input; check-then-insert | [Transactions and locks](references/rules.md#transactions-and-locks) |
|
|
36
|
-
| 3 | Row-by-row inserts; `COUNT(*)` to test existence | [Query shape](references/rules.md#query-shape) |
|
|
37
|
-
| 3 | Functions or casts on indexed columns (`lower(email) = ...`), leading-wildcard `LIKE` | [Indexes](references/rules.md#indexes), [Search](references/rules.md#search-and-jsonb) |
|
|
38
|
-
| 3 | Worker queues that block each other | [Transactions and locks](references/rules.md#transactions-and-locks) |
|
|
39
|
-
| 4 | Column types (int ids that will overflow, `timestamp` without zone, float money) | [Types](references/rules.md#types-and-keys) |
|
|
40
|
-
|
|
41
|
-
Table size matters. An index on a 200-row lookup table is noise; a missing one on an events table is an outage. When you do not know the size, say what you assumed.
|
|
42
|
-
|
|
43
|
-
### 3. Fix with the smallest change
|
|
44
|
-
|
|
45
|
-
- Prefer fixing the query (batch the loop, keyset pagination, select fewer columns) over adding an index; prefer one composite index that serves several queries over several single-column ones.
|
|
46
|
-
- Every index slows writes and takes space. Add one only for a query that runs often or on a large table, and check that an existing index does not already cover it (a composite index on `(a, b)` serves queries on `a` alone).
|
|
47
|
-
- In ORMs, use the ORM's own tools first: eager loading (`include`, `select_related` / `prefetch_related`, `includes`, `joinedload` / `selectinload`), batch `findMany` with `in`, `createMany`, `bulk_create`, `insert_all`, upsert helpers.
|
|
48
|
-
|
|
49
|
-
### 4. Verify
|
|
50
|
-
|
|
51
|
-
On the throwaway database, with enough rows for the planner to behave like production (generate them with `generate_series`; a few hundred rows often get a sequential scan no matter what):
|
|
52
|
-
|
|
53
|
-
```sql
|
|
54
|
-
INSERT INTO orders (customer_id, status, created_at)
|
|
55
|
-
SELECT (random() * 10000)::int, (ARRAY['pending','paid','shipped'])[1 + (random() * 2)::int],
|
|
56
|
-
now() - random() * interval '365 days'
|
|
57
|
-
FROM generate_series(1, 200000);
|
|
58
|
-
ANALYZE orders;
|
|
59
|
-
|
|
60
|
-
EXPLAIN (ANALYZE, BUFFERS)
|
|
61
|
-
SELECT id, total FROM orders WHERE customer_id = 42 ORDER BY created_at DESC LIMIT 20;
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
Read the plan:
|
|
65
|
-
|
|
66
|
-
- `Seq Scan` on a big table with a selective filter, and a large `Rows Removed by Filter`: missing or unusable index.
|
|
67
|
-
- Estimated rows far from actual rows: stale statistics (run `ANALYZE`) or a correlated filter.
|
|
68
|
-
- `Sort` with `external merge`: sorting on disk; an index matching `ORDER BY` can remove the sort.
|
|
69
|
-
- `Nested Loop` with a huge `loops` count on the inner side: missing index on the join column.
|
|
70
|
-
- `Index Scan` followed by many heap fetches where a covering index would allow an `Index Only Scan`.
|
|
71
|
-
|
|
72
|
-
Compare the plan before and after the fix. For N+1 fixes, count the queries for one request before and after, or assert the count in a test if the project has a helper for it.
|
|
73
|
-
|
|
74
|
-
If you cannot run a database, say so and explain from the code why the fix helps.
|
|
75
|
-
|
|
76
|
-
## Report
|
|
77
|
-
|
|
78
|
-
For each finding: file and line, the query or ORM call, why it is slow (with the plan or the query count if you measured), the fix, and its cost (new index, extra memory). Separate what you changed from recommendations for operators (pool size, timeouts, server settings).
|
|
79
|
-
|
|
80
|
-
## Common mistakes
|
|
81
|
-
|
|
82
|
-
- Adding an index for every column in a WHERE clause, or duplicating an existing index's leading columns.
|
|
83
|
-
- Indexing a low-selectivity column alone (a boolean, a status with three values) when a partial or composite index is what the query needs.
|
|
84
|
-
- Wrapping the indexed column in a function or cast, so the index cannot be used.
|
|
85
|
-
- Measuring on an empty table and concluding the plan is fine.
|
|
86
|
-
- "Fixing" N+1 by caching instead of batching.
|
|
87
|
-
- Raising pool size or `max_connections` to hide connection leaks.
|
|
88
|
-
- Running `EXPLAIN ANALYZE` on a write statement against a real database.
|
|
89
|
-
|
|
90
|
-
## Done when
|
|
91
|
-
|
|
92
|
-
- Each slow pattern found is fixed or listed with a reason it was left.
|
|
93
|
-
- New indexes go through a migration that follows `safe-database-changes`.
|
|
94
|
-
- The fix is backed by a plan or query count from a throwaway database, or the report says it could not be measured.
|
|
95
|
-
- Operator-level recommendations are in the report, not applied.
|
|
96
|
-
|
|
97
|
-
Sources: supabase/agent-skills supabase-postgres-best-practices (MIT, commit c9be0e9). Changed: made Postgres-generic and condensed.
|
|
1
|
+
---
|
|
2
|
+
name: postgres-performance
|
|
3
|
+
description: Use when writing or reviewing PostgreSQL queries, ORM data access, indexes, pagination, row-level security policies or connection handling, or when an endpoint or page is slow. Checks missing indexes, N+1 queries, OFFSET pagination, long transactions, racy upserts and pool misuse, and verifies fixes with EXPLAIN on a local database.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# PostgreSQL performance
|
|
7
|
+
|
|
8
|
+
Most slow Postgres code comes from a short list of mistakes: a query without a usable index, a query inside a loop, deep OFFSET pages, transactions held open across network calls, and connections opened per request. This skill finds them in a diff or in slow code and proves the fix with a query plan.
|
|
9
|
+
|
|
10
|
+
The project's conventions win (naming, ORM style, how indexes are declared, which database version it targets). Schema changes that come out of this work, such as new indexes, must follow the `safe-database-changes` skill (build indexes without blocking writes, separate migration).
|
|
11
|
+
|
|
12
|
+
## Safety
|
|
13
|
+
|
|
14
|
+
- Never connect to a real, shared or production database to "check" a plan. Work on a throwaway local database (see `safe-database-changes` for how to get one) or reason from the code.
|
|
15
|
+
- `EXPLAIN ANALYZE` executes the statement. For INSERT, UPDATE or DELETE, run it only on the throwaway database, inside `BEGIN; ... ROLLBACK;`.
|
|
16
|
+
- Do not change server settings (`ALTER SYSTEM`, `max_connections`, pooler config) from a task run. Put recommended settings in the report.
|
|
17
|
+
|
|
18
|
+
## Process
|
|
19
|
+
|
|
20
|
+
### 1. Find the SQL that actually runs
|
|
21
|
+
|
|
22
|
+
ORMs hide the real queries. Read the data-access code and, when you can run it locally, turn on query logging for one request or test: Prisma `log: ['query']`, Django `connection.queries` or `DEBUG` SQL logging, Rails log output, SQLAlchemy `echo=True`, Sequelize `logging`, TypeORM `logging: true`, Drizzle `logger: true`, or `log_statement = 'all'` on the throwaway database. Count queries per request, not just their speed.
|
|
23
|
+
|
|
24
|
+
### 2. Check against the list, highest impact first
|
|
25
|
+
|
|
26
|
+
| Priority | Look for | Rule |
|
|
27
|
+
|---|---|---|
|
|
28
|
+
| 1 | Filters, joins and sorts on columns with no matching index | [Indexes](references/rules.md#indexes) |
|
|
29
|
+
| 1 | A query per item inside a loop, or lazy-loaded relations in a list | [N+1](references/rules.md#n1-queries) |
|
|
30
|
+
| 1 | A new connection or client per request; a pool per module | [Connections](references/rules.md#connections) |
|
|
31
|
+
| 1 | RLS policies calling a function per row, unindexed policy columns | [Row-level security](references/rules.md#row-level-security) |
|
|
32
|
+
| 2 | Composite index in the wrong column order; foreign key without an index | [Indexes](references/rules.md#indexes) |
|
|
33
|
+
| 2 | Deep `OFFSET` pagination | [Pagination](references/rules.md#pagination) |
|
|
34
|
+
| 2 | Unbounded `SELECT` (no `LIMIT`) on growing tables; `SELECT *` on wide rows | [Query shape](references/rules.md#query-shape) |
|
|
35
|
+
| 2 | Transactions held across HTTP calls or user input; check-then-insert | [Transactions and locks](references/rules.md#transactions-and-locks) |
|
|
36
|
+
| 3 | Row-by-row inserts; `COUNT(*)` to test existence | [Query shape](references/rules.md#query-shape) |
|
|
37
|
+
| 3 | Functions or casts on indexed columns (`lower(email) = ...`), leading-wildcard `LIKE` | [Indexes](references/rules.md#indexes), [Search](references/rules.md#search-and-jsonb) |
|
|
38
|
+
| 3 | Worker queues that block each other | [Transactions and locks](references/rules.md#transactions-and-locks) |
|
|
39
|
+
| 4 | Column types (int ids that will overflow, `timestamp` without zone, float money) | [Types](references/rules.md#types-and-keys) |
|
|
40
|
+
|
|
41
|
+
Table size matters. An index on a 200-row lookup table is noise; a missing one on an events table is an outage. When you do not know the size, say what you assumed.
|
|
42
|
+
|
|
43
|
+
### 3. Fix with the smallest change
|
|
44
|
+
|
|
45
|
+
- Prefer fixing the query (batch the loop, keyset pagination, select fewer columns) over adding an index; prefer one composite index that serves several queries over several single-column ones.
|
|
46
|
+
- Every index slows writes and takes space. Add one only for a query that runs often or on a large table, and check that an existing index does not already cover it (a composite index on `(a, b)` serves queries on `a` alone).
|
|
47
|
+
- In ORMs, use the ORM's own tools first: eager loading (`include`, `select_related` / `prefetch_related`, `includes`, `joinedload` / `selectinload`), batch `findMany` with `in`, `createMany`, `bulk_create`, `insert_all`, upsert helpers.
|
|
48
|
+
|
|
49
|
+
### 4. Verify
|
|
50
|
+
|
|
51
|
+
On the throwaway database, with enough rows for the planner to behave like production (generate them with `generate_series`; a few hundred rows often get a sequential scan no matter what):
|
|
52
|
+
|
|
53
|
+
```sql
|
|
54
|
+
INSERT INTO orders (customer_id, status, created_at)
|
|
55
|
+
SELECT (random() * 10000)::int, (ARRAY['pending','paid','shipped'])[1 + (random() * 2)::int],
|
|
56
|
+
now() - random() * interval '365 days'
|
|
57
|
+
FROM generate_series(1, 200000);
|
|
58
|
+
ANALYZE orders;
|
|
59
|
+
|
|
60
|
+
EXPLAIN (ANALYZE, BUFFERS)
|
|
61
|
+
SELECT id, total FROM orders WHERE customer_id = 42 ORDER BY created_at DESC LIMIT 20;
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Read the plan:
|
|
65
|
+
|
|
66
|
+
- `Seq Scan` on a big table with a selective filter, and a large `Rows Removed by Filter`: missing or unusable index.
|
|
67
|
+
- Estimated rows far from actual rows: stale statistics (run `ANALYZE`) or a correlated filter.
|
|
68
|
+
- `Sort` with `external merge`: sorting on disk; an index matching `ORDER BY` can remove the sort.
|
|
69
|
+
- `Nested Loop` with a huge `loops` count on the inner side: missing index on the join column.
|
|
70
|
+
- `Index Scan` followed by many heap fetches where a covering index would allow an `Index Only Scan`.
|
|
71
|
+
|
|
72
|
+
Compare the plan before and after the fix. For N+1 fixes, count the queries for one request before and after, or assert the count in a test if the project has a helper for it.
|
|
73
|
+
|
|
74
|
+
If you cannot run a database, say so and explain from the code why the fix helps.
|
|
75
|
+
|
|
76
|
+
## Report
|
|
77
|
+
|
|
78
|
+
For each finding: file and line, the query or ORM call, why it is slow (with the plan or the query count if you measured), the fix, and its cost (new index, extra memory). Separate what you changed from recommendations for operators (pool size, timeouts, server settings).
|
|
79
|
+
|
|
80
|
+
## Common mistakes
|
|
81
|
+
|
|
82
|
+
- Adding an index for every column in a WHERE clause, or duplicating an existing index's leading columns.
|
|
83
|
+
- Indexing a low-selectivity column alone (a boolean, a status with three values) when a partial or composite index is what the query needs.
|
|
84
|
+
- Wrapping the indexed column in a function or cast, so the index cannot be used.
|
|
85
|
+
- Measuring on an empty table and concluding the plan is fine.
|
|
86
|
+
- "Fixing" N+1 by caching instead of batching.
|
|
87
|
+
- Raising pool size or `max_connections` to hide connection leaks.
|
|
88
|
+
- Running `EXPLAIN ANALYZE` on a write statement against a real database.
|
|
89
|
+
|
|
90
|
+
## Done when
|
|
91
|
+
|
|
92
|
+
- Each slow pattern found is fixed or listed with a reason it was left.
|
|
93
|
+
- New indexes go through a migration that follows `safe-database-changes`.
|
|
94
|
+
- The fix is backed by a plan or query count from a throwaway database, or the report says it could not be measured.
|
|
95
|
+
- Operator-level recommendations are in the report, not applied.
|
|
96
|
+
|
|
97
|
+
Sources: supabase/agent-skills supabase-postgres-best-practices (MIT, commit c9be0e9). Changed: made Postgres-generic and condensed.
|