@ericrisco/rsc 0.1.43 → 0.1.45
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/README.md +1 -1
- package/manifest.json +110 -86
- package/package.json +1 -1
- package/scripts/lib/domains.js +1 -1
- package/scripts/skill-migration-brief.md +104 -0
- package/skills/ab-testing/SKILL.md +9 -41
- package/skills/accessibility/SKILL.md +5 -7
- package/skills/ads/SKILL.md +9 -24
- package/skills/agent-eval/SKILL.md +7 -33
- package/skills/agent-safety/SKILL.md +7 -14
- package/skills/ai-media/SKILL.md +4 -20
- package/skills/analytics/SKILL.md +8 -30
- package/skills/analyze/SKILL.md +24 -59
- package/skills/angular/SKILL.md +12 -25
- package/skills/api-connector-builder/SKILL.md +10 -27
- package/skills/api-design/SKILL.md +7 -14
- package/skills/article-writing/SKILL.md +1 -18
- package/skills/astro/SKILL.md +36 -54
- package/skills/author-skill/SKILL.md +41 -74
- package/skills/author-skill/evals/README.md +5 -5
- package/skills/author-skill/evals/cases.yaml +8 -8
- package/skills/author-skill/references/description-recipe.md +25 -26
- package/skills/author-skill/references/eval-authoring.md +1 -1
- package/skills/author-skill/references/rsc-conventions.md +1 -1
- package/skills/automation-flows/SKILL.md +6 -16
- package/skills/automation-strategy/SKILL.md +1 -9
- package/skills/aws-essentials/SKILL.md +6 -23
- package/skills/backups/SKILL.md +1 -7
- package/skills/bash-scripting/SKILL.md +5 -9
- package/skills/bookkeeping/SKILL.md +2 -10
- package/skills/brand-identity/SKILL.md +18 -44
- package/skills/brand-voice/SKILL.md +4 -31
- package/skills/building-agents/SKILL.md +20 -103
- package/skills/business-intelligence/SKILL.md +9 -23
- package/skills/calendar-scheduling/SKILL.md +11 -27
- package/skills/case-studies/SKILL.md +3 -8
- package/skills/chatbot/SKILL.md +6 -23
- package/skills/chrome-extension/SKILL.md +2 -2
- package/skills/clarify/SKILL.md +31 -72
- package/skills/clickhouse-analytics/SKILL.md +2 -8
- package/skills/client-onboarding/SKILL.md +17 -19
- package/skills/cloudflare/SKILL.md +3 -8
- package/skills/code-review/SKILL.md +10 -23
- package/skills/codebase-onboarding/SKILL.md +2 -7
- package/skills/cold-outreach/SKILL.md +9 -30
- package/skills/community/SKILL.md +4 -31
- package/skills/competitor-watch/SKILL.md +20 -35
- package/skills/compliance/SKILL.md +10 -37
- package/skills/compose-multiplatform/SKILL.md +1 -1
- package/skills/constitution/SKILL.md +8 -35
- package/skills/content-engine/SKILL.md +4 -16
- package/skills/context-budget/SKILL.md +3 -21
- package/skills/continuous-learning/SKILL.md +10 -40
- package/skills/contracts/SKILL.md +6 -17
- package/skills/coolify/SKILL.md +8 -14
- package/skills/cost-tracking/SKILL.md +3 -11
- package/skills/course-builder/SKILL.md +17 -45
- package/skills/course-storytelling/SKILL.md +26 -94
- package/skills/cpp/SKILL.md +26 -71
- package/skills/csharp-dotnet/SKILL.md +19 -38
- package/skills/customer-support/SKILL.md +14 -37
- package/skills/dashboard/SKILL.md +6 -26
- package/skills/data-cleaning/SKILL.md +37 -63
- package/skills/data-policy/SKILL.md +8 -21
- package/skills/data-scraper/SKILL.md +1 -7
- package/skills/debug/SKILL.md +10 -49
- package/skills/deployment/SKILL.md +38 -101
- package/skills/design/SKILL.md +34 -116
- package/skills/fable-operator/SKILL.md +1 -4
- package/skills/fastapi/SKILL.md +50 -82
- package/skills/flutter/SKILL.md +41 -89
- package/skills/go/SKILL.md +57 -105
- package/skills/harness/SKILL.md +52 -68
- package/skills/implement/SKILL.md +1 -1
- package/skills/init/SKILL.md +152 -168
- package/skills/marketing/SKILL.md +30 -80
- package/skills/nextjs/SKILL.md +42 -116
- package/skills/orient/SKILL.md +25 -20
- package/skills/parallel/SKILL.md +9 -75
- package/skills/plan/SKILL.md +92 -165
- package/skills/postgresdb/SKILL.md +52 -72
- package/skills/presentations/SKILL.md +49 -87
- package/skills/python/SKILL.md +23 -72
- package/skills/react/SKILL.md +19 -67
- package/skills/review/SKILL.md +22 -52
- package/skills/rust/SKILL.md +40 -115
- package/skills/sdd-init/SKILL.md +9 -14
- package/skills/secure-coding/SKILL.md +80 -109
- package/skills/ship/SKILL.md +25 -55
- package/skills/tasks/SKILL.md +37 -61
- package/skills/typescript/SKILL.md +22 -55
- package/skills/verify/SKILL.md +8 -32
- package/skills/viral-score/SKILL.md +122 -0
- package/skills/viral-score/evals/README.md +16 -0
- package/skills/viral-score/evals/cases.yaml +50 -0
- package/skills/vue-nuxt/SKILL.md +45 -106
- package/skills/worktrees/SKILL.md +24 -69
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: postgresdb
|
|
3
|
-
description: Use when
|
|
3
|
+
description: Use when PostgreSQL engine behaviour decides the answer — schema and type design, index choice, reading EXPLAIN on a slow query, zero-downtime DDL and backfills, or ops (roles, RLS, pooling, vacuum, partitioning, PITR). PG16, ORM-agnostic. NOT portable query logic (that is `sql`), NOT a managed provider's platform surface (that is `neon`).
|
|
4
4
|
tags: [postgres, sql, database, migrations]
|
|
5
5
|
recommends: [secure-coding]
|
|
6
6
|
origin: risco
|
|
@@ -12,25 +12,9 @@ Engine-level PostgreSQL 16 guidance: design correct schemas, pick the right inde
|
|
|
12
12
|
fix slow SQL, run zero-downtime migrations, and operate/secure the database. Tooling-agnostic; every
|
|
13
13
|
example is runnable.
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
**When to use:**
|
|
20
|
-
|
|
21
|
-
- Schema/DDL decisions: types, keys, constraints, generated/identity columns, enum-vs-lookup, jsonb-vs-column.
|
|
22
|
-
- Any query that is slow, scans too much, or returns wrong cardinality; reading a plan.
|
|
23
|
-
- Index decisions: which kind, column order, partial/covering, and when NOT to add one.
|
|
24
|
-
- Migrations against tables with real data or live traffic.
|
|
25
|
-
- Concurrency: isolation, locking, deadlocks, queues.
|
|
26
|
-
- Ops: pooling, vacuum, monitoring, partitioning, backups, RLS, least-privilege roles.
|
|
27
|
-
|
|
28
|
-
**When NOT to use:**
|
|
29
|
-
|
|
30
|
-
- ORM-API ergonomics (Prisma `updateMany` count trap, SQLAlchemy session lifecycle) → your ORM's own docs. This skill owns the **SQL the ORM emits and the engine behavior underneath**.
|
|
31
|
-
- Non-Postgres engines (MySQL/SQLite/ClickHouse) — different MVCC, locking, planner.
|
|
32
|
-
- App-layer caching / Redis / Kafka as products; only Postgres-as-queue via `SKIP LOCKED` is in scope.
|
|
33
|
-
- Cloud-vendor console clicks — we give the SQL/params, not the RDS/Cloud SQL UI path.
|
|
15
|
+
New, non-trivial feature with no approved spec + plan under `02-DOCS/wiki/sdd/`? Hand off to
|
|
16
|
+
[`specify`](../specify/SKILL.md) before writing feature code (method: [`sdd`](../sdd/SKILL.md)); build
|
|
17
|
+
straight from here only for a genuinely one-line, low-risk change.
|
|
34
18
|
|
|
35
19
|
Deep dives: [schema-and-indexing](references/schema-and-indexing.md) (types, constraints, every index
|
|
36
20
|
kind, bloat) · [query-optimization](references/query-optimization.md) (EXPLAIN, joins, concurrency,
|
|
@@ -38,18 +22,13 @@ JSONB/FTS/pgvector) · [migrations](references/migrations.md) (zero-downtime DDL
|
|
|
38
22
|
[operations-and-security](references/operations-and-security.md) (roles, RLS, pooling, vacuum,
|
|
39
23
|
partitioning, backups).
|
|
40
24
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
6. Never `ADD COLUMN ... NOT NULL` without a default/backfill plan; never add a volatile default on a large table without a batched backfill.
|
|
49
|
-
7. Read the plan before adding an index: `EXPLAIN (ANALYZE, BUFFERS)` or it didn't happen.
|
|
50
|
-
8. Migrations are forward-only in prod; never edit an applied migration.
|
|
51
|
-
9. `SET lock_timeout` + `SET statement_timeout` around DDL on hot tables.
|
|
52
|
-
10. RLS is opt-in per table and the **table owner bypasses it** — verify with a non-owner role (use `FORCE ROW LEVEL SECURITY` for the owner too).
|
|
25
|
+
**Not this skill.** ORM-API ergonomics (Prisma `updateMany` count trap, SQLAlchemy session lifecycle)
|
|
26
|
+
and per-runner migration wiring → that tool's own docs; this skill owns the **SQL the ORM emits and
|
|
27
|
+
the engine behavior underneath**. Other engines → [`mysql`](../mysql/SKILL.md),
|
|
28
|
+
[`sqlite-turso`](../sqlite-turso/SKILL.md), [`clickhouse-analytics`](../clickhouse-analytics/SKILL.md)
|
|
29
|
+
(different MVCC, locking, planner). App-layer caching / Redis / Kafka as products are out — only
|
|
30
|
+
Postgres-as-queue via `SKIP LOCKED` is in scope. Cloud-vendor console clicks →
|
|
31
|
+
[`deployment`](../deployment/SKILL.md); we give the SQL and params, not the RDS/Cloud SQL UI path.
|
|
53
32
|
|
|
54
33
|
## Decision rules
|
|
55
34
|
|
|
@@ -91,6 +70,9 @@ Fast lookups; runnable DDL lives in the references.
|
|
|
91
70
|
Hash indexes: almost never — equality-only, no multicolumn, rarely beats btree even though WAL-logged
|
|
92
71
|
since PG10.
|
|
93
72
|
|
|
73
|
+
Read the plan **before** adding an index — `EXPLAIN (ANALYZE, BUFFERS)` or it didn't happen. An index
|
|
74
|
+
the planner never picks is pure write tax on every insert and update, forever.
|
|
75
|
+
|
|
94
76
|
### When NOT to add an index
|
|
95
77
|
|
|
96
78
|
- Low-selectivity boolean / `status` with few distinct values (planner ignores it; seq scan wins).
|
|
@@ -262,9 +244,30 @@ Read these four first:
|
|
|
262
244
|
|
|
263
245
|
Full method in [query-optimization](references/query-optimization.md).
|
|
264
246
|
|
|
265
|
-
##
|
|
247
|
+
## DDL on a live table
|
|
266
248
|
|
|
267
|
-
|
|
249
|
+
Full sequences (zero-downtime expand-contract, batched backfills, per-ORM runners) in
|
|
250
|
+
[migrations](references/migrations.md). These four are absolute because each one is a lock you cannot
|
|
251
|
+
take back once traffic is on the table:
|
|
252
|
+
|
|
253
|
+
1. Index creation on a live table is **always** `CONCURRENTLY` — plain `CREATE INDEX` holds ACCESS
|
|
254
|
+
EXCLUSIVE for the entire build and blocks every writer. It therefore cannot run inside a txn.
|
|
255
|
+
2. Never `ADD COLUMN ... NOT NULL` without a default/backfill plan, and never add a **volatile**
|
|
256
|
+
default (`now()`, `gen_random_uuid()`) on a large table without a batched backfill — a volatile
|
|
257
|
+
default rewrites the whole table under ACCESS EXCLUSIVE. A non-volatile constant is instant (PG11+).
|
|
258
|
+
3. `SET lock_timeout` + `SET statement_timeout` around DDL on hot tables, so a blocked statement fails
|
|
259
|
+
fast instead of parking an ACCESS EXCLUSIVE request that every reader behind it then queues on.
|
|
260
|
+
4. Migrations are forward-only in prod; never edit an applied migration — it has already run
|
|
261
|
+
somewhere, so the next environment replays a history that no longer matches the one in production.
|
|
262
|
+
|
|
263
|
+
Lock modes: `CREATE INDEX CONCURRENTLY` takes SHARE UPDATE EXCLUSIVE (allows writes); plain
|
|
264
|
+
`CREATE INDEX`, `ALTER TABLE ... TYPE`, `ADD COLUMN` with a volatile default, and `VACUUM FULL` take
|
|
265
|
+
ACCESS EXCLUSIVE (blocks everything). Full table in
|
|
266
|
+
[migrations](references/migrations.md#lock-impact-reference).
|
|
267
|
+
|
|
268
|
+
## Anti-patterns
|
|
269
|
+
|
|
270
|
+
| Claim | Reality |
|
|
268
271
|
| --- | --- |
|
|
269
272
|
| "I'll add the FK index later, the query works now" | Unindexed FK = seq scan + heavy lock cascade on parent `DELETE`/`UPDATE`. Index it now. |
|
|
270
273
|
| "UUID PK is fine everywhere" | Random v4 fragments the B-tree and bloats WAL. Use `IDENTITY` internally or uuid **v7**. |
|
|
@@ -274,6 +277,7 @@ Full method in [query-optimization](references/query-optimization.md).
|
|
|
274
277
|
| "Store money as float, round on display" | Silent drift across arithmetic. `numeric(19,4)`. |
|
|
275
278
|
| "`ADD COLUMN ... NOT NULL DEFAULT now()`" | Volatile default rewrites the table under ACCESS EXCLUSIVE. Non-volatile constant is instant (PG11+). |
|
|
276
279
|
| "One big `jsonb` blob beats columns" | No constraints, no per-key stats, GIN bloat. Promote hot keys to typed columns. |
|
|
280
|
+
| "RLS is on, so the table is protected" | RLS is opt-in per table and the **table owner bypasses it**. Verify with a non-owner role; add `FORCE ROW LEVEL SECURITY` to cover the owner too. |
|
|
277
281
|
| "RLS policy calling `auth.uid()` per row" | Re-evaluated per row. Wrap: `(SELECT auth.uid())` so it runs once. |
|
|
278
282
|
| "`CREATE INDEX` in the migration is fine" | Blocks writes for the whole build. `CREATE INDEX CONCURRENTLY` (outside a txn). |
|
|
279
283
|
| "`VACUUM FULL` will fix bloat" | Takes ACCESS EXCLUSIVE, rewrites the table. Use autovacuum tuning / `REINDEX CONCURRENTLY`. |
|
|
@@ -290,12 +294,6 @@ Full method in [query-optimization](references/query-optimization.md).
|
|
|
290
294
|
|
|
291
295
|
Retry the txn on SQLSTATE `40001` (serialization_failure) and `40P01` (deadlock_detected).
|
|
292
296
|
|
|
293
|
-
### Lock modes (DDL)
|
|
294
|
-
|
|
295
|
-
`CREATE INDEX CONCURRENTLY` takes SHARE UPDATE EXCLUSIVE (allows writes); plain `CREATE INDEX`,
|
|
296
|
-
`ALTER TABLE ... TYPE`, `ADD COLUMN` with a volatile default, and `VACUUM FULL` take ACCESS EXCLUSIVE
|
|
297
|
-
(blocks everything). Full table in [migrations](references/migrations.md#lock-impact-reference).
|
|
298
|
-
|
|
299
297
|
### Diagnostic one-liners
|
|
300
298
|
|
|
301
299
|
```sql
|
|
@@ -337,38 +335,20 @@ FROM pg_stat_user_indexes WHERE idx_scan = 0 ORDER BY relname;
|
|
|
337
335
|
|
|
338
336
|
## Verify
|
|
339
337
|
|
|
340
|
-
Run `scripts/verify.sh` from your project root
|
|
338
|
+
Run `scripts/verify.sh` from your project root: it lints discovered SQL with `sqlfluff` (if
|
|
341
339
|
configured), syntax-sanity-checks migration files (the quote/paren balance check is dollar-quote and
|
|
342
|
-
block-comment aware)
|
|
340
|
+
block-comment aware), flags foot-guns (`CREATE INDEX` without `CONCURRENTLY` in a migration,
|
|
343
341
|
`ADD COLUMN ... NOT NULL` without `DEFAULT`, `VACUUM FULL`), and — only if `DATABASE_URL` and `psql`
|
|
344
342
|
are present — checks that `pg_stat_statements` is enabled. It exits non-zero **only** on a real
|
|
345
|
-
`sqlfluff` lint error; everything else (missing tools, heuristic
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
Knowledge map index; root `CLAUDE.md` points to it).
|
|
358
|
-
2. **If missing or stale**, create/update it with the project's real choices — schema and naming conventions, the migration tool, indexing/partitioning decisions, the pooling setup, and any RLS policies —
|
|
359
|
-
then index it in `02-DOCS/wiki/index.md` (the Knowledge map; root `CLAUDE.md` keeps only a
|
|
360
|
-
short pointer to it).
|
|
361
|
-
3. **Read it first on every use** and stay consistent; when a convention changes, update the
|
|
362
|
-
article (bump its `Updated` date) in the same change.
|
|
363
|
-
|
|
364
|
-
No `02-DOCS/` layer? Skip silently (optionally suggest `harness`). Unlike the
|
|
365
|
-
brand study, technical conventions are *recorded, not gated* — never block the task on this.
|
|
366
|
-
|
|
367
|
-
## See Also
|
|
368
|
-
|
|
369
|
-
- [references/schema-and-indexing.md](references/schema-and-indexing.md) — types, constraints, all index kinds, bloat.
|
|
370
|
-
- [references/query-optimization.md](references/query-optimization.md) — EXPLAIN, joins, concurrency, JSONB/FTS/pgvector.
|
|
371
|
-
- [references/migrations.md](references/migrations.md) — zero-downtime DDL, lock-impact table, per-ORM.
|
|
372
|
-
- [references/operations-and-security.md](references/operations-and-security.md) — roles, RLS, pooling, vacuum, partitioning, backups.
|
|
373
|
-
- Sibling skills: [`harness`](../harness/SKILL.md) (scaffolds the `01-TOOLS/POSTGRES` operational tool). Stack siblings: [`fastapi`](../fastapi/SKILL.md), [`nextjs`](../nextjs/SKILL.md), [`go`](../go/SKILL.md), [`flutter`](../flutter/SKILL.md), [`secure-coding`](../secure-coding/SKILL.md), [`deployment`](../deployment/SKILL.md).
|
|
374
|
-
- Out of scope here — these are external tools with their own upstream documentation, not skills in this collection: ORM-surface traps (Prisma's `updateMany` count, serverless connection exhaustion) and per-runner migration wiring (Prisma, Alembic, golang-migrate, Drizzle, …). This skill owns the engine-level SQL and migration mechanics those tools sit on top of; for the tool's own API/CLI, read that tool's docs.
|
|
343
|
+
`sqlfluff` lint error; everything else (missing tools, heuristic warnings, DB unreachable) is advisory
|
|
344
|
+
`[skip]`/`[warn]`. Runs on stock macOS bash 3.2; never writes, never connects without `DATABASE_URL`.
|
|
345
|
+
|
|
346
|
+
## Project grounding
|
|
347
|
+
|
|
348
|
+
In a project with a `02-DOCS/` layer (the [`harness`](../harness/SKILL.md) Karpathy wiki), read
|
|
349
|
+
`02-DOCS/wiki/stack/postgresdb.md` first and stay consistent with it. Missing or stale? Write the
|
|
350
|
+
project's real choices there — schema and naming conventions, migration tool, indexing/partitioning
|
|
351
|
+
decisions, pooling setup, RLS policies — index it in `02-DOCS/wiki/index.md` (the Knowledge map; root
|
|
352
|
+
`CLAUDE.md` keeps only a pointer), and bump its `Updated` date in the same change, so the next agent
|
|
353
|
+
inherits the conventions instead of re-deriving them. No `02-DOCS/` layer? Skip silently (optionally
|
|
354
|
+
suggest `harness`) — technical conventions are *recorded, not gated*; never block the task on this.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: presentations
|
|
3
|
-
description: "Use when building a presentation deck —
|
|
3
|
+
description: "Use when building, theming, or exporting a presentation deck — pitch, sales, keynote, board/QBR, leave-behind one-pager — from slide structure to a token-based theme to PDF or editable PPTX (Marp, Slidev, python-pptx). NOT the words (that is `marketing`), NOT the visual tokens (that is `design`), NOT the investor story arc (that is `pitch-deck`)."
|
|
4
4
|
tags: [presentations, pptx, slides, deck]
|
|
5
5
|
recommends: [marketing]
|
|
6
6
|
origin: risco
|
|
@@ -14,82 +14,56 @@ origin: risco
|
|
|
14
14
|
> The deck owns *structure, visual system, and export*. The **words** are `marketing`'s job; the
|
|
15
15
|
> **visual tokens** are `design`'s. This skill orchestrates all three into a finished deck.
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
Also out of scope: a web-native, scroll/animation-heavy **landing page** (that is
|
|
18
|
+
`../design/SKILL.md` + `../nextjs/SKILL.md`); a **video / motion explainer** as the deliverable — this
|
|
19
|
+
skill uses motion only as restrained slide transitions and builds, never as the medium; and the live
|
|
20
|
+
financial *model* behind an investor deck — this skill renders the slides and cites the model as the
|
|
21
|
+
source of truth.
|
|
18
22
|
|
|
19
|
-
|
|
23
|
+
## Brand grounding (gate — clears before the first headline)
|
|
20
24
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
- Re-skinning / restructuring an existing deck to be on-brand and less generic.
|
|
25
|
+
**Never produce deck copy or a deck narrative without a complete brand study.** A deck is the brand on
|
|
26
|
+
stage: generic slides read as "another AI deck" the moment they hit the projector, and the only cure is
|
|
27
|
+
grounding every headline, claim, and tone choice in a real, persisted brand profile. This is the same
|
|
28
|
+
gate `marketing` and `design` enforce — decks share the study, they do not fork it.
|
|
26
29
|
|
|
27
|
-
**
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
- Choosing the brand's *visual tokens* (OKLCH palette, type pairing, spacing scale, motion personality) → that is `../design/SKILL.md`. This skill *consumes* those tokens into a slide theme.
|
|
31
|
-
- A web-native, scroll/animation-heavy **landing page** (not a deck) → `../design/SKILL.md` + `../nextjs/SKILL.md`.
|
|
32
|
-
- A **video / motion explainer** as the deliverable (Manim/Remotion, talking-head, animated short) → that is a video job. This skill uses motion only as restrained slide transitions/builds, never as the medium.
|
|
33
|
-
- A live financial *model* / spreadsheet (the numbers engine behind an investor deck) → that is an investor-materials/modeling job; this skill renders the *slides* and cites the model as the source of truth.
|
|
34
|
-
|
|
35
|
-
## Brand grounding (read this first)
|
|
36
|
-
|
|
37
|
-
**Hard rule: never produce deck copy or a deck narrative without a complete brand study.** A deck is the
|
|
38
|
-
brand on stage — generic slides read as "another AI deck" the moment they hit the projector, and the cure
|
|
39
|
-
is grounding every headline, claim, and tone choice in a real, persisted brand profile. This is the same
|
|
40
|
-
hard gate the `marketing` and `design` skills enforce; decks share the study, they do not fork it.
|
|
41
|
-
|
|
42
|
-
Run this gate before writing a single slide headline:
|
|
43
|
-
|
|
44
|
-
1. **Locate the brand study.** Read the project's root `CLAUDE.md` for a `## Brand & voice` section linking into `02-DOCS/wiki/brand/` (the `harness` Karpathy-wiki convention: compiled brand articles under `02-DOCS/wiki/brand/`, raw inputs the user pastes under `02-DOCS/raw/brand/`). If `CLAUDE.md` is absent, the link is missing, or it points nowhere, treat the study as ABSENT.
|
|
45
|
-
2. **Check completeness** against the checklist in `references/brand-grounding.md` (it extends the shared brand checklist with **deck-specific** dimensions: deck purpose, audience & setting, length, presenter-vs-leave-behind, and must-include slides). Any empty dimension = INCOMPLETE.
|
|
46
|
-
3. **If ABSENT or INCOMPLETE, STOP and interview the user** — one focused batch at a time (never dump all questions at once). Voice samples are mandatory; never fabricate a voice. Then persist: write/update the brand study under `02-DOCS/wiki/brand/` (raw inputs verbatim under `02-DOCS/raw/brand/`), and add/update the `## Brand & voice` link in root `CLAUDE.md`. Exact format → `references/brand-grounding.md`.
|
|
30
|
+
1. **Locate the brand study.** Read the project's root `CLAUDE.md` for a `## Brand & voice` section linking into `02-DOCS/wiki/brand/` (the `harness` Karpathy-wiki convention: compiled brand articles under `02-DOCS/wiki/brand/`, raw inputs the user pastes under `02-DOCS/raw/brand/`). No `CLAUDE.md`, no link, or a link that points nowhere = ABSENT.
|
|
31
|
+
2. **Check completeness** against the checklist in `references/brand-grounding.md` — it extends the shared brand checklist with **deck-specific** dimensions: deck purpose, audience & setting, length, presenter-vs-leave-behind, and must-include slides. Any empty dimension = INCOMPLETE.
|
|
32
|
+
3. **If ABSENT or INCOMPLETE, STOP and interview the user** — one focused batch at a time, never all questions at once. Voice samples are mandatory; never fabricate a voice. Then persist: write/update the brand study under `02-DOCS/wiki/brand/` (raw inputs verbatim under `02-DOCS/raw/brand/`), and add/update the `## Brand & voice` link in root `CLAUDE.md`. Exact format → `references/brand-grounding.md`.
|
|
47
33
|
4. **Only once the study is complete, proceed** — and cite which articles drove the deck (e.g. "narrative grounded in `02-DOCS/wiki/brand/value-proposition.md`, voice in `voice.md`").
|
|
48
34
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
## The non-negotiables
|
|
35
|
+
Single exception: if the user explicitly says "skip it, rough draft", you may produce a clearly-labelled
|
|
36
|
+
`DRAFT (ungrounded — not brand-checked)` and still recommend running the gate before it ships.
|
|
52
37
|
|
|
53
|
-
|
|
38
|
+
## Design the message before the pixels
|
|
54
39
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
4. **Legible from the back of the room.** Body text ≥ 24pt (≥ 28–32pt for talks); ~6 words/line, ~6 lines/slide as a ceiling, not a target. Contrast ≥ 4.5:1. If it doesn't read at 3 metres, it doesn't ship.
|
|
59
|
-
5. **16:9, fonts embedded, exports verified.** PDF is vector with fonts embedded; PPTX opens clean in PowerPoint/Keynote/Google Slides. Run `scripts/verify.sh` before claiming done.
|
|
60
|
-
6. **Tokens, not magic numbers.** Colors, type scale, and spacing come from the project's `design` tokens (OKLCH → the deck theme), never hand-picked hex per slide.
|
|
61
|
-
7. **Motion with restraint.** One transition family, fast (≤ 300ms), builds reveal *meaning* (one bullet at a time), not decoration. Honor reduced-motion in HTML pipelines. A deck is not a video.
|
|
62
|
-
8. **No invented numbers.** Every metric on a slide traces to a source (the model, analytics, a citation). Mark gaps `[[NEEDS PROOF]]`; never fabricate to fill a chart.
|
|
63
|
-
|
|
64
|
-
## Design first (assertion-evidence + cognitive load)
|
|
65
|
-
|
|
66
|
-
Before a pipeline, a theme, or a single pixel: a deck is a *communication* artifact, and the design that
|
|
67
|
-
matters most is the message design. The one principle everything below descends from is **audience-centered
|
|
68
|
-
design** — every choice serves the audience's understanding, not the presenter's comfort.
|
|
40
|
+
A deck is a *communication* artifact, so the design that matters most is the message design. Everything
|
|
41
|
+
below descends from **audience-centered design** — every choice serves the audience's understanding, not
|
|
42
|
+
the presenter's comfort.
|
|
69
43
|
|
|
70
44
|
**Plan the message (six questions).** Lock these before storyboarding: (1) who *specifically* is the
|
|
71
45
|
audience and what do they already know; (2) the ONE main message they remember a week later; (3) the 3–5
|
|
72
46
|
supporting points that carry it; (4) the evidence proving each; (5) the single call-to-action; (6) what is
|
|
73
|
-
essential vs. expandable under time pressure. These feed
|
|
74
|
-
|
|
47
|
+
essential vs. expandable under time pressure. These feed the deck arc directly: message = thesis, points =
|
|
48
|
+
beats, CTA = closing ask (→ `references/storytelling-and-decks.md`).
|
|
75
49
|
|
|
76
50
|
**Assertion-evidence is the slide unit.** Each slide = one assertion (a complete claim, written as the
|
|
77
51
|
title) + the visual evidence that proves it — never a topic label over a bullet list. *"User engagement rose
|
|
78
|
-
43% after the redesign"* + a chart, not *"Engagement"* + three bullets.
|
|
79
|
-
|
|
52
|
+
43% after the redesign"* + a chart, not *"Engagement"* + three bullets. The body proves the headline; it
|
|
53
|
+
never repeats it.
|
|
80
54
|
|
|
81
|
-
**
|
|
82
|
-
|
|
83
|
-
|
|
55
|
+
**One concept per slide.** Working memory is small and the audience is also listening to you. If a slide
|
|
56
|
+
needs two breaths to explain, it's two slides. Reveal sequential parts progressively — build order *is* the
|
|
57
|
+
explanation — rather than dumping everything at once.
|
|
84
58
|
|
|
85
|
-
**Spoken vs. shown — never both.** The slide and your mouth are two channels; redundancy wastes both. Show
|
|
86
|
-
the assertion, the visual, the number, the next step; *say* the elaboration, the context, the
|
|
87
|
-
|
|
59
|
+
**Spoken vs. shown — never both.** The slide and your mouth are two channels; redundancy wastes both. *Show*
|
|
60
|
+
the assertion, the visual, the number, the next step; *say* the elaboration, the context, the interpretation,
|
|
61
|
+
the story. Reading slides verbatim is the fastest way to lose a room.
|
|
88
62
|
|
|
89
63
|
Full frameworks — the planning questions, the spoken/shown table, the **1–5 evaluation rubric**
|
|
90
64
|
(audience-centered / visual clarity / cognitive load / accessibility), the implementation checklist, and the
|
|
91
65
|
communication anti-patterns — live in `references/slide-design.md`. Score any draft against the rubric (≥ 4
|
|
92
|
-
on each axis) before shipping
|
|
66
|
+
on each axis) before shipping.
|
|
93
67
|
|
|
94
68
|
## Which pipeline? (decide before building)
|
|
95
69
|
|
|
@@ -186,10 +160,8 @@ Always pin/verify the version in the target project before generating (`marp --v
|
|
|
186
160
|
The deck's words are conversion copy on a stage. Defer the *craft* to `../marketing/SKILL.md`; this skill
|
|
187
161
|
enforces the deck-specific shape:
|
|
188
162
|
|
|
189
|
-
- **Assertion headline per slide.** Not "Market", but "TAM is $12B and growing 24%/yr". The headline carries the point; the body is evidence.
|
|
190
163
|
- **Benefit-led, climbing feature → benefit → proof**, stopping at the rung the audience cares about. Specificity (a number, a mechanism, a receipt) beats adjectives — "2× faster" not "blazing fast".
|
|
191
|
-
- **
|
|
192
|
-
- **Two variants when both are needed:** *presenter* (sparse, you narrate) vs *leave-behind* (self-contained, sent as PDF). Same narrative, different text density — never ship a wall-of-text presenter slide.
|
|
164
|
+
- **Two text densities, chosen deliberately:** *presenter* slides carry a headline + one visual + 0–3 support points, with the argument in the speaker notes / your mouth; *leave-behind* slides are self-contained because no one is narrating. Never ship a wall-of-text presenter slide.
|
|
193
165
|
- **Voice from the brand study.** Headlines obey the do/don't word lists and tone samples. Ban-list words ("revolutionary", "seamless", "game-changer", "supercharge") are defects.
|
|
194
166
|
|
|
195
167
|
## Visual system for slides (with `design`)
|
|
@@ -199,11 +171,11 @@ The deck's pixels are the brand's design system projected at 3 metres. Defer the
|
|
|
199
171
|
`references/slide-design.md`):
|
|
200
172
|
|
|
201
173
|
- **Layout grid** built for 16:9: a 12-column grid, generous margins, one focal point per slide, consistent safe-area so nothing clips on a projector.
|
|
202
|
-
- **Type scale for projection**, not
|
|
203
|
-
- **Color from tokens, allocated for a room:** dark
|
|
204
|
-
- **Data viz that makes one point:** one chart = one takeaway named in the headline; remove gridlines/clutter; label directly; pre-attentive emphasis (one highlighted bar/line) over rainbow palettes; never a 3-D pie.
|
|
174
|
+
- **Type scale for projection**, not laptop reading distance: display/headline/body/caption steps, body ≥ 24pt (≥ 28–32pt for talks), ~6 words/line and ~6 lines/slide as a ceiling, contrast ≥ 4.5:1. Never drop below the legibility floor to cram text — split the slide instead. If it doesn't read at 3 metres, it doesn't ship.
|
|
175
|
+
- **Color from tokens, allocated for a room:** dark themes read better in dark rooms / on big screens, light themes for printed handouts and bright rooms. High contrast always; never rely on color alone to encode meaning.
|
|
176
|
+
- **Data viz that makes one point:** one chart = one takeaway named in the headline; remove gridlines/clutter; label directly; pre-attentive emphasis (one highlighted bar/line) over rainbow palettes; never a 3-D pie. Every number traces to a source — mark gaps `[[NEEDS PROOF]]`, never fabricate one to fill a chart.
|
|
205
177
|
- **Imagery** full-bleed and intentional (with a legibility scrim behind text), not stocky decoration; respect resolution so it doesn't pixelate on a 4K projector.
|
|
206
|
-
- **Motion with restraint:** one transition family, builds that reveal one idea at a time
|
|
178
|
+
- **Motion with restraint:** one transition family, ≤ 300ms, builds that reveal one idea at a time; reduced-motion honored in HTML pipelines. Animation explains sequence/state change, never just fills time.
|
|
207
179
|
|
|
208
180
|
## Anti-patterns
|
|
209
181
|
|
|
@@ -253,7 +225,8 @@ npx decktape reveal http://localhost:8000 deck.pdf
|
|
|
253
225
|
|
|
254
226
|
## Deck QA gate
|
|
255
227
|
|
|
256
|
-
Run before claiming done. `scripts/verify.sh` automates the
|
|
228
|
+
Run before claiming done — each line is a defect if unchecked. `scripts/verify.sh` automates the
|
|
229
|
+
mechanical subset.
|
|
257
230
|
|
|
258
231
|
- [ ] Brand study located, complete, and cited (which articles grounded the deck).
|
|
259
232
|
- [ ] One idea per slide; every slide titled with an assertion headline, not a topic label.
|
|
@@ -269,28 +242,17 @@ Run before claiming done. `scripts/verify.sh` automates the mechanical subset.
|
|
|
269
242
|
- [ ] File size sane (compressed images, subsetted fonts); ban-list words absent from copy.
|
|
270
243
|
- [ ] Scored ≥ 4/5 on each axis of the design rubric — audience-centered, visual clarity, cognitive load, accessibility (→ `references/slide-design.md`, "Diagnostic rubric").
|
|
271
244
|
|
|
272
|
-
## Project grounding (02-DOCS
|
|
273
|
-
|
|
274
|
-
When this skill runs in a project with a `02-DOCS/` layer (the
|
|
275
|
-
[`harness`](../harness/SKILL.md) Karpathy wiki), record this project's deck
|
|
276
|
-
conventions there and index them from the root `CLAUDE.md`, so the next agent inherits them instead of
|
|
277
|
-
re-deriving them.
|
|
278
|
-
|
|
279
|
-
1. **Find the article** `02-DOCS/wiki/stack/presentations.md`, indexed in `02-DOCS/wiki/index.md` (the Knowledge map index; root `CLAUDE.md` points to it).
|
|
280
|
-
2. **If missing or stale**, create/update it with this project's real choices — the chosen pipeline (Marp / Slidev / python-pptx) and why; the theme file path and how it maps the design tokens (`02-DOCS/wiki/stack/design.md`); the standard deck arc(s); export commands and the canonical output (PDF / PPTX); presenter-vs-leave-behind convention; font-embedding and asset-location notes — then index it in `02-DOCS/wiki/index.md` (the Knowledge map; root `CLAUDE.md` keeps only a short pointer to it).
|
|
281
|
-
3. **Read it first on every use** and stay consistent; when a convention changes, update the article (bump its `Updated` date) in the same change.
|
|
282
|
-
|
|
283
|
-
The deck theme is downstream of the design tokens: always reconcile `02-DOCS/wiki/stack/presentations.md`
|
|
284
|
-
with `02-DOCS/wiki/stack/design.md` so the deck and the product share one palette and type system.
|
|
245
|
+
## Project grounding (02-DOCS)
|
|
285
246
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
247
|
+
In a project with a `02-DOCS/` layer (the [`harness`](../harness/SKILL.md) Karpathy wiki), read
|
|
248
|
+
`02-DOCS/wiki/stack/presentations.md` first and stay consistent with it; create or refresh it when
|
|
249
|
+
missing or stale, and index it in `02-DOCS/wiki/index.md`. It records this project's real choices: the
|
|
250
|
+
chosen pipeline (Marp / Slidev / python-pptx) and why, the theme file path and how it maps the design
|
|
251
|
+
tokens, the standard deck arc(s), export commands and the canonical output, the presenter-vs-leave-behind
|
|
252
|
+
convention, and font-embedding / asset-location notes.
|
|
289
253
|
|
|
290
|
-
|
|
254
|
+
The deck theme is downstream of the design tokens: always reconcile that article with
|
|
255
|
+
`02-DOCS/wiki/stack/design.md` so the deck and the product share one palette and type system.
|
|
291
256
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
- `../nextjs/SKILL.md` — when a "deck" is actually a web-native landing/microsite, the build belongs there.
|
|
295
|
-
- `../harness/SKILL.md` — the `02-DOCS` Karpathy-wiki convention the brand study and deck conventions persist into.
|
|
296
|
-
- References: `references/storytelling-and-decks.md` (arcs + slide-by-slide skeletons), `references/markdown-decks.md` (Marp + Slidev theming & export), `references/pptx-python.md` (python-pptx recipes), `references/slide-design.md` (visual system + data viz + motion), `references/brand-grounding.md` (checklist + question script).
|
|
257
|
+
No `02-DOCS/` layer? Skip silently (optionally suggest `harness`). Unlike the brand study, deck
|
|
258
|
+
conventions are *recorded, not gated* — never block the task on this.
|
package/skills/python/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: python
|
|
3
|
-
description: "Use when
|
|
3
|
+
description: "Use when the task is Python itself, in any framework or none: PEP 695 generics, mypy --strict typing, dataclass/Protocol/TypedDict/Enum choices, asyncio.TaskGroup, stdlib idioms, src/ layout + pyproject.toml with uv, ruff+mypy+pytest gate. NOT a FastAPI/ASGI service (that is fastapi), NOT a deep pytest suite (that is testing-py)."
|
|
4
4
|
tags: [python, typing, async, packaging, uv]
|
|
5
5
|
recommends: [fastapi, secure-coding, deployment]
|
|
6
6
|
origin: risco
|
|
@@ -20,15 +20,7 @@ annotations`), PEP 750 template strings (`t"..."`), and `compression.zstd`. Tool
|
|
|
20
20
|
**uv 0.11** (project + package manager), **ruff 0.15** (lint + format), **mypy 1.20
|
|
21
21
|
`--strict`** (or Astral's `ty`, still preview — default to mypy), **pytest 8**.
|
|
22
22
|
|
|
23
|
-
##
|
|
24
|
-
|
|
25
|
-
**Use when** the question is *the language* in any `.py` file or `pyproject.toml`: typing,
|
|
26
|
-
generics, protocols, dataclass/NamedTuple/TypedDict/Enum choices, async (`TaskGroup`, timeouts,
|
|
27
|
-
cancellation — not a web server), comprehensions, context managers, error handling; setting up a
|
|
28
|
-
project from zero with `uv` (init, venv, lockfile, scripts); modernizing to PEP 695; or wiring
|
|
29
|
-
the `ruff` + type-checker + `pytest` + `verify.sh` gate.
|
|
30
|
-
|
|
31
|
-
**When NOT to use (delegate):**
|
|
23
|
+
## Scope — what this skill delegates
|
|
32
24
|
|
|
33
25
|
- Building a FastAPI / ASGI service (routes, Pydantic models, SQLAlchemy, uvicorn) ->
|
|
34
26
|
[`fastapi`](../fastapi/SKILL.md). That skill owns the service shape; this one owns the
|
|
@@ -56,19 +48,10 @@ Apply on every Python edit:
|
|
|
56
48
|
unindented — arrow code hides the logic.
|
|
57
49
|
3. **Stdlib before a dependency.** `pathlib`, `itertools`, `functools`, `dataclasses`,
|
|
58
50
|
`collections` cover most needs; a new dep is a maintenance liability you must justify.
|
|
59
|
-
4. **
|
|
60
|
-
writes the dep and updates `uv.lock`, which you commit.
|
|
61
|
-
5. **Prefer immutability.** `@dataclass(frozen=True, slots=True)` for value objects; mutate
|
|
51
|
+
4. **Prefer immutability.** `@dataclass(frozen=True, slots=True)` for value objects; mutate
|
|
62
52
|
only where you must — shared mutable state is the bug you debug at 2am.
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
you do not own; `logging.getLogger(__name__)` lets them configure it.
|
|
66
|
-
8. **`asyncio.TaskGroup` over bare `gather`.** A `TaskGroup` cancels siblings on first error and
|
|
67
|
-
propagates an `ExceptionGroup`; `gather` leaks tasks on failure (rule 8 in Async below).
|
|
68
|
-
9. **No mutable default arguments.** `def f(xs: list[int] | None = None)` then `xs = xs or []`;
|
|
69
|
-
`def f(xs=[])` shares one list across all calls — a classic latent bug.
|
|
70
|
-
10. **Everything passes the gate.** `ruff check` + `ruff format --check` + `mypy --strict` +
|
|
71
|
-
`pytest` — green locally via `scripts/verify.sh` before you call it done.
|
|
53
|
+
5. **Everything passes the gate.** `ruff check` + `ruff format --check` + `mypy --strict` +
|
|
54
|
+
`pytest` — green locally via `scripts/verify.sh` before you call it done.
|
|
72
55
|
|
|
73
56
|
## Typing
|
|
74
57
|
|
|
@@ -95,7 +78,7 @@ annotations`.
|
|
|
95
78
|
|
|
96
79
|
Full PEP 695 bounds/constraints/variance, `Protocol` vs ABC, `TypedDict`
|
|
97
80
|
`Required`/`NotRequired`, `ParamSpec`/`TypeVarTuple`, `TypeGuard`/`TypeIs`, `cast`, and common
|
|
98
|
-
`--strict` errors with fixes -> `references/typing.md
|
|
81
|
+
`--strict` errors with fixes -> [`references/typing.md`](references/typing.md).
|
|
99
82
|
|
|
100
83
|
## Data modeling
|
|
101
84
|
|
|
@@ -129,11 +112,13 @@ the thing genuinely *is* a small tuple you also unpack positionally.
|
|
|
129
112
|
Reach into the stdlib before adding a dependency.
|
|
130
113
|
|
|
131
114
|
- **`pathlib`** for all filesystem paths: `Path("data") / name`, `p.read_text()`,
|
|
132
|
-
`p.glob("*.json")`, `p.with_suffix(".bak")`.
|
|
115
|
+
`p.glob("*.json")`, `p.with_suffix(".bak")` — typed and composable, never `os.path.join`.
|
|
133
116
|
- **`collections`**: `defaultdict(list)`, `Counter(words)`, `deque(maxlen=100)` for ring buffers.
|
|
134
117
|
- **`itertools`**: `chain`, `groupby`, `islice`, `batched` (3.12+) instead of hand-rolled loops.
|
|
135
118
|
- **`functools`**: `@cache` / `@lru_cache` for pure memoization, `@cached_property`, `partial`.
|
|
136
119
|
- **`contextlib`**: `@contextmanager`, `ExitStack` for dynamic resource sets, `suppress(FileNotFoundError)`.
|
|
120
|
+
- **`logging`**, never `print` in a library: `print` writes to a caller's stdout you do not own;
|
|
121
|
+
`logging.getLogger(__name__)` lets them configure it.
|
|
137
122
|
|
|
138
123
|
Prefer comprehensions over `map`/`filter`+`lambda`; prefer a generator (`(... for ...)`) when
|
|
139
124
|
you only iterate once. Use `match` for structural dispatch over a chain of `isinstance`:
|
|
@@ -158,7 +143,7 @@ f-strings for formatting; note 3.14's PEP 750 `t"..."` template strings yield a
|
|
|
158
143
|
(not a `str`) for *safe custom interpolation* (e.g. escaping) — use them when an f-string would
|
|
159
144
|
inject untrusted text. Full cookbook (itertools/functools/collections recipes, `match`
|
|
160
145
|
patterns, dataclass `field`/`default_factory`/`__post_init__`, `Enum`/`StrEnum`/`IntFlag`) ->
|
|
161
|
-
`references/stdlib.md
|
|
146
|
+
[`references/stdlib.md`](references/stdlib.md).
|
|
162
147
|
|
|
163
148
|
## Errors & resources
|
|
164
149
|
|
|
@@ -205,7 +190,8 @@ Bound every wait with `async with asyncio.timeout(5.0):`. On `CancelledError`, c
|
|
|
205
190
|
concurrency only; CPU-bound work blocks the loop — push it to `asyncio.to_thread` / a
|
|
206
191
|
`ProcessPoolExecutor` (or 3.14's free-threaded build). **HTTP servers belong to
|
|
207
192
|
[`fastapi`](../fastapi/SKILL.md), not here.** Runtime model, `ExceptionGroup`/`except*`, queues
|
|
208
|
-
with backpressure, cancellation discipline, and sync<->async bridging ->
|
|
193
|
+
with backpressure, cancellation discipline, and sync<->async bridging ->
|
|
194
|
+
[`references/async.md`](references/async.md).
|
|
209
195
|
|
|
210
196
|
## Project layout & packaging (uv)
|
|
211
197
|
|
|
@@ -221,7 +207,8 @@ myapp/
|
|
|
221
207
|
scripts/verify.sh
|
|
222
208
|
```
|
|
223
209
|
|
|
224
|
-
`pyproject.toml` is the single config — PEP 621 metadata, dependency groups, and tool config
|
|
210
|
+
`pyproject.toml` is the single config — PEP 621 metadata, dependency groups, and tool config.
|
|
211
|
+
Never hand-edit a `requirements.txt`; `uv add` writes the dep and updates `uv.lock`, which you commit.
|
|
225
212
|
|
|
226
213
|
```toml
|
|
227
214
|
[project]
|
|
@@ -306,9 +293,9 @@ random.random() # tokens secrets.token_urlsafe(32) #
|
|
|
306
293
|
Keep deps locked (`uv.lock`) and audited (`pip-audit` / `uv` resolution); read secrets from
|
|
307
294
|
env or a secret manager, never hardcode or log them.
|
|
308
295
|
|
|
309
|
-
## Anti-patterns
|
|
296
|
+
## Anti-patterns -> STOP
|
|
310
297
|
|
|
311
|
-
|
|
|
298
|
+
| Tempting move | Reality / do instead |
|
|
312
299
|
| --- | --- |
|
|
313
300
|
| "`def f(xs=[])` is fine, it's empty" | One list shared across all calls; use `= None` then `xs = xs or []`. |
|
|
314
301
|
| "bare `except:` to be safe" | Swallows `KeyboardInterrupt`/bugs; catch a specific type. |
|
|
@@ -323,47 +310,11 @@ env or a secret manager, never hardcode or log them.
|
|
|
323
310
|
| "`pickle.loads` the cache, it's ours" | Any untrusted byte = code execution; use `json`. |
|
|
324
311
|
| "explicit `TypeVar` everywhere" | New code uses PEP 695 `def f[T]` / `class C[T]` / `type X`. |
|
|
325
312
|
|
|
326
|
-
##
|
|
313
|
+
## Project grounding (02-DOCS)
|
|
327
314
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
| Lint + autofix | `uv run ruff check --fix .` |
|
|
335
|
-
| Format (check) | `uv run ruff format --check .` |
|
|
336
|
-
| Type check | `uv run mypy --strict src` |
|
|
337
|
-
| Test | `uv run pytest -q` |
|
|
338
|
-
| Local gate | `./scripts/verify.sh` |
|
|
339
|
-
| Generic | `def f[T](x: T) -> T:` / `type Alias = ...` |
|
|
340
|
-
| Optional | `X | None` (not `Optional[X]`) |
|
|
341
|
-
| Structured async | `async with asyncio.TaskGroup() as tg: tg.create_task(...)` |
|
|
342
|
-
| Memoize | `@functools.cache` |
|
|
343
|
-
| Token | `secrets.token_urlsafe(32)` |
|
|
344
|
-
|
|
345
|
-
## Project grounding (02-DOCS + CLAUDE.md)
|
|
346
|
-
|
|
347
|
-
When this skill runs in a project with a `02-DOCS/` layer (the
|
|
348
|
-
[`harness`](../harness/SKILL.md) Karpathy wiki), record this project's Python conventions
|
|
349
|
-
there so the next agent inherits them — *recorded, not gated*, never block the task on this.
|
|
350
|
-
|
|
351
|
-
1. **Find** `02-DOCS/wiki/stack/python.md`, indexed in `02-DOCS/wiki/index.md` (the Knowledge map index; root `CLAUDE.md` points to it).
|
|
352
|
-
2. **If missing or stale**, write the project's real choices (interpreter floor, `src/` layout,
|
|
353
|
-
uv workflow, ruff/mypy config, async-vs-sync stance, data-modeling defaults) and index it in `02-DOCS/wiki/index.md` (the Knowledge map; root `CLAUDE.md` keeps only a short pointer to it).
|
|
354
|
-
3. **Read it first on every use**; bump its `Updated` date when a convention changes.
|
|
355
|
-
|
|
356
|
-
No `02-DOCS/` layer? Skip silently (optionally suggest `harness`).
|
|
357
|
-
|
|
358
|
-
## See Also
|
|
359
|
-
|
|
360
|
-
Sibling skills: [`fastapi`](../fastapi/SKILL.md) (the FastAPI/ASGI service shape — this skill
|
|
361
|
-
owns the language it is written in), [`secure-coding`](../secure-coding/SKILL.md) (language-
|
|
362
|
-
agnostic threat modeling/authz — this skill keeps the Python-specific controls),
|
|
363
|
-
[`deployment`](../deployment/SKILL.md) (Containerfile/CI/shipping — this skill ships only the
|
|
364
|
-
uv CI note), and `testing-py` (by id; deep pytest technique — this skill carries only the baseline).
|
|
365
|
-
|
|
366
|
-
Local references (read when): `references/typing.md` (PEP 695 generics, Protocol vs ABC,
|
|
367
|
-
TypedDict, narrowing, `--strict` fixes); `references/async.md` (asyncio model, TaskGroup vs
|
|
368
|
-
gather, timeouts, cancellation, queues, CPU-bound); `references/stdlib.md`
|
|
369
|
-
(itertools/functools/collections/contextlib/pathlib cookbook, `match`, dataclasses, Enum).
|
|
315
|
+
In a project that has the [`harness`](../harness/SKILL.md) wiki, record this project's Python
|
|
316
|
+
conventions in `02-DOCS/wiki/stack/python.md` and index it in `02-DOCS/wiki/index.md` — the
|
|
317
|
+
interpreter floor, `src/` layout, uv workflow, ruff/mypy config, async-vs-sync stance, and
|
|
318
|
+
data-modeling defaults. Read it first on every use and bump its `Updated` date when a convention
|
|
319
|
+
changes. This is *recorded, not gated*: never block the task on it, and skip silently when there
|
|
320
|
+
is no `02-DOCS/` layer.
|