[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7EA3ENWN4M2SB8B4SRPHK02":3,"skill-same:01M7EA3ENWN4M2SB8B4SRPHK02":102},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":26,"commitSha":27,"skillDirectory":28,"forksCount":13,"repositoryHtmlUrl":29,"repositoryHomepageUrl":6,"ownerHtmlUrl":30,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":31,"install":32,"resources":45},"01M7EA3ENWN4M2SB8B4SRPHK02","postgresql",null,"PostgreSQL engine rules and SQL text for .NET services. Use when code or a review touches SQL for PostgreSQL (a .sql script, FromSql, SqlQuery, ExecuteSql, migrationBuilder.Sql, Dapper, or plain Npgsql), column types, keys, indexes, EXPLAIN, isolation levels, row locks, a queue table with SKIP LOCKED, an upsert, DDL on a live table, NpgsqlDataSource, COPY, or a report per local day. Not for EF Core mapping, LINQ, or generated EF migrations (dev-stack:efcore), SQL Server or T-SQL (dev-stack:sqlserver), or server operations (backup, replication, postgresql.conf tuning).","Charmedme\u002Fmaikelsoft-skills","Charmedme","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F11330182?v=4","01M7E9YWP4Z4JJ1BRXTMWNXAEV","01M7E9YWPS4N3GKRGAYBBDJWNQ",0,"MIT","https:\u002F\u002Fgithub.com\u002FCharmedme\u002Fmaikelsoft-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fdev-stack\u002Fskills\u002Fpostgresql\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: postgresql\ndescription: PostgreSQL engine rules and SQL text for .NET services. Use when code or a review touches SQL for PostgreSQL (a .sql script, FromSql, SqlQuery, ExecuteSql, migrationBuilder.Sql, Dapper, or plain Npgsql), column types, keys, indexes, EXPLAIN, isolation levels, row locks, a queue table with SKIP LOCKED, an upsert, DDL on a live table, NpgsqlDataSource, COPY, or a report per local day. Not for EF Core mapping, LINQ, or generated EF migrations (dev-stack:efcore), SQL Server or T-SQL (dev-stack:sqlserver), or server operations (backup, replication, postgresql.conf tuning).\nmetadata:\n  verified: \"2026-10-27\"\n  versions: \"PostgreSQL 18.6 (19 is RC 1), Npgsql 10.0.3, Dapper 2.1.89, EFCore.PG 10.0.3, .NET 10\"\n---\n\n# PostgreSQL\n\nEngine rules and SQL text for PostgreSQL. EF Core mapping, LINQ, and generated migrations are in `dev-stack:efcore`. Its `references\u002Fprovider-postgresql.md` has the EF options: `UseNpgsql`, `xmin`, enums, and naming. Test containers are in `dev-stack:dotnet-testing`.\n\nWrite all output except code in the rules of `references\u002Flanguage.md`.\n\n## First\n\n1. Read `references\u002Fstack-rules.md`.\n2. Find the server version: the image tag in the compose file or the Testcontainers builder (`postgres:18.6`), `SetPostgresVersion(...)`, or `SELECT version();`.\n   - PostgreSQL 18: use this file.\n   - PostgreSQL 17 or older: the rules apply, except `uuidv7()` and `LIKE` on a nondeterministic collation. Both came in 18.\n   - PostgreSQL 19 (RC 1 on 2026-10-15): keep 18 in production until 19.1 and EFCore.PG support it (DATA-01).\n3. Find the access path and the name style:\n   - EF Core (`UseNpgsql`), Dapper, or plain Npgsql.\n   - snake_case names (`UseSnakeCaseNamingConvention`, or a hand-written schema), or PascalCase names in quotes (the EF default without the convention).\n\nDone when you can name the server version, the access path, and the name style.\n\n## Defaults for new code\n\nAsk the human before you apply a default that has no accepted decision (stack rule 4). The full entries are in `references\u002Fdecisions.md`.\n\n| Area | Default | ID |\n|------|---------|----|\n| Engine and tag | PostgreSQL 18. Pin the image tag (`postgres:18.6`) in compose and in tests. | DATA-01, DATA-20 |\n| Names | snake_case, no quotes. | DATA-09 |\n| Keys | `uuid` from the EF provider (UUIDv7). Writers without EF: `DEFAULT uuidv7()`. Small lookup tables: `bigint GENERATED ALWAYS AS IDENTITY`. | DATA-07 |\n| Instants | `timestamptz`, written as UTC. | DATA-10 |\n| Money | `numeric(19,4)`. Currency as `varchar(3)` with a `CHECK`. | DATA-11 |\n| Concurrency | The `xmin` token on edited aggregates. | DATA-15 |\n| Bulk insert | Binary `COPY` with `BeginBinaryImportAsync`. | DATA-22 |\n| Pooling | One `NpgsqlDataSource` per database. The Npgsql pool only. | DATA-23 |\n| Case-insensitive text | A nondeterministic ICU collation on the column. | DATA-24 |\n| DDL on live tables | `lock_timeout`, concurrent index builds, `NOT VALID` then `VALIDATE`. | DATA-25 |\n\n## Existing code\n\nIn PostgreSQL code, the defects of stack rule 3 include these. Each one gives a wrong result without an error, and tests with midday times or one worker pass.\n\n| Defect | Rule |\n|--------|------|\n| `::date` or `date_trunc` on a `timestamptz` without `AT TIME ZONE`, in a report per local day, week, or month. With the session zone UTC, it counts UTC days. | 7 |\n| `FOR UPDATE SKIP LOCKED` in autocommit, then a second statement. | 11 |\n| A read, then a write in a second statement, or `MERGE` as an upsert. | 10, 12 |\n| `NOT IN (SELECT ...)` on a nullable column. | 4 |\n| A local `DateTime` sent to `timestamptz` through Dapper or Npgsql. | 6 |\n| On a live table: an index without `CONCURRENTLY`, a column with a volatile default, a constraint without `NOT VALID`, or no `lock_timeout`. | 16 |\n| `BeginBinaryImportAsync` without `CompleteAsync`. | 19 |\n\nNew code \"like the existing report\" depends on that report: fix both, and name the fix under \"Changes\".\n\n## Rules\n\n### Connections\n\n1. Register one `NpgsqlDataSource` per database: `AddNpgsqlDataSource` (package `Npgsql.DependencyInjection`), or `NpgsqlDataSourceBuilder` and `UseNpgsql(dataSource)` when EF and Dapper share it. Open one connection per operation with `await using`. The data source holds the pool, the type mappings, and the settings.\n\n```csharp\nbuilder.Services.AddNpgsqlDataSource(builder.Configuration.GetConnectionString(\"Orders\")!);\n\n\u002F\u002F In a report class that gets NpgsqlDataSource from DI:\nawait using var connection = await dataSource.OpenConnectionAsync(ct);\n```\n\n### Names and SQL text\n\n2. Write each name in SQL as the schema has it. PostgreSQL folds a name without quotes to lowercase. With EF PascalCase names, quote each name (`o.\"PlacedAt\"`). `WHERE Status = 'Placed'` fails with 42703.\n3. Send each value as a parameter: `{value}` in `FromSql`, `SqlQuery`, and `ExecuteSqlAsync`, and `@name` in Dapper. Check an identifier against an allow list (`dev-stack:efcore` rule 23).\n4. Write `NOT EXISTS (SELECT 1 ...)`, not `NOT IN (SELECT ...)`. One NULL in the subquery makes `NOT IN` return no rows.\n5. Raw SQL through EF on an entity with an `xmin` token: select the columns and the token (`SELECT o.*, o.xmin`). `SELECT *` does not return system columns, so EF fails (error 42703). EF cannot compose some SQL: `UPDATE ... RETURNING` and `FOR UPDATE`. Read it with `ToListAsync()` or `AsAsyncEnumerable()`. `SingleAsync()` and `FirstOrDefaultAsync()` put the SQL in a subquery, and PostgreSQL rejects it.\n\n### Types and time\n\n6. Store instants in `timestamptz` and send UTC: a `DateTimeOffset` with offset 0, or a `DateTime` with `Kind = Utc`. Npgsql sends a local `DateTime` as `timestamp`. PostgreSQL then converts it with the session `TimeZone`, without an error. With `America\u002FNew_York`, 12:00 local became 16:00Z. EF throws for this value. Dapper and plain Npgsql do not.\n7. Compute a local day with `(ts AT TIME ZONE 'Europe\u002FAmsterdam')::date`, and a local week or month with `date_trunc('week', ts AT TIME ZONE 'Europe\u002FAmsterdam')`. `ts::date` and `date_trunc` on a `timestamptz` use the session zone: 2026-07-01 22:30Z is 2026-07-02 in Amsterdam. Filter on the bare column with the UTC instants of local midnight, so that an index can serve the filter.\n8. Keys: `bigint GENERATED ALWAYS AS IDENTITY` or `uuid`. Do not use `serial`. On PostgreSQL 18, `DEFAULT uuidv7()` gives ordered keys to writers without EF. It is a built-in function, so it needs no extension.\n9. Money: `numeric(19,4)`. Not `money` (it depends on `lc_monetary`) and not `float8`. Text: `text`, or `varchar(n)` when the limit is a rule. Not `char(n)`, because it pads with spaces.\n\n```sql\n-- Revenue per day in Amsterdam time. @from and @to_exclusive are dates.\nSELECT (o.placed_at AT TIME ZONE 'Europe\u002FAmsterdam')::date AS day,\n       count(DISTINCT o.id) AS orders,\n       sum(l.quantity * l.unit_price) AS revenue\nFROM orders AS o\nJOIN order_lines AS l ON l.order_id = o.id\nWHERE o.placed_at >= (@from::timestamp AT TIME ZONE 'Europe\u002FAmsterdam')\n  AND o.placed_at \u003C  (@to_exclusive::timestamp AT TIME ZONE 'Europe\u002FAmsterdam')\nGROUP BY 1\nORDER BY 1;\n```\n\n### Concurrency\n\n10. Keep `READ COMMITTED`, the default. Make a change safe with one conditional statement (`UPDATE ... WHERE status = 'Placed'`, then check the row count) or with a concurrency token. When you need `REPEATABLE READ` or `SERIALIZABLE`, retry the whole transaction on 40001 and 40P01. Npgsql sets `PostgresException.IsTransient` for both, so the EF execution strategy retries them.\n11. Claim work (a queue, \"the next order\") with `FOR UPDATE SKIP LOCKED`, in one statement or in one transaction. Without a transaction, the lock ends with the `SELECT`, and two workers get the same row. `FOR UPDATE` without `SKIP LOCKED` makes the workers wait for each other.\n\n```csharp\nvar ids = await db.Database.SqlQuery\u003CGuid>($\"\"\"\n    UPDATE orders\n    SET \"Status\" = 'Picking', \"PickedBy\" = {workerId}, \"PickingStartedAt\" = {now}\n    WHERE \"Id\" = (\n        SELECT \"Id\" FROM orders\n        WHERE \"Status\" = 'Placed'\n        ORDER BY \"PlacedAt\", \"Id\"\n        LIMIT 1\n        FOR UPDATE SKIP LOCKED)\n    RETURNING \"Id\" AS \"Value\"\n    \"\"\").ToListAsync(ct); \u002F\u002F not SingleOrDefaultAsync: EF cannot compose UPDATE ... RETURNING\n```\n\n12. Enforce uniqueness with a unique index, and map 23505 to 409. Write an upsert as `INSERT ... ON CONFLICT (key) DO UPDATE SET ...`. It gives one atomic result when two calls run at the same time.\n\nDetail on MVCC, isolation, queues, advisory locks, and deadlocks: `references\u002Fconcurrency.md`.\n\n### Indexes and plans\n\n13. Design an index from the query: equality columns first, then the range or sort column. Use a partial index for a hot subset (`WHERE status = 'Placed'`). Use GIN for `jsonb`, arrays, `tsvector`, and `pg_trgm`. Each index costs time on each write, so add an index for a query, not for each column.\n14. Index each foreign key column that a join or a cascade delete uses. PostgreSQL does not make that index. EF migrations add it. A hand-written schema must add it.\n15. Prove a plan with `EXPLAIN (ANALYZE, BUFFERS)` on data like production. A plan on a small test table proves nothing.\n\nDetail and examples: `references\u002Findexes.md`.\n\n### DDL on live tables\n\n16. In each migration that changes a table with live writes (DATA-25):\n    - Start with `SET lock_timeout = '5s'`. A DDL statement waits for its lock, and all later queries on the table wait behind it.\n    - Build an index with `CREATE INDEX CONCURRENTLY`, outside a transaction. After a failed build, drop the INVALID index and build it again. EF: `IsCreatedConcurrently()`. One idempotent script: `dev-stack:efcore` rule 32a.\n    - Add a column with a volatile default (`gen_random_uuid()`, `clock_timestamp()`) in steps: add it without a default, fill it in batches, then set the default. The one-step form writes the table again under an `ACCESS EXCLUSIVE` lock. A constant default does not.\n    - Add a foreign key or a check as `NOT VALID`, then run `VALIDATE CONSTRAINT` in a later statement. Without `NOT VALID`, PostgreSQL scans the table while it holds the `ACCESS EXCLUSIVE` lock. `lock_timeout` limits only the wait for the lock, not the scan.\n    - Rename or remove a column in expand and contract steps (OPS-15).\n\nDetail, the order of steps, and the lint rules: `references\u002Fddl-live-tables.md`.\n\n### Dapper and COPY\n\n17. Dapper on Npgsql: write `= ANY(@ids)` with an array or a list. Dapper sends a list as one array parameter on Npgsql, so `IN @ids` fails with 42601.\n18. Set `DefaultTypeMap.MatchNamesWithUnderscores = true` one time at startup when the schema has snake_case names and the C# types have PascalCase properties.\n19. For a large insert, use binary `COPY` with `BeginBinaryImportAsync`, and call `CompleteAsync()` before the dispose. Without it, Npgsql cancels the `COPY` at the dispose. In autocommit mode, PostgreSQL keeps no rows and gives no error. In a transaction the next command fails with 25P02.\n\n```csharp\nawait using (var writer = await connection.BeginBinaryImportAsync(\n    \"COPY stock_levels (sku, available) FROM STDIN (FORMAT BINARY)\", ct))\n{\n    foreach (var row in rows)\n    {\n        await writer.StartRowAsync(ct);\n        await writer.WriteAsync(row.Sku, NpgsqlDbType.Varchar, ct);\n        await writer.WriteAsync(row.Available, NpgsqlDbType.Integer, ct);\n    }\n\n    await writer.CompleteAsync(ct); \u002F\u002F without this call, PostgreSQL keeps no rows\n}\n```\n\nDetail on the data source, Dapper mapping, multiple results, and COPY: `references\u002Fnpgsql-dapper.md`.\n\n## Never write\n\n| Wrong | Correct |\n|-------|---------|\n| `new NpgsqlConnection(connectionString)` in each method | `await using var c = await dataSource.OpenConnectionAsync(ct);` |\n| `\"... WHERE id IN @ids\"` (Dapper on Npgsql) | `\"... WHERE id = ANY(@ids)\"` |\n| `WHERE Status = 'Placed'` on an EF table with PascalCase names | `WHERE \"Status\" = 'Placed'` |\n| `new { importedAt = DateTime.Now }` | `new { importedAt = time.GetUtcNow() }` |\n| `GROUP BY placed_at::date` for a local day | `GROUP BY (placed_at AT TIME ZONE 'Europe\u002FAmsterdam')::date` |\n| `date_trunc('week', placed_at)` for a local week | `date_trunc('week', placed_at AT TIME ZONE 'Europe\u002FAmsterdam')` |\n| `placed_at timestamp NOT NULL` | `placed_at timestamptz NOT NULL` |\n| `id serial PRIMARY KEY` | `id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY` |\n| `amount money` or `amount float8` | `amount numeric(19,4)` |\n| `WHERE sku NOT IN (SELECT sku FROM discontinued)` | `WHERE NOT EXISTS (SELECT 1 FROM discontinued d WHERE d.sku = s.sku)` |\n| `SELECT ... FOR UPDATE SKIP LOCKED` in autocommit, then a second `UPDATE` | One `UPDATE ... WHERE id = (SELECT ... FOR UPDATE SKIP LOCKED) RETURNING`, or both in one transaction |\n| `FromSql($\"SELECT * FROM orders ...\")` on an entity with `xmin` | `FromSql($\"SELECT o.*, o.xmin FROM orders AS o ...\")` |\n| `SqlQuery\u003CGuid>($\"UPDATE ... RETURNING ...\").SingleOrDefaultAsync()` | `(await ...ToListAsync(ct)).SingleOrDefault()` |\n| `BeginBinaryImportAsync(...)` without `CompleteAsync` | `await writer.CompleteAsync(ct);` before the dispose |\n| `CREATE INDEX ix ON order_lines (sku);` on a live table | `CREATE INDEX CONCURRENTLY ix ON order_lines (sku);` outside a transaction |\n| `ADD COLUMN batch_id uuid NOT NULL DEFAULT gen_random_uuid()` on a live table | Add it without a default, fill it in batches, then set the default |\n| `lower(email) = lower(@email)` | A nondeterministic ICU collation on the column (DATA-24) |\n\n## Check\n\n1. Build with the analyzers as errors:\n\n   ```\n   dotnet build -warnaserror\n   ```\n\n   Pass: `Build succeeded` with 0 warnings.\n\n2. Run the tests against the pinned production image (`postgres:18.6`, DATA-20). Pass: all tests green. A test of a claim query runs parallel calls, because one call cannot show a double claim.\n3. Lint each migration SQL file, when the team approved the tool (stack rule 5). For EF migrations, make the SQL first with `dotnet ef migrations script \u003Cfrom> \u003Cto> -o migration.sql`.\n\n   ```\n   npx squawk-cli@2.70.0 migration.sql\n   ```\n\n   Pass: no finding of the lock rules (`require-concurrent-index-creation`, `adding-field-with-default`, `constraint-missing-not-valid`, `require-lock-timeout`, `prefer-timestamptz`, `prefer-identity`). Squawk exits with 1 on any warning. Style rules such as `prefer-text-field` and `prefer-robust-stmts` are team choices: turn them off in `.squawk.toml`, or give the reason in the report.\n4. Check a new hot query: `EXPLAIN (ANALYZE, BUFFERS) \u003Cquery>` on data like production. Pass: an index scan or a bitmap scan on the hot path, no sequential scan of a big table.\n5. Run the rules of this skill:\n\n   ```\n   python3 \u003Cskill folder>\u002Fscripts\u002Fstackcheck.py --root \u003Crepo>\n   ```\n\n   Pass: 0 errors. For each warning, fix it or add `\u002F\u002F stackcheck: ignore \u003CRULE-ID> \u003Creason>`.\n\n## Review checklist\n\nThe full list is in `references\u002Freview-checklist.md`.\n\n1. Dapper on Npgsql uses `= ANY(@ids)`, not `IN @ids`. tool (PG-DAPPER-IN-LIST)\n2. Each binary `COPY` calls `CompleteAsync`. judge\n3. Instants are `timestamptz`. Parameters are UTC values, not a local `DateTime`. tool (PG-TIMESTAMP-NO-TZ), judge\n4. A local day, week, or month uses `AT TIME ZONE` with an IANA zone. Check the existing report that the change copies too. The `WHERE` clause compares the bare column. tool (PG-LOCAL-DATE-NO-ZONE), judge\n5. A claim query uses `SKIP LOCKED` in one statement or one transaction. judge\n6. No `NOT IN (SELECT ...)`. tool (PG-NOT-IN-SUBQUERY)\n7. Raw SQL quotes PascalCase names. `FromSql` on an entity with `xmin` selects `xmin`. EF does not compose `UPDATE ... RETURNING`. tool (PG-SELECT-STAR-FROMSQL), judge\n8. A migration on a live table sets `lock_timeout`, builds indexes concurrently, and uses `NOT VALID`. tool (squawk), judge\n9. Keys are identity or `uuid`, not `serial`. tool (PG-SERIAL)\n10. One `NpgsqlDataSource`. No new `NpgsqlConnection` in each call. tool (PG-NEW-CONNECTION)\n11. Uniqueness comes from a unique index. An upsert uses `ON CONFLICT`. Code maps 23505. judge\n12. A `REPEATABLE READ` or `SERIALIZABLE` transaction retries on 40001 and 40P01. judge\n13. Each index serves a query. A hand-written schema indexes its foreign keys. judge\n\n## Report\n\nEnd with the report of stack rule 8 (`references\u002Fstack-rules.md`): the same headings in the same order on each run.\n\n## References\n\n- `references\u002Fdecisions.md`: read before new code needs DATA-23, DATA-24, DATA-25, or the PostgreSQL part of DATA-07, DATA-10, DATA-11, DATA-15, or DATA-22.\n- `references\u002Fconcurrency.md`: read when you write a queue, an upsert, a counter, or a transaction with an isolation level. Also read it for 40001, 40P01, or a lock wait.\n- `references\u002Findexes.md`: read when you add or review an index, or a query is slow.\n- `references\u002Fddl-live-tables.md`: read before you write or review a migration that changes a table with data.\n- `references\u002Fnpgsql-dapper.md`: read when you write Dapper or plain Npgsql code, a data source, or a bulk import.\n- `references\u002Freview-checklist.md`: read for a full review.\n- `references\u002Fsources.md`: the primary sources, the evidence, and the credits.\n- `references\u002Fstack-rules.md` and `references\u002Flanguage.md`: the common rules and the output language.\n- `scripts\u002Fstackcheck.py`: the rule check of this skill.\n","# PostgreSQL\n\nEngine rules and SQL text for PostgreSQL. EF Core mapping, LINQ, and generated migrations are in `dev-stack:efcore`. Its `references\u002Fprovider-postgresql.md` has the EF options: `UseNpgsql`, `xmin`, enums, and naming. Test containers are in `dev-stack:dotnet-testing`.\n\nWrite all output except code in the rules of `references\u002Flanguage.md`.\n\n## First\n\n1. Read `references\u002Fstack-rules.md`.\n2. Find the server version: the image tag in the compose file or the Testcontainers builder (`postgres:18.6`), `SetPostgresVersion(...)`, or `SELECT version();`.\n   - PostgreSQL 18: use this file.\n   - PostgreSQL 17 or older: the rules apply, except `uuidv7()` and `LIKE` on a nondeterministic collation. Both came in 18.\n   - PostgreSQL 19 (RC 1 on 2026-10-15): keep 18 in production until 19.1 and EFCore.PG support it (DATA-01).\n3. Find the access path and the name style:\n   - EF Core (`UseNpgsql`), Dapper, or plain Npgsql.\n   - snake_case names (`UseSnakeCaseNamingConvention`, or a hand-written schema), or PascalCase names in quotes (the EF default without the convention).\n\nDone when you can name the server version, the access path, and the name style.\n\n## Defaults for new code\n\nAsk the human before you apply a default that has no accepted decision (stack rule 4). The full entries are in `references\u002Fdecisions.md`.\n\n| Area | Default | ID |\n|------|---------|----|\n| Engine and tag | PostgreSQL 18. Pin the image tag (`postgres:18.6`) in compose and in tests. | DATA-01, DATA-20 |\n| Names | snake_case, no quotes. | DATA-09 |\n| Keys | `uuid` from the EF provider (UUIDv7). Writers without EF: `DEFAULT uuidv7()`. Small lookup tables: `bigint GENERATED ALWAYS AS IDENTITY`. | DATA-07 |\n| Instants | `timestamptz`, written as UTC. | DATA-10 |\n| Money | `numeric(19,4)`. Currency as `varchar(3)` with a `CHECK`. | DATA-11 |\n| Concurrency | The `xmin` token on edited aggregates. | DATA-15 |\n| Bulk insert | Binary `COPY` with `BeginBinaryImportAsync`. | DATA-22 |\n| Pooling | One `NpgsqlDataSource` per database. The Npgsql pool only. | DATA-23 |\n| Case-insensitive text | A nondeterministic ICU collation on the column. | DATA-24 |\n| DDL on live tables | `lock_timeout`, concurrent index builds, `NOT VALID` then `VALIDATE`. | DATA-25 |\n\n## Existing code\n\nIn PostgreSQL code, the defects of stack rule 3 include these. Each one gives a wrong result without an error, and tests with midday times or one worker pass.\n\n| Defect | Rule |\n|--------|------|\n| `::date` or `date_trunc` on a `timestamptz` without `AT TIME ZONE`, in a report per local day, week, or month. With the session zone UTC, it counts UTC days. | 7 |\n| `FOR UPDATE SKIP LOCKED` in autocommit, then a second statement. | 11 |\n| A read, then a write in a second statement, or `MERGE` as an upsert. | 10, 12 |\n| `NOT IN (SELECT ...)` on a nullable column. | 4 |\n| A local `DateTime` sent to `timestamptz` through Dapper or Npgsql. | 6 |\n| On a live table: an index without `CONCURRENTLY`, a column with a volatile default, a constraint without `NOT VALID`, or no `lock_timeout`. | 16 |\n| `BeginBinaryImportAsync` without `CompleteAsync`. | 19 |\n\nNew code \"like the existing report\" depends on that report: fix both, and name the fix under \"Changes\".\n\n## Rules\n\n### Connections\n\n1. Register one `NpgsqlDataSource` per database: `AddNpgsqlDataSource` (package `Npgsql.DependencyInjection`), or `NpgsqlDataSourceBuilder` and `UseNpgsql(dataSource)` when EF and Dapper share it. Open one connection per operation with `await using`. The data source holds the pool, the type mappings, and the settings.\n\n```csharp\nbuilder.Services.AddNpgsqlDataSource(builder.Configuration.GetConnectionString(\"Orders\")!);\n\n\u002F\u002F In a report class that gets NpgsqlDataSource from DI:\nawait using var connection = await dataSource.OpenConnectionAsync(ct);\n```\n\n### Names and SQL text\n\n2. Write each name in SQL as the schema has it. PostgreSQL folds a name without quotes to lowercase. With EF PascalCase names, quote each name (`o.\"PlacedAt\"`). `WHERE Status = 'Placed'` fails with 42703.\n3. Send each value as a parameter: `{value}` in `FromSql`, `SqlQuery`, and `ExecuteSqlAsync`, and `@name` in Dapper. Check an identifier against an allow list (`dev-stack:efcore` rule 23).\n4. Write `NOT EXISTS (SELECT 1 ...)`, not `NOT IN (SELECT ...)`. One NULL in the subquery makes `NOT IN` return no rows.\n5. Raw SQL through EF on an entity with an `xmin` token: select the columns and the token (`SELECT o.*, o.xmin`). `SELECT *` does not return system columns, so EF fails (error 42703). EF cannot compose some SQL: `UPDATE ... RETURNING` and `FOR UPDATE`. Read it with `ToListAsync()` or `AsAsyncEnumerable()`. `SingleAsync()` and `FirstOrDefaultAsync()` put the SQL in a subquery, and PostgreSQL rejects it.\n\n### Types and time\n\n6. Store instants in `timestamptz` and send UTC: a `DateTimeOffset` with offset 0, or a `DateTime` with `Kind = Utc`. Npgsql sends a local `DateTime` as `timestamp`. PostgreSQL then converts it with the session `TimeZone`, without an error. With `America\u002FNew_York`, 12:00 local became 16:00Z. EF throws for this value. Dapper and plain Npgsql do not.\n7. Compute a local day with `(ts AT TIME ZONE 'Europe\u002FAmsterdam')::date`, and a local week or month with `date_trunc('week', ts AT TIME ZONE 'Europe\u002FAmsterdam')`. `ts::date` and `date_trunc` on a `timestamptz` use the session zone: 2026-07-01 22:30Z is 2026-07-02 in Amsterdam. Filter on the bare column with the UTC instants of local midnight, so that an index can serve the filter.\n8. Keys: `bigint GENERATED ALWAYS AS IDENTITY` or `uuid`. Do not use `serial`. On PostgreSQL 18, `DEFAULT uuidv7()` gives ordered keys to writers without EF. It is a built-in function, so it needs no extension.\n9. Money: `numeric(19,4)`. Not `money` (it depends on `lc_monetary`) and not `float8`. Text: `text`, or `varchar(n)` when the limit is a rule. Not `char(n)`, because it pads with spaces.\n\n```sql\n-- Revenue per day in Amsterdam time. @from and @to_exclusive are dates.\nSELECT (o.placed_at AT TIME ZONE 'Europe\u002FAmsterdam')::date AS day,\n       count(DISTINCT o.id) AS orders,\n       sum(l.quantity * l.unit_price) AS revenue\nFROM orders AS o\nJOIN order_lines AS l ON l.order_id = o.id\nWHERE o.placed_at >= (@from::timestamp AT TIME ZONE 'Europe\u002FAmsterdam')\n  AND o.placed_at \u003C  (@to_exclusive::timestamp AT TIME ZONE 'Europe\u002FAmsterdam')\nGROUP BY 1\nORDER BY 1;\n```\n\n### Concurrency\n\n10. Keep `READ COMMITTED`, the default. Make a change safe with one conditional statement (`UPDATE ... WHERE status = 'Placed'`, then check the row count) or with a concurrency token. When you need `REPEATABLE READ` or `SERIALIZABLE`, retry the whole transaction on 40001 and 40P01. Npgsql sets `PostgresException.IsTransient` for both, so the EF execution strategy retries them.\n11. Claim work (a queue, \"the next order\") with `FOR UPDATE SKIP LOCKED`, in one statement or in one transaction. Without a transaction, the lock ends with the `SELECT`, and two workers get the same row. `FOR UPDATE` without `SKIP LOCKED` makes the workers wait for each other.\n\n```csharp\nvar ids = await db.Database.SqlQuery\u003CGuid>($\"\"\"\n    UPDATE orders\n    SET \"Status\" = 'Picking', \"PickedBy\" = {workerId}, \"PickingStartedAt\" = {now}\n    WHERE \"Id\" = (\n        SELECT \"Id\" FROM orders\n        WHERE \"Status\" = 'Placed'\n        ORDER BY \"PlacedAt\", \"Id\"\n        LIMIT 1\n        FOR UPDATE SKIP LOCKED)\n    RETURNING \"Id\" AS \"Value\"\n    \"\"\").ToListAsync(ct); \u002F\u002F not SingleOrDefaultAsync: EF cannot compose UPDATE ... RETURNING\n```\n\n12. Enforce uniqueness with a unique index, and map 23505 to 409. Write an upsert as `INSERT ... ON CONFLICT (key) DO UPDATE SET ...`. It gives one atomic result when two calls run at the same time.\n\nDetail on MVCC, isolation, queues, advisory locks, and deadlocks: `references\u002Fconcurrency.md`.\n\n### Indexes and plans\n\n13. Design an index from the query: equality columns first, then the range or sort column. Use a partial index for a hot subset (`WHERE status = 'Placed'`). Use GIN for `jsonb`, arrays, `tsvector`, and `pg_trgm`. Each index costs time on each write, so add an index for a query, not for each column.\n14. Index each foreign key column that a join or a cascade delete uses. PostgreSQL does not make that index. EF migrations add it. A hand-written schema must add it.\n15. Prove a plan with `EXPLAIN (ANALYZE, BUFFERS)` on data like production. A plan on a small test table proves nothing.\n\nDetail and examples: `references\u002Findexes.md`.\n\n### DDL on live tables\n\n16. In each migration that changes a table with live writes (DATA-25):\n    - Start with `SET lock_timeout = '5s'`. A DDL statement waits for its lock, and all later queries on the table wait behind it.\n    - Build an index with `CREATE INDEX CONCURRENTLY`, outside a transaction. After a failed build, drop the INVALID index and build it again. EF: `IsCreatedConcurrently()`. One idempotent script: `dev-stack:efcore` rule 32a.\n    - Add a column with a volatile default (`gen_random_uuid()`, `clock_timestamp()`) in steps: add it without a default, fill it in batches, then set the default. The one-step form writes the table again under an `ACCESS EXCLUSIVE` lock. A constant default does not.\n    - Add a foreign key or a check as `NOT VALID`, then run `VALIDATE CONSTRAINT` in a later statement. Without `NOT VALID`, PostgreSQL scans the table while it holds the `ACCESS EXCLUSIVE` lock. `lock_timeout` limits only the wait for the lock, not the scan.\n    - Rename or remove a column in expand and contract steps (OPS-15).\n\nDetail, the order of steps, and the lint rules: `references\u002Fddl-live-tables.md`.\n\n### Dapper and COPY\n\n17. Dapper on Npgsql: write `= ANY(@ids)` with an array or a list. Dapper sends a list as one array parameter on Npgsql, so `IN @ids` fails with 42601.\n18. Set `DefaultTypeMap.MatchNamesWithUnderscores = true` one time at startup when the schema has snake_case names and the C# types have PascalCase properties.\n19. For a large insert, use binary `COPY` with `BeginBinaryImportAsync`, and call `CompleteAsync()` before the dispose. Without it, Npgsql cancels the `COPY` at the dispose. In autocommit mode, PostgreSQL keeps no rows and gives no error. In a transaction the next command fails with 25P02.\n\n```csharp\nawait using (var writer = await connection.BeginBinaryImportAsync(\n    \"COPY stock_levels (sku, available) FROM STDIN (FORMAT BINARY)\", ct))\n{\n    foreach (var row in rows)\n    {\n        await writer.StartRowAsync(ct);\n        await writer.WriteAsync(row.Sku, NpgsqlDbType.Varchar, ct);\n        await writer.WriteAsync(row.Available, NpgsqlDbType.Integer, ct);\n    }\n\n    await writer.CompleteAsync(ct); \u002F\u002F without this call, PostgreSQL keeps no rows\n}\n```\n\nDetail on the data source, Dapper mapping, multiple results, and COPY: `references\u002Fnpgsql-dapper.md`.\n\n## Never write\n\n| Wrong | Correct |\n|-------|---------|\n| `new NpgsqlConnection(connectionString)` in each method | `await using var c = await dataSource.OpenConnectionAsync(ct);` |\n| `\"... WHERE id IN @ids\"` (Dapper on Npgsql) | `\"... WHERE id = ANY(@ids)\"` |\n| `WHERE Status = 'Placed'` on an EF table with PascalCase names | `WHERE \"Status\" = 'Placed'` |\n| `new { importedAt = DateTime.Now }` | `new { importedAt = time.GetUtcNow() }` |\n| `GROUP BY placed_at::date` for a local day | `GROUP BY (placed_at AT TIME ZONE 'Europe\u002FAmsterdam')::date` |\n| `date_trunc('week', placed_at)` for a local week | `date_trunc('week', placed_at AT TIME ZONE 'Europe\u002FAmsterdam')` |\n| `placed_at timestamp NOT NULL` | `placed_at timestamptz NOT NULL` |\n| `id serial PRIMARY KEY` | `id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY` |\n| `amount money` or `amount float8` | `amount numeric(19,4)` |\n| `WHERE sku NOT IN (SELECT sku FROM discontinued)` | `WHERE NOT EXISTS (SELECT 1 FROM discontinued d WHERE d.sku = s.sku)` |\n| `SELECT ... FOR UPDATE SKIP LOCKED` in autocommit, then a second `UPDATE` | One `UPDATE ... WHERE id = (SELECT ... FOR UPDATE SKIP LOCKED) RETURNING`, or both in one transaction |\n| `FromSql($\"SELECT * FROM orders ...\")` on an entity with `xmin` | `FromSql($\"SELECT o.*, o.xmin FROM orders AS o ...\")` |\n| `SqlQuery\u003CGuid>($\"UPDATE ... RETURNING ...\").SingleOrDefaultAsync()` | `(await ...ToListAsync(ct)).SingleOrDefault()` |\n| `BeginBinaryImportAsync(...)` without `CompleteAsync` | `await writer.CompleteAsync(ct);` before the dispose |\n| `CREATE INDEX ix ON order_lines (sku);` on a live table | `CREATE INDEX CONCURRENTLY ix ON order_lines (sku);` outside a transaction |\n| `ADD COLUMN batch_id uuid NOT NULL DEFAULT gen_random_uuid()` on a live table | Add it without a default, fill it in batches, then set the default |\n| `lower(email) = lower(@email)` | A nondeterministic ICU collation on the column (DATA-24) |\n\n## Check\n\n1. Build with the analyzers as errors:\n\n   ```\n   dotnet build -warnaserror\n   ```\n\n   Pass: `Build succeeded` with 0 warnings.\n\n2. Run the tests against the pinned production image (`postgres:18.6`, DATA-20). Pass: all tests green. A test of a claim query runs parallel calls, because one call cannot show a double claim.\n3. Lint each migration SQL file, when the team approved the tool (stack rule 5). For EF migrations, make the SQL first with `dotnet ef migrations script \u003Cfrom> \u003Cto> -o migration.sql`.\n\n   ```\n   npx squawk-cli@2.70.0 migration.sql\n   ```\n\n   Pass: no finding of the lock rules (`require-concurrent-index-creation`, `adding-field-with-default`, `constraint-missing-not-valid`, `require-lock-timeout`, `prefer-timestamptz`, `prefer-identity`). Squawk exits with 1 on any warning. Style rules such as `prefer-text-field` and `prefer-robust-stmts` are team choices: turn them off in `.squawk.toml`, or give the reason in the report.\n4. Check a new hot query: `EXPLAIN (ANALYZE, BUFFERS) \u003Cquery>` on data like production. Pass: an index scan or a bitmap scan on the hot path, no sequential scan of a big table.\n5. Run the rules of this skill:\n\n   ```\n   python3 \u003Cskill folder>\u002Fscripts\u002Fstackcheck.py --root \u003Crepo>\n   ```\n\n   Pass: 0 errors. For each warning, fix it or add `\u002F\u002F stackcheck: ignore \u003CRULE-ID> \u003Creason>`.\n\n## Review checklist\n\nThe full list is in `references\u002Freview-checklist.md`.\n\n1. Dapper on Npgsql uses `= ANY(@ids)`, not `IN @ids`. tool (PG-DAPPER-IN-LIST)\n2. Each binary `COPY` calls `CompleteAsync`. judge\n3. Instants are `timestamptz`. Parameters are UTC values, not a local `DateTime`. tool (PG-TIMESTAMP-NO-TZ), judge\n4. A local day, week, or month uses `AT TIME ZONE` with an IANA zone. Check the existing report that the change copies too. The `WHERE` clause compares the bare column. tool (PG-LOCAL-DATE-NO-ZONE), judge\n5. A claim query uses `SKIP LOCKED` in one statement or one transaction. judge\n6. No `NOT IN (SELECT ...)`. tool (PG-NOT-IN-SUBQUERY)\n7. Raw SQL quotes PascalCase names. `FromSql` on an entity with `xmin` selects `xmin`. EF does not compose `UPDATE ... RETURNING`. tool (PG-SELECT-STAR-FROMSQL), judge\n8. A migration on a live table sets `lock_timeout`, builds indexes concurrently, and uses `NOT VALID`. tool (squawk), judge\n9. Keys are identity or `uuid`, not `serial`. tool (PG-SERIAL)\n10. One `NpgsqlDataSource`. No new `NpgsqlConnection` in each call. tool (PG-NEW-CONNECTION)\n11. Uniqueness comes from a unique index. An upsert uses `ON CONFLICT`. Code maps 23505. judge\n12. A `REPEATABLE READ` or `SERIALIZABLE` transaction retries on 40001 and 40P01. judge\n13. Each index serves a query. A hand-written schema indexes its foreign keys. judge\n\n## Report\n\nEnd with the report of stack rule 8 (`references\u002Fstack-rules.md`): the same headings in the same order on each run.\n\n## References\n\n- `references\u002Fdecisions.md`: read before new code needs DATA-23, DATA-24, DATA-25, or the PostgreSQL part of DATA-07, DATA-10, DATA-11, DATA-15, or DATA-22.\n- `references\u002Fconcurrency.md`: read when you write a queue, an upsert, a counter, or a transaction with an isolation level. Also read it for 40001, 40P01, or a lock wait.\n- `references\u002Findexes.md`: read when you add or review an index, or a query is slow.\n- `references\u002Fddl-live-tables.md`: read before you write or review a migration that changes a table with data.\n- `references\u002Fnpgsql-dapper.md`: read when you write Dapper or plain Npgsql code, a data source, or a bulk import.\n- `references\u002Freview-checklist.md`: read for a full review.\n- `references\u002Fsources.md`: the primary sources, the evidence, and the credits.\n- `references\u002Fstack-rules.md` and `references\u002Flanguage.md`: the common rules and the output language.\n- `scripts\u002Fstackcheck.py`: the rule check of this skill.\n",{"name":5,"metadata":23,"description":7},{"verified":24,"versions":25},"2026-10-27","PostgreSQL 18.6 (19 is RC 1), Npgsql 10.0.3, Dapper 2.1.89, EFCore.PG 10.0.3, .NET 10","main","c247fa77bdea99449b9df09f93d92a35fed91874","plugins\u002Fdev-stack\u002Fskills\u002Fpostgresql","https:\u002F\u002Fgithub.com\u002FCharmedme\u002Fmaikelsoft-skills","https:\u002F\u002Fgithub.com\u002FCharmedme","2026-11-13 14:41:21",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add Charmedme\u002Fmaikelsoft-skills --skill postgresql",{"tool":38,"command":39},"bunx","bunx skills add Charmedme\u002Fmaikelsoft-skills --skill postgresql",{"tool":41,"command":42},"pnpm","pnpm dlx skills add Charmedme\u002Fmaikelsoft-skills --skill postgresql","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FCharmedme\u002Fmaikelsoft-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fdev-stack\u002Fskills\u002Fpostgresql\u002FSKILL.md",true,[46,52,56,60,64,68,72,76,80,84,88,94,98],{"path":47,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":50,"sourceHtmlUrl":51},"references\u002Fconcurrency.md","REFERENCE","参考文档",6003,"https:\u002F\u002Fgithub.com\u002FCharmedme\u002Fmaikelsoft-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fdev-stack\u002Fskills\u002Fpostgresql\u002Freferences\u002Fconcurrency.md",{"path":53,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":54,"sourceHtmlUrl":55},"references\u002Fddl-live-tables.md",5713,"https:\u002F\u002Fgithub.com\u002FCharmedme\u002Fmaikelsoft-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fdev-stack\u002Fskills\u002Fpostgresql\u002Freferences\u002Fddl-live-tables.md",{"path":57,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":58,"sourceHtmlUrl":59},"references\u002Fdecisions.md",8561,"https:\u002F\u002Fgithub.com\u002FCharmedme\u002Fmaikelsoft-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fdev-stack\u002Fskills\u002Fpostgresql\u002Freferences\u002Fdecisions.md",{"path":61,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":62,"sourceHtmlUrl":63},"references\u002Findexes.md",3942,"https:\u002F\u002Fgithub.com\u002FCharmedme\u002Fmaikelsoft-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fdev-stack\u002Fskills\u002Fpostgresql\u002Freferences\u002Findexes.md",{"path":65,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":66,"sourceHtmlUrl":67},"references\u002Flanguage.md",4840,"https:\u002F\u002Fgithub.com\u002FCharmedme\u002Fmaikelsoft-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fdev-stack\u002Fskills\u002Fpostgresql\u002Freferences\u002Flanguage.md",{"path":69,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":70,"sourceHtmlUrl":71},"references\u002Fnpgsql-dapper.md",5889,"https:\u002F\u002Fgithub.com\u002FCharmedme\u002Fmaikelsoft-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fdev-stack\u002Fskills\u002Fpostgresql\u002Freferences\u002Fnpgsql-dapper.md",{"path":73,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":74,"sourceHtmlUrl":75},"references\u002Freview-checklist.md",5612,"https:\u002F\u002Fgithub.com\u002FCharmedme\u002Fmaikelsoft-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fdev-stack\u002Fskills\u002Fpostgresql\u002Freferences\u002Freview-checklist.md",{"path":77,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":78,"sourceHtmlUrl":79},"references\u002Fsources.md",7738,"https:\u002F\u002Fgithub.com\u002FCharmedme\u002Fmaikelsoft-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fdev-stack\u002Fskills\u002Fpostgresql\u002Freferences\u002Fsources.md",{"path":81,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":82,"sourceHtmlUrl":83},"references\u002Fstack-rules.md",7772,"https:\u002F\u002Fgithub.com\u002FCharmedme\u002Fmaikelsoft-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fdev-stack\u002Fskills\u002Fpostgresql\u002Freferences\u002Fstack-rules.md",{"path":85,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":86,"sourceHtmlUrl":87},"rules.json",6701,"https:\u002F\u002Fgithub.com\u002FCharmedme\u002Fmaikelsoft-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fdev-stack\u002Fskills\u002Fpostgresql\u002Frules.json",{"path":89,"resourceType":90,"resourceTypeDesc":91,"sizeBytes":92,"sourceHtmlUrl":93},"scripts\u002Fconvert.py","SCRIPT","脚本",2928,"https:\u002F\u002Fgithub.com\u002FCharmedme\u002Fmaikelsoft-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fdev-stack\u002Fskills\u002Fpostgresql\u002Fscripts\u002Fconvert.py",{"path":95,"resourceType":90,"resourceTypeDesc":91,"sizeBytes":96,"sourceHtmlUrl":97},"scripts\u002Fdoccheck.py",29463,"https:\u002F\u002Fgithub.com\u002FCharmedme\u002Fmaikelsoft-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fdev-stack\u002Fskills\u002Fpostgresql\u002Fscripts\u002Fdoccheck.py",{"path":99,"resourceType":90,"resourceTypeDesc":91,"sizeBytes":100,"sourceHtmlUrl":101},"scripts\u002Fstackcheck.py",12200,"https:\u002F\u002Fgithub.com\u002FCharmedme\u002Fmaikelsoft-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fdev-stack\u002Fskills\u002Fpostgresql\u002Fscripts\u002Fstackcheck.py",[103,110,117,124,131,138],{"skillNo":104,"name":105,"nameZh":6,"description":106,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":107,"categories":108,"keywords":109,"publishedAt":18},"01M7EA9S53810TTZTXYDGBWXHY","web-accessibility","Web accessibility to WCAG 2.2 AA - a checklist for the design, the tool checks (axe-core, the Tab walk, reduced motion), and the manual checks that no tool does (screen reader, zoom, status messages) - with the EAA and EN 301 549 status. Use when a design, mockup, or built feature must be checked for accessibility, when a review must cover keyboard and screen reader use, when the user asks about focus, a focus trap, contrast, or a screen reader on a page, or when the user asks which accessibility rules apply.","https:\u002F\u002Fgithub.com\u002FCharmedme\u002Fmaikelsoft-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fux-design\u002Fskills\u002Fweb-accessibility\u002FSKILL.md",[],[],{"skillNo":111,"name":112,"nameZh":6,"description":113,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":114,"categories":115,"keywords":116,"publishedAt":18},"01M7EA9MGJ7ESKQ7WE2Z96858T","ux-states","State inventory for each screen - default, empty, loading, partial, error, success, disabled, overflow, offline, and the business states (no permission, stale data, locked by another user, waiting on an external system, bulk result with failures, read only) - with what the user sees, can do, and how the user recovers. Use when a screen or flow needs its states designed or checked, or when a design shows only the happy path.","https:\u002F\u002Fgithub.com\u002FCharmedme\u002Fmaikelsoft-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fux-design\u002Fskills\u002Fux-states\u002FSKILL.md",[],[],{"skillNo":118,"name":119,"nameZh":6,"description":120,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":121,"categories":122,"keywords":123,"publishedAt":18},"01M7EA9FHYR0C26BHNQF7AZT4Q","ux-setup","Set up a project for UX work - finds the design tools, the design-system source, the brand files, the languages, and the run command, asks the human one round of questions, and writes the \"## Design\" section of .claude\u002Frules\u002Fdelivery.md that the ux-design commands and the ux-designer agent read. Moves an older \"## Design\" section out of CLAUDE.md. Use when \u002Fsetup, \u002Fux-design, or \u002Fux-review needs the design facts, when the ux-designer agent returns NEEDS_HUMAN because the \"## Design\" section is missing, or when the user wants to set up or change the design tools of a project.","https:\u002F\u002Fgithub.com\u002FCharmedme\u002Fmaikelsoft-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fux-design\u002Fskills\u002Fux-setup\u002FSKILL.md",[],[],{"skillNo":125,"name":126,"nameZh":6,"description":127,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":128,"categories":129,"keywords":130,"publishedAt":18},"01M7EA99DQDFVJQBJNYDJQC643","ux-review","UX review of a built feature against its approved design - Playwright walks each flow and state at 390, 820, and 1440 px, axe-core and the tell checks run on each state, and each heuristic gets a verdict - with findings by owner, severity, and origin, and a verdict in ux-review.md in the work folder of the item. Use when a built feature or screen must be checked against its design, mockups, or prototype, in each state or at each screen size, when built screens need findings by severity, when the build of an item with a UX design is done, or when existing screens need a UX audit.","https:\u002F\u002Fgithub.com\u002FCharmedme\u002Fmaikelsoft-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fux-design\u002Fskills\u002Fux-review\u002FSKILL.md",[],[],{"skillNo":132,"name":133,"nameZh":6,"description":134,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":135,"categories":136,"keywords":137,"publishedAt":18},"01M7EA95YPJQQ1YDW5HS0RVAN2","ux-prototype","Clickable prototype of a designed story in the proto-shell standard, with variants for an A\u002FB test, all states in scope, three sizes, and a test plan with tasks. Use when a design or mockups exist and the team must test the flow or compare variants with users before the build.","https:\u002F\u002Fgithub.com\u002FCharmedme\u002Fmaikelsoft-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fux-design\u002Fskills\u002Fux-prototype\u002FSKILL.md",[],[],{"skillNo":139,"name":140,"nameZh":6,"description":141,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":142,"categories":143,"keywords":144,"publishedAt":18},"01M7EA91SKA2RNFGW9VDG9JFW7","ux-practice","The method of the ux-designer agent for the UX design of a story, a feature, or a screen - Double Diamond phases, a design spec with a source for each decision, the UX decision log, evidence tags, severity, and the modes light, full, and new-direction. Preloaded by the ux-designer agent. Use when the ux-designer agent or another UX skill names this method. For the design of an item, a person starts ux-design:ux-design.","https:\u002F\u002Fgithub.com\u002FCharmedme\u002Fmaikelsoft-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fux-design\u002Fskills\u002Fux-practice\u002FSKILL.md",[],[]]