@jgamaraalv/ts-dev-kit 4.0.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +11 -0
- package/package.json +1 -1
- package/skills/bullmq/SKILL.md +30 -10
- package/skills/codebase-adapter/SKILL.md +2 -2
- package/skills/composition-patterns/SKILL.md +12 -0
- package/skills/core-web-vitals/SKILL.md +47 -31
- package/skills/docker/SKILL.md +18 -6
- package/skills/drizzle-pg/SKILL.md +21 -9
- package/skills/fastify-best-practices/SKILL.md +16 -4
- package/skills/generate-prd/SKILL.md +2 -2
- package/skills/ioredis/SKILL.md +21 -9
- package/skills/nextjs-best-practices/SKILL.md +3 -21
- package/skills/owasp-security-review/SKILL.md +31 -13
- package/skills/postgresql/SKILL.md +22 -10
- package/skills/react-best-practices/SKILL.md +7 -12
- package/skills/service-worker/SKILL.md +50 -39
- package/skills/tanstack-query/SKILL.md +16 -0
- package/skills/typescript-conventions/SKILL.md +8 -0
- package/skills/ui-ux-guidelines/SKILL.md +24 -16
- package/skills/yolo/SKILL.md +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [5.0.0] - 2026-02-28
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- Standardize all 15 reference and workflow skills to use semantic XML tags (`<rules>`, `<quick_reference>`, `<examples>`, `<anti_patterns>`, `<gotchas>`, `<constraints>`, `<references>`, `<workflow>`, `<output>`) — previously only 7 workflow skills used XML tags while 15 reference skills used plain markdown headings
|
|
13
|
+
- Skills with multi-step workflows (`owasp-security-review`, `ui-ux-guidelines`) now use `<workflow>` with numbered `<phase_N_name>` tags matching the pattern established by `debug`, `execute-task`, and `generate-prd`
|
|
14
|
+
|
|
15
|
+
### BREAKING CHANGE
|
|
16
|
+
|
|
17
|
+
- All skill SKILL.md files now wrap content sections in XML tags. Custom forks or overrides that parse skill files by markdown heading structure may need updating to account for the new XML tag wrappers.
|
|
18
|
+
|
|
8
19
|
## [4.0.0] - 2026-02-27
|
|
9
20
|
|
|
10
21
|
### Added
|
package/package.json
CHANGED
package/skills/bullmq/SKILL.md
CHANGED
|
@@ -23,6 +23,8 @@ Redis-backed queue system for Node.js. Four core classes: `Queue`, `Worker`, `Qu
|
|
|
23
23
|
|
|
24
24
|
`yarn add bullmq` — requires Redis 5.0+ with `maxmemory-policy=noeviction`.
|
|
25
25
|
|
|
26
|
+
<quick_reference>
|
|
27
|
+
|
|
26
28
|
## Quick Start
|
|
27
29
|
|
|
28
30
|
```ts
|
|
@@ -73,6 +75,22 @@ queueEvents.on("failed", ({ jobId, failedReason }) => {
|
|
|
73
75
|
});
|
|
74
76
|
```
|
|
75
77
|
|
|
78
|
+
## Job Lifecycle States
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
add() → wait / prioritized / delayed
|
|
82
|
+
↓
|
|
83
|
+
active → completed
|
|
84
|
+
↓
|
|
85
|
+
failed → (retry) → wait/delayed
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
With FlowProducer: jobs can also be in `waiting-children` state until all children complete.
|
|
89
|
+
|
|
90
|
+
</quick_reference>
|
|
91
|
+
|
|
92
|
+
<rules>
|
|
93
|
+
|
|
76
94
|
## Connections
|
|
77
95
|
|
|
78
96
|
BullMQ uses ioredis internally. Pass `connection` options or an existing ioredis instance.
|
|
@@ -103,6 +121,10 @@ const w1 = new Worker("q1", async (job) => {}, { connection: workerConn });
|
|
|
103
121
|
- `QueueEvents` cannot share connections (uses blocking Redis commands).
|
|
104
122
|
- Redis MUST have `maxmemory-policy=noeviction`.
|
|
105
123
|
|
|
124
|
+
</rules>
|
|
125
|
+
|
|
126
|
+
<examples>
|
|
127
|
+
|
|
106
128
|
## Queue
|
|
107
129
|
|
|
108
130
|
```ts
|
|
@@ -179,6 +201,10 @@ const worker = new Worker<JobData, JobReturn>("paint", async (job) => {
|
|
|
179
201
|
});
|
|
180
202
|
```
|
|
181
203
|
|
|
204
|
+
</examples>
|
|
205
|
+
|
|
206
|
+
<events>
|
|
207
|
+
|
|
182
208
|
## Events
|
|
183
209
|
|
|
184
210
|
**Worker events** (local to that worker instance):
|
|
@@ -205,17 +231,9 @@ const worker = new Worker<JobData, JobReturn>("paint", async (job) => {
|
|
|
205
231
|
|
|
206
232
|
Event stream is auto-trimmed (~10,000 events). Configure via `streams.events.maxLen`.
|
|
207
233
|
|
|
208
|
-
|
|
234
|
+
</events>
|
|
209
235
|
|
|
210
|
-
|
|
211
|
-
add() → wait / prioritized / delayed
|
|
212
|
-
↓
|
|
213
|
-
active → completed
|
|
214
|
-
↓
|
|
215
|
-
failed → (retry) → wait/delayed
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
With FlowProducer: jobs can also be in `waiting-children` state until all children complete.
|
|
236
|
+
<references>
|
|
219
237
|
|
|
220
238
|
## Advanced Topics
|
|
221
239
|
|
|
@@ -223,3 +241,5 @@ With FlowProducer: jobs can also be in `waiting-children` state until all childr
|
|
|
223
241
|
- **Flows and schedulers** (FlowProducer, parent-child, job schedulers, cron): See [references/flows-and-schedulers.md](references/flows-and-schedulers.md)
|
|
224
242
|
- **Patterns** (step jobs, idempotent, throttle, manual rate-limit): See [references/patterns.md](references/patterns.md)
|
|
225
243
|
- **Production** (shutdown, Redis config, retries, backoff, monitoring): See [references/production.md](references/production.md)
|
|
244
|
+
|
|
245
|
+
</references>
|
|
@@ -6,9 +6,9 @@ argument-hint: "[optional: path to project root — defaults to current director
|
|
|
6
6
|
allowed-tools: Bash(ls *), Bash(cat *), Bash(node *), Bash(python3 *)
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
-
<
|
|
9
|
+
<role>
|
|
10
10
|
You are a plugin configuration specialist. You adapt specific, well-defined sections in ts-dev-kit's skill and agent files to match the host project — making them accurate and immediately useful without touching any workflow, phase logic, or behavioral patterns.
|
|
11
|
-
</
|
|
11
|
+
</role>
|
|
12
12
|
|
|
13
13
|
<context>
|
|
14
14
|
**User-provided path:** $ARGUMENTS
|
|
@@ -10,6 +10,8 @@ boolean prop proliferation by using compound components, lifting state, and
|
|
|
10
10
|
composing internals. These patterns make codebases easier for both humans and AI
|
|
11
11
|
agents to work with as they scale.
|
|
12
12
|
|
|
13
|
+
<constraints>
|
|
14
|
+
|
|
13
15
|
## When NOT to Use
|
|
14
16
|
|
|
15
17
|
Skip these patterns when: fewer than 3 props, simple variants, or single-use components.
|
|
@@ -24,6 +26,10 @@ Reference these guidelines when:
|
|
|
24
26
|
- Reviewing component architecture
|
|
25
27
|
- Working with compound components or context providers
|
|
26
28
|
|
|
29
|
+
</constraints>
|
|
30
|
+
|
|
31
|
+
<rules>
|
|
32
|
+
|
|
27
33
|
## Rule Categories by Priority
|
|
28
34
|
|
|
29
35
|
| Priority | Category | Impact | Prefix |
|
|
@@ -33,6 +39,10 @@ Reference these guidelines when:
|
|
|
33
39
|
| 3 | Implementation Patterns | MEDIUM | `patterns-` |
|
|
34
40
|
| 4 | React 19 APIs | MEDIUM | `react19-` |
|
|
35
41
|
|
|
42
|
+
</rules>
|
|
43
|
+
|
|
44
|
+
<references>
|
|
45
|
+
|
|
36
46
|
## Quick Reference
|
|
37
47
|
|
|
38
48
|
### 1. Component Architecture (HIGH)
|
|
@@ -56,3 +66,5 @@ Reference these guidelines when:
|
|
|
56
66
|
> **React 19+ only.** Skip this section if using React 18 or earlier.
|
|
57
67
|
|
|
58
68
|
- **No forwardRef** — Don't use `forwardRef`; pass `ref` as a regular prop. Use `use()` instead of `useContext()` — see [references/react19-no-forwardref.md](references/react19-no-forwardref.md)
|
|
69
|
+
|
|
70
|
+
</references>
|
|
@@ -9,6 +9,8 @@ allowed-tools: Bash(python3 *)
|
|
|
9
9
|
The three stable Core Web Vitals, each measured at the **75th percentile** of
|
|
10
10
|
real page loads (segmented by mobile and desktop):
|
|
11
11
|
|
|
12
|
+
<quick_reference>
|
|
13
|
+
|
|
12
14
|
| Metric | Measures | Good | Needs Improvement | Poor |
|
|
13
15
|
|--------|----------|------|-------------------|------|
|
|
14
16
|
| **LCP** — Largest Contentful Paint | Loading | ≤ 2.5 s | 2.5–4.0 s | > 4.0 s |
|
|
@@ -17,6 +19,36 @@ real page loads (segmented by mobile and desktop):
|
|
|
17
19
|
|
|
18
20
|
A page **passes** Core Web Vitals only if all three metrics meet "Good" at the 75th percentile.
|
|
19
21
|
|
|
22
|
+
## Supporting metrics (non-Core but diagnostic)
|
|
23
|
+
|
|
24
|
+
- **FCP** (First Contentful Paint) — diagnoses render-blocking resources upstream of LCP
|
|
25
|
+
- **TTFB** (Time to First Byte) — server response time; directly affects LCP
|
|
26
|
+
- **TBT** (Total Blocking Time) — lab proxy for INP; identifies long tasks
|
|
27
|
+
|
|
28
|
+
## Tools matrix
|
|
29
|
+
|
|
30
|
+
| Tool | Type | LCP | INP | CLS | Notes |
|
|
31
|
+
|------|------|-----|-----|-----|-------|
|
|
32
|
+
| Chrome User Experience Report (CrUX) | Field | ✓ | ✓ | ✓ | 28-day rolling window of real users |
|
|
33
|
+
| PageSpeed Insights | Field + Lab | ✓ | ✓ | ✓ | Field = CrUX data; Lab = Lighthouse |
|
|
34
|
+
| Search Console CWV report | Field | ✓ | ✓ | ✓ | Groups URLs by template |
|
|
35
|
+
| Chrome DevTools Performance panel | Field + Lab | ✓ | ✓ | ✓ | Local profiling, interaction tracing |
|
|
36
|
+
| Lighthouse | Lab | ✓ | TBT* | ✓ | CI integration; INP → use TBT as proxy |
|
|
37
|
+
|
|
38
|
+
*Lighthouse uses **Total Blocking Time (TBT)** as a lab proxy for INP. TBT
|
|
39
|
+
correlates with INP but does not replace field measurement.
|
|
40
|
+
|
|
41
|
+
## Metric lifecycle
|
|
42
|
+
|
|
43
|
+
Metrics progress through: **Experimental → Pending → Stable**.
|
|
44
|
+
All three current Core Web Vitals (LCP, CLS, INP) are **Stable**.
|
|
45
|
+
INP replaced FID (First Input Delay) in March 2024.
|
|
46
|
+
Changes to stable metrics follow an annual cadence with advance notice.
|
|
47
|
+
|
|
48
|
+
</quick_reference>
|
|
49
|
+
|
|
50
|
+
<examples>
|
|
51
|
+
|
|
20
52
|
## Quick setup: measure all three in the field
|
|
21
53
|
|
|
22
54
|
```bash
|
|
@@ -43,33 +75,9 @@ Each callback receives `{ name, value, rating, delta, id, navigationType }`.
|
|
|
43
75
|
> The `web-vitals` library handles bfcache restores, prerendered pages, iframe
|
|
44
76
|
> aggregation, and other edge cases that raw PerformanceObserver does not.
|
|
45
77
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
| Tool | Type | LCP | INP | CLS | Notes |
|
|
49
|
-
|------|------|-----|-----|-----|-------|
|
|
50
|
-
| Chrome User Experience Report (CrUX) | Field | ✓ | ✓ | ✓ | 28-day rolling window of real users |
|
|
51
|
-
| PageSpeed Insights | Field + Lab | ✓ | ✓ | ✓ | Field = CrUX data; Lab = Lighthouse |
|
|
52
|
-
| Search Console CWV report | Field | ✓ | ✓ | ✓ | Groups URLs by template |
|
|
53
|
-
| Chrome DevTools Performance panel | Field + Lab | ✓ | ✓ | ✓ | Local profiling, interaction tracing |
|
|
54
|
-
| Lighthouse | Lab | ✓ | TBT* | ✓ | CI integration; INP → use TBT as proxy |
|
|
55
|
-
|
|
56
|
-
*Lighthouse uses **Total Blocking Time (TBT)** as a lab proxy for INP. TBT
|
|
57
|
-
correlates with INP but does not replace field measurement.
|
|
58
|
-
|
|
59
|
-
## Supporting metrics (non-Core but diagnostic)
|
|
60
|
-
|
|
61
|
-
- **FCP** (First Contentful Paint) — diagnoses render-blocking resources upstream of LCP
|
|
62
|
-
- **TTFB** (Time to First Byte) — server response time; directly affects LCP
|
|
63
|
-
- **TBT** (Total Blocking Time) — lab proxy for INP; identifies long tasks
|
|
78
|
+
</examples>
|
|
64
79
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
| Reference | Read when… |
|
|
68
|
-
|-----------|-----------|
|
|
69
|
-
| [references/lcp.md](references/lcp.md) | LCP > 2.5 s, diagnosing slow image/text load, preload/CDN questions |
|
|
70
|
-
| [references/inp.md](references/inp.md) | INP > 200 ms, slow click/key/tap response, long task investigations |
|
|
71
|
-
| [references/cls.md](references/cls.md) | CLS > 0.1, elements jumping on scroll or load, font/image shift |
|
|
72
|
-
| [references/tools.md](references/tools.md) | Setting up monitoring, using DevTools/Lighthouse/PSI, top-9 optimization checklist |
|
|
80
|
+
<visual_report>
|
|
73
81
|
|
|
74
82
|
## Generate a visual report
|
|
75
83
|
|
|
@@ -101,9 +109,17 @@ python3 SCRIPT_PATH/visualize.py \
|
|
|
101
109
|
The script (`scripts/visualize.py`) requires only Python 3 stdlib — no packages to install.
|
|
102
110
|
It outputs a self-contained HTML file with color-coded metric cards, a visual progress bar showing where each value falls on the Good/Needs Improvement/Poor scale, and an overall PASS/FAIL/NEEDS IMPROVEMENT verdict.
|
|
103
111
|
|
|
104
|
-
|
|
112
|
+
</visual_report>
|
|
105
113
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
114
|
+
<references>
|
|
115
|
+
|
|
116
|
+
## When to read reference files
|
|
117
|
+
|
|
118
|
+
| Reference | Read when… |
|
|
119
|
+
|-----------|-----------|
|
|
120
|
+
| [references/lcp.md](references/lcp.md) | LCP > 2.5 s, diagnosing slow image/text load, preload/CDN questions |
|
|
121
|
+
| [references/inp.md](references/inp.md) | INP > 200 ms, slow click/key/tap response, long task investigations |
|
|
122
|
+
| [references/cls.md](references/cls.md) | CLS > 0.1, elements jumping on scroll or load, font/image shift |
|
|
123
|
+
| [references/tools.md](references/tools.md) | Setting up monitoring, using DevTools/Lighthouse/PSI, top-9 optimization checklist |
|
|
124
|
+
|
|
125
|
+
</references>
|
package/skills/docker/SKILL.md
CHANGED
|
@@ -8,12 +8,7 @@ description: "Docker containerization reference — multi-stage builds, Compose
|
|
|
8
8
|
|
|
9
9
|
Docker best practices for Node.js monorepos with Yarn 4 Berry.
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
| Need | Reference file |
|
|
14
|
-
| -------------------------------------------------- | ---------------------------------------------------------------------- |
|
|
15
|
-
| Writing or reviewing a Dockerfile for the monorepo | [references/monorepo-dockerfile.md](references/monorepo-dockerfile.md) |
|
|
16
|
-
| Configuring docker-compose for dev or production | [references/compose-configs.md](references/compose-configs.md) |
|
|
11
|
+
<rules>
|
|
17
12
|
|
|
18
13
|
## Key Principles
|
|
19
14
|
|
|
@@ -41,6 +36,10 @@ Docker best practices for Node.js monorepos with Yarn 4 Berry.
|
|
|
41
36
|
- Read-only filesystem where possible: `read_only: true`
|
|
42
37
|
- Drop capabilities: `cap_drop: [ALL]`
|
|
43
38
|
|
|
39
|
+
</rules>
|
|
40
|
+
|
|
41
|
+
<quick_reference>
|
|
42
|
+
|
|
44
43
|
## Useful Commands
|
|
45
44
|
|
|
46
45
|
```bash
|
|
@@ -53,3 +52,16 @@ docker system df # View cache usage
|
|
|
53
52
|
docker system prune -a # Prune unused images
|
|
54
53
|
docker stats # Resource usage
|
|
55
54
|
```
|
|
55
|
+
|
|
56
|
+
</quick_reference>
|
|
57
|
+
|
|
58
|
+
<references>
|
|
59
|
+
|
|
60
|
+
## When to Load References
|
|
61
|
+
|
|
62
|
+
| Need | Reference file |
|
|
63
|
+
| -------------------------------------------------- | ---------------------------------------------------------------------- |
|
|
64
|
+
| Writing or reviewing a Dockerfile for the monorepo | [references/monorepo-dockerfile.md](references/monorepo-dockerfile.md) |
|
|
65
|
+
| Configuring docker-compose for dev or production | [references/compose-configs.md](references/compose-configs.md) |
|
|
66
|
+
|
|
67
|
+
</references>
|
|
@@ -15,6 +15,8 @@ Packages: `drizzle-orm` (runtime), `drizzle-kit` (CLI/migrations).
|
|
|
15
15
|
- [Common Patterns](#common-patterns)
|
|
16
16
|
- [Reference Files](#reference-files)
|
|
17
17
|
|
|
18
|
+
<examples>
|
|
19
|
+
|
|
18
20
|
## Quick Start
|
|
19
21
|
|
|
20
22
|
### Connect
|
|
@@ -151,15 +153,6 @@ npx drizzle-kit pull # introspect DB -> Drizzle schema
|
|
|
151
153
|
npx drizzle-kit studio # visual browser UI
|
|
152
154
|
```
|
|
153
155
|
|
|
154
|
-
## Import Cheat Sheet
|
|
155
|
-
|
|
156
|
-
| Import path | Key exports |
|
|
157
|
-
| --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
158
|
-
| `drizzle-orm/pg-core` | `pgTable`, `pgEnum`, column types (`serial`, `text`, `integer`, `uuid`, `timestamp`, `jsonb`, `varchar`, `boolean`, `numeric`, `bigint`, `geometry`, `vector`, ...), `index`, `uniqueIndex`, `unique`, `check`, `primaryKey`, `foreignKey` |
|
|
159
|
-
| `drizzle-orm` | Operators: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`, `and`, `or`, `not`, `isNull`, `isNotNull`, `inArray`, `between`, `like`, `ilike`, `exists`, `sql`, `asc`, `desc`. Utilities: `getColumns`, `defineRelations`, `cosineDistance`, `l2Distance` |
|
|
160
|
-
| `drizzle-orm` (types) | `InferSelectModel`, `InferInsertModel` |
|
|
161
|
-
| `drizzle-zod` | `createInsertSchema`, `createSelectSchema` |
|
|
162
|
-
|
|
163
156
|
## Common Patterns
|
|
164
157
|
|
|
165
158
|
### Conditional filters
|
|
@@ -190,6 +183,23 @@ type User = typeof users.$inferSelect;
|
|
|
190
183
|
type NewUser = typeof users.$inferInsert;
|
|
191
184
|
```
|
|
192
185
|
|
|
186
|
+
</examples>
|
|
187
|
+
|
|
188
|
+
<quick_reference>
|
|
189
|
+
|
|
190
|
+
## Import Cheat Sheet
|
|
191
|
+
|
|
192
|
+
| Import path | Key exports |
|
|
193
|
+
| --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
194
|
+
| `drizzle-orm/pg-core` | `pgTable`, `pgEnum`, column types (`serial`, `text`, `integer`, `uuid`, `timestamp`, `jsonb`, `varchar`, `boolean`, `numeric`, `bigint`, `geometry`, `vector`, ...), `index`, `uniqueIndex`, `unique`, `check`, `primaryKey`, `foreignKey` |
|
|
195
|
+
| `drizzle-orm` | Operators: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`, `and`, `or`, `not`, `isNull`, `isNotNull`, `inArray`, `between`, `like`, `ilike`, `exists`, `sql`, `asc`, `desc`. Utilities: `getColumns`, `defineRelations`, `cosineDistance`, `l2Distance` |
|
|
196
|
+
| `drizzle-orm` (types) | `InferSelectModel`, `InferInsertModel` |
|
|
197
|
+
| `drizzle-zod` | `createInsertSchema`, `createSelectSchema` |
|
|
198
|
+
|
|
199
|
+
</quick_reference>
|
|
200
|
+
|
|
201
|
+
<references>
|
|
202
|
+
|
|
193
203
|
## Reference Files
|
|
194
204
|
|
|
195
205
|
For detailed API coverage, see:
|
|
@@ -200,3 +210,5 @@ For detailed API coverage, see:
|
|
|
200
210
|
- **sql`` template: raw, empty, join, identifier, placeholders**: [references/sql-operator.md](references/sql-operator.md)
|
|
201
211
|
- **drizzle-kit commands, drizzle.config.ts, migration workflows**: [references/migrations.md](references/migrations.md)
|
|
202
212
|
- **Dynamic queries, transactions, custom types, Zod, utilities**: [references/advanced.md](references/advanced.md)
|
|
213
|
+
|
|
214
|
+
</references>
|
|
@@ -10,12 +10,10 @@ description: "Fastify 5 best practices, API reference, and patterns for routes,
|
|
|
10
10
|
- [Request lifecycle](#request-lifecycle-exact-order)
|
|
11
11
|
- [Top anti-patterns](#top-anti-patterns)
|
|
12
12
|
- [Quick patterns](#quick-patterns)
|
|
13
|
-
- [Plugin with fastify-plugin (FastifyPluginCallback)](#plugin-with-fastify-plugin-fastifyplugincallback)
|
|
14
|
-
- [Route with validation](#route-with-validation)
|
|
15
|
-
- [Hook (application-level)](#hook-application-level)
|
|
16
|
-
- [Error handler](#error-handler)
|
|
17
13
|
- [Reference files](#reference-files)
|
|
18
14
|
|
|
15
|
+
<quick_reference>
|
|
16
|
+
|
|
19
17
|
## Request lifecycle (exact order)
|
|
20
18
|
|
|
21
19
|
```
|
|
@@ -36,6 +34,10 @@ Incoming Request
|
|
|
36
34
|
|
|
37
35
|
Error at any stage → `onError` hooks → error handler → `onSend` → response → `onResponse`.
|
|
38
36
|
|
|
37
|
+
</quick_reference>
|
|
38
|
+
|
|
39
|
+
<anti_patterns>
|
|
40
|
+
|
|
39
41
|
## Top anti-patterns
|
|
40
42
|
|
|
41
43
|
1. **Mixing async/callback in handlers** — Use `async` OR callbacks, never both. With async, `return` the value; don't call `reply.send()` AND return.
|
|
@@ -58,6 +60,10 @@ Error at any stage → `onError` hooks → error handler → `onSend` → respon
|
|
|
58
60
|
|
|
59
61
|
10. **Missing response schema** — Without `response` schema, Fastify serializes with `JSON.stringify()` (slow) and may leak sensitive fields. Use `fast-json-stringify` via response schemas.
|
|
60
62
|
|
|
63
|
+
</anti_patterns>
|
|
64
|
+
|
|
65
|
+
<examples>
|
|
66
|
+
|
|
61
67
|
## Quick patterns
|
|
62
68
|
|
|
63
69
|
### Plugin with fastify-plugin (FastifyPluginCallback)
|
|
@@ -130,6 +136,10 @@ fastify.setErrorHandler((error, request, reply) => {
|
|
|
130
136
|
});
|
|
131
137
|
```
|
|
132
138
|
|
|
139
|
+
</examples>
|
|
140
|
+
|
|
141
|
+
<references>
|
|
142
|
+
|
|
133
143
|
## Reference files
|
|
134
144
|
|
|
135
145
|
Load the relevant file when you need detailed API information:
|
|
@@ -141,3 +151,5 @@ Load the relevant file when you need detailed API information:
|
|
|
141
151
|
- **Validation & serialization** — JSON Schema, Ajv, response schemas, custom validators: [references/validation-and-serialization.md](references/validation-and-serialization.md)
|
|
142
152
|
- **Request, Reply & errors** — request/reply API, error handling, FST_ERR codes: [references/request-reply-errors.md](references/request-reply-errors.md)
|
|
143
153
|
- **TypeScript & logging** — route generics, type providers, Pino config, decorators: [references/typescript-and-logging.md](references/typescript-and-logging.md)
|
|
154
|
+
|
|
155
|
+
</references>
|
|
@@ -4,9 +4,9 @@ description: "Generates a complete, structured, and implementation-ready Product
|
|
|
4
4
|
argument-hint: "[product-idea | feature-description | business-context | prd-md-file-path]"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
<
|
|
7
|
+
<role>
|
|
8
8
|
You are a Senior Product Manager and Product Strategist. Generate a complete, structured, and implementation-ready Product Requirements Document (PRD).
|
|
9
|
-
</
|
|
9
|
+
</role>
|
|
10
10
|
|
|
11
11
|
<spec>
|
|
12
12
|
$ARGUMENTS
|
package/skills/ioredis/SKILL.md
CHANGED
|
@@ -7,6 +7,8 @@ description: "ioredis v5 reference for Node.js Redis client — connection setup
|
|
|
7
7
|
|
|
8
8
|
ioredis v5.x. Requires Node.js >= 12, Redis >= 2.6.12. 100% TypeScript.
|
|
9
9
|
|
|
10
|
+
<quick_reference>
|
|
11
|
+
|
|
10
12
|
## Critical: Import Style
|
|
11
13
|
|
|
12
14
|
```ts
|
|
@@ -17,15 +19,6 @@ import { Redis } from "ioredis";
|
|
|
17
19
|
import { Redis, Cluster } from "ioredis";
|
|
18
20
|
```
|
|
19
21
|
|
|
20
|
-
## When to Load References
|
|
21
|
-
|
|
22
|
-
| Need | Reference file |
|
|
23
|
-
| ------------------------------------------------------------------------------ | -------------------------------------------------------------------- |
|
|
24
|
-
| Connection setup, RedisOptions, TLS, retryStrategy, lifecycle | [references/connection-options.md](references/connection-options.md) |
|
|
25
|
-
| Core API: pipelines, transactions, Pub/Sub, Lua scripting, scanning, events | [references/core-api.md](references/core-api.md) |
|
|
26
|
-
| Streams, auto-pipelining, transformers, binary data, error handling, debugging | [references/advanced-patterns.md](references/advanced-patterns.md) |
|
|
27
|
-
| Redis Cluster setup, ClusterOptions, Sentinel config, failover | [references/cluster-sentinel.md](references/cluster-sentinel.md) |
|
|
28
|
-
|
|
29
22
|
## Quick Reference
|
|
30
23
|
|
|
31
24
|
| Operation | Code |
|
|
@@ -40,6 +33,10 @@ import { Redis, Cluster } from "ioredis";
|
|
|
40
33
|
| Graceful close | `await redis.quit()` |
|
|
41
34
|
| Force close | `redis.disconnect()` |
|
|
42
35
|
|
|
36
|
+
</quick_reference>
|
|
37
|
+
|
|
38
|
+
<gotchas>
|
|
39
|
+
|
|
43
40
|
## Common Gotchas
|
|
44
41
|
|
|
45
42
|
1. **Named import**: Always `import { Redis } from "ioredis"` with NodeNext resolution
|
|
@@ -49,3 +46,18 @@ import { Redis, Cluster } from "ioredis";
|
|
|
49
46
|
5. **`showFriendlyErrorStack`**: Performance cost — never enable in production
|
|
50
47
|
6. **Cluster pipelines**: All keys in a pipeline must hash to slots served by the same node
|
|
51
48
|
7. **`enableAutoPipelining`**: 35-50% throughput improvement, safe to enable globally
|
|
49
|
+
|
|
50
|
+
</gotchas>
|
|
51
|
+
|
|
52
|
+
<references>
|
|
53
|
+
|
|
54
|
+
## When to Load References
|
|
55
|
+
|
|
56
|
+
| Need | Reference file |
|
|
57
|
+
| ------------------------------------------------------------------------------ | -------------------------------------------------------------------- |
|
|
58
|
+
| Connection setup, RedisOptions, TLS, retryStrategy, lifecycle | [references/connection-options.md](references/connection-options.md) |
|
|
59
|
+
| Core API: pipelines, transactions, Pub/Sub, Lua scripting, scanning, events | [references/core-api.md](references/core-api.md) |
|
|
60
|
+
| Streams, auto-pipelining, transformers, binary data, error handling, debugging | [references/advanced-patterns.md](references/advanced-patterns.md) |
|
|
61
|
+
| Redis Cluster setup, ClusterOptions, Sentinel config, failover | [references/cluster-sentinel.md](references/cluster-sentinel.md) |
|
|
62
|
+
|
|
63
|
+
</references>
|
|
@@ -9,27 +9,7 @@ Apply these rules when writing or reviewing Next.js code.
|
|
|
9
9
|
|
|
10
10
|
> **Note:** Next.js 16 renamed `middleware.ts` to `proxy.ts`. Verify `proxy.ts` support in your version; `middleware.ts` remains the stable API.
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
- [File Conventions](#file-conventions)
|
|
15
|
-
- [RSC Boundaries](#rsc-boundaries)
|
|
16
|
-
- [Async Patterns](#async-patterns)
|
|
17
|
-
- [Runtime Selection](#runtime-selection)
|
|
18
|
-
- [Directives](#directives)
|
|
19
|
-
- [Functions](#functions)
|
|
20
|
-
- [Error Handling](#error-handling)
|
|
21
|
-
- [Data Patterns](#data-patterns)
|
|
22
|
-
- [Route Handlers](#route-handlers)
|
|
23
|
-
- [Metadata & OG Images](#metadata--og-images)
|
|
24
|
-
- [Image Optimization](#image-optimization)
|
|
25
|
-
- [Font Optimization](#font-optimization)
|
|
26
|
-
- [Bundling](#bundling)
|
|
27
|
-
- [Scripts](#scripts)
|
|
28
|
-
- [Hydration Errors](#hydration-errors)
|
|
29
|
-
- [Suspense Boundaries](#suspense-boundaries)
|
|
30
|
-
- [Parallel & Intercepting Routes](#parallel--intercepting-routes)
|
|
31
|
-
- [Self-Hosting](#self-hosting)
|
|
32
|
-
- [Debug Tricks](#debug-tricks)
|
|
12
|
+
<references>
|
|
33
13
|
|
|
34
14
|
## File Conventions
|
|
35
15
|
|
|
@@ -192,3 +172,5 @@ See [debug-tricks.md](references/debug-tricks.md) for:
|
|
|
192
172
|
|
|
193
173
|
- MCP endpoint for AI-assisted debugging
|
|
194
174
|
- Rebuild specific routes with `--debug-build-paths`
|
|
175
|
+
|
|
176
|
+
</references>
|
|
@@ -5,6 +5,8 @@ description: "Review code and architectures against the OWASP Top 10:2025 — th
|
|
|
5
5
|
|
|
6
6
|
# OWASP Top 10:2025 Security Review
|
|
7
7
|
|
|
8
|
+
<quick_reference>
|
|
9
|
+
|
|
8
10
|
## Quick reference
|
|
9
11
|
|
|
10
12
|
| # | Category | Key risk | Avg incidence |
|
|
@@ -20,9 +22,23 @@ description: "Review code and architectures against the OWASP Top 10:2025 — th
|
|
|
20
22
|
| A09 | Security Logging & Alerting Failures | Missing audit logs, no alerting, log injection, sensitive data in logs | 3.91% |
|
|
21
23
|
| A10 | Mishandling of Exceptional Conditions | Failing open, info leakage via errors, unchecked return values | 2.95% |
|
|
22
24
|
|
|
25
|
+
## Severity classification
|
|
26
|
+
|
|
27
|
+
Use these severity levels when reporting findings:
|
|
28
|
+
|
|
29
|
+
- **Critical**: Directly exploitable, leads to full system compromise or mass data breach (e.g., SQLi with no parameterization, hardcoded admin credentials, missing auth on admin endpoints).
|
|
30
|
+
- **High**: Exploitable with moderate effort, significant data exposure or privilege escalation (e.g., IDOR, weak password hashing, SSRF, deserialization of untrusted data).
|
|
31
|
+
- **Medium**: Exploitable under specific conditions, limited impact (e.g., missing CSRF protection, verbose error messages, missing security headers).
|
|
32
|
+
- **Low**: Defense-in-depth issue, minimal direct impact (e.g., missing rate limiting, incomplete logging, suboptimal crypto configuration).
|
|
33
|
+
|
|
34
|
+
</quick_reference>
|
|
35
|
+
|
|
36
|
+
<workflow>
|
|
37
|
+
|
|
23
38
|
## Workflows
|
|
24
39
|
|
|
25
|
-
|
|
40
|
+
<phase_1_code_review>
|
|
41
|
+
### Code review for security
|
|
26
42
|
|
|
27
43
|
Systematically check the code against each relevant category:
|
|
28
44
|
|
|
@@ -41,8 +57,10 @@ Priority order for review (highest impact first):
|
|
|
41
57
|
- `[MEDIUM]` Error handling → A10 (Exceptional Conditions), A09 (Logging)
|
|
42
58
|
- `[MEDIUM]` Architecture/design → A06 (Insecure Design)
|
|
43
59
|
- `[MEDIUM]` Data integrity → A08 (Integrity Failures)
|
|
60
|
+
</phase_1_code_review>
|
|
44
61
|
|
|
45
|
-
|
|
62
|
+
<phase_2_audit_checklist>
|
|
63
|
+
### Security audit checklist
|
|
46
64
|
|
|
47
65
|
Generate a checklist for a feature or codebase:
|
|
48
66
|
|
|
@@ -50,8 +68,10 @@ Generate a checklist for a feature or codebase:
|
|
|
50
68
|
2. For each of the 10 categories, determine if it applies.
|
|
51
69
|
3. For applicable categories, load the reference file and produce a checklist of items to verify.
|
|
52
70
|
4. Output a markdown checklist grouped by category.
|
|
71
|
+
</phase_2_audit_checklist>
|
|
53
72
|
|
|
54
|
-
|
|
73
|
+
<phase_3_remediation>
|
|
74
|
+
### Remediation guidance
|
|
55
75
|
|
|
56
76
|
When a vulnerability is identified:
|
|
57
77
|
|
|
@@ -59,6 +79,11 @@ When a vulnerability is identified:
|
|
|
59
79
|
2. Load the corresponding reference file.
|
|
60
80
|
3. Apply the prevention checklist to produce a specific, actionable fix.
|
|
61
81
|
4. Provide a code example of the fix when possible.
|
|
82
|
+
</phase_3_remediation>
|
|
83
|
+
|
|
84
|
+
</workflow>
|
|
85
|
+
|
|
86
|
+
<references>
|
|
62
87
|
|
|
63
88
|
## Reference files
|
|
64
89
|
|
|
@@ -75,15 +100,8 @@ Load the relevant file when you need detailed guidance for a specific category:
|
|
|
75
100
|
- **A09 Logging & Alerting** — audit trails, log injection, alerting, sensitive data in logs: [references/a09-logging-alerting-failures.md](references/a09-logging-alerting-failures.md)
|
|
76
101
|
- **A10 Exceptional Conditions** — error handling, fail-closed, resource cleanup, info leakage: [references/a10-exceptional-conditions.md](references/a10-exceptional-conditions.md)
|
|
77
102
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
Use these severity levels when reporting findings:
|
|
81
|
-
|
|
82
|
-
- **Critical**: Directly exploitable, leads to full system compromise or mass data breach (e.g., SQLi with no parameterization, hardcoded admin credentials, missing auth on admin endpoints).
|
|
83
|
-
- **High**: Exploitable with moderate effort, significant data exposure or privilege escalation (e.g., IDOR, weak password hashing, SSRF, deserialization of untrusted data).
|
|
84
|
-
- **Medium**: Exploitable under specific conditions, limited impact (e.g., missing CSRF protection, verbose error messages, missing security headers).
|
|
85
|
-
- **Low**: Defense-in-depth issue, minimal direct impact (e.g., missing rate limiting, incomplete logging, suboptimal crypto configuration).
|
|
86
|
-
|
|
87
|
-
## Output format
|
|
103
|
+
</references>
|
|
88
104
|
|
|
105
|
+
<output>
|
|
89
106
|
When reporting security findings, use the template in [template.md](template.md) for each finding.
|
|
107
|
+
</output>
|
|
@@ -7,6 +7,8 @@ description: "PostgreSQL 16+ reference for writing queries, designing schemas, m
|
|
|
7
7
|
|
|
8
8
|
Version: **16+**. All syntax is standard; most features apply to PostgreSQL 13+.
|
|
9
9
|
|
|
10
|
+
<quick_reference>
|
|
11
|
+
|
|
10
12
|
## Quick patterns
|
|
11
13
|
|
|
12
14
|
```sql
|
|
@@ -24,6 +26,25 @@ WHERE relkind = 'r' ORDER BY pg_total_relation_size(oid) DESC;
|
|
|
24
26
|
SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE pid = <pid>;
|
|
25
27
|
```
|
|
26
28
|
|
|
29
|
+
</quick_reference>
|
|
30
|
+
|
|
31
|
+
<rules>
|
|
32
|
+
|
|
33
|
+
## Key non-obvious facts
|
|
34
|
+
|
|
35
|
+
- Every statement runs in a transaction. Without `BEGIN`, each statement auto-commits.
|
|
36
|
+
- `jsonb` stores parsed binary (faster queries); `json` stores raw text (exact input preserved). Prefer `jsonb`.
|
|
37
|
+
- `LIKE 'foo%'` can use B-tree; `LIKE '%foo'` cannot — use `pg_trgm` GIN for suffix search.
|
|
38
|
+
- `CREATE INDEX CONCURRENTLY` avoids table lock but cannot run inside a transaction block.
|
|
39
|
+
- `EXPLAIN` without `ANALYZE` shows the planner's _estimate_. Always use `EXPLAIN (ANALYZE, BUFFERS)` for real data.
|
|
40
|
+
- Null values are stored in indexes by B-tree (unlike some other databases). `IS NULL` can use an index.
|
|
41
|
+
- `SERIAL`/`BIGSERIAL` are shorthand for sequence + default; prefer `GENERATED ALWAYS AS IDENTITY` (SQL standard).
|
|
42
|
+
- Default isolation level is **Read Committed**. `SERIALIZABLE` prevents all anomalies but may abort transactions.
|
|
43
|
+
|
|
44
|
+
</rules>
|
|
45
|
+
|
|
46
|
+
<references>
|
|
47
|
+
|
|
27
48
|
## Reference files
|
|
28
49
|
|
|
29
50
|
Load the relevant file when working on a specific topic:
|
|
@@ -38,13 +59,4 @@ Load the relevant file when working on a specific topic:
|
|
|
38
59
|
| EXPLAIN output, VACUUM, stats | [references/performance.md](references/performance.md) | Query tuning or performance analysis |
|
|
39
60
|
| psql meta-commands | [references/psql-cli.md](references/psql-cli.md) | Working interactively in psql |
|
|
40
61
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
- Every statement runs in a transaction. Without `BEGIN`, each statement auto-commits.
|
|
44
|
-
- `jsonb` stores parsed binary (faster queries); `json` stores raw text (exact input preserved). Prefer `jsonb`.
|
|
45
|
-
- `LIKE 'foo%'` can use B-tree; `LIKE '%foo'` cannot — use `pg_trgm` GIN for suffix search.
|
|
46
|
-
- `CREATE INDEX CONCURRENTLY` avoids table lock but cannot run inside a transaction block.
|
|
47
|
-
- `EXPLAIN` without `ANALYZE` shows the planner's _estimate_. Always use `EXPLAIN (ANALYZE, BUFFERS)` for real data.
|
|
48
|
-
- Null values are stored in indexes by B-tree (unlike some other databases). `IS NULL` can use an index.
|
|
49
|
-
- `SERIAL`/`BIGSERIAL` are shorthand for sequence + default; prefer `GENERATED ALWAYS AS IDENTITY` (SQL standard).
|
|
50
|
-
- Default isolation level is **Read Committed**. `SERIALIZABLE` prevents all anomalies but may abort transactions.
|
|
62
|
+
</references>
|
|
@@ -7,18 +7,7 @@ description: "React and Next.js performance patterns. Use when writing, reviewin
|
|
|
7
7
|
|
|
8
8
|
Performance optimization guide for React and Next.js applications, based on Vercel Engineering practices. 8 categories organized by impact.
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
- [When to Apply](#when-to-apply)
|
|
13
|
-
- [Quick Reference](#quick-reference)
|
|
14
|
-
- [Async Patterns (CRITICAL)](#1-async-patterns-critical)
|
|
15
|
-
- [Bundle Optimization (CRITICAL)](#2-bundle-optimization-critical)
|
|
16
|
-
- [Server-Side Performance (HIGH)](#3-server-side-performance-high)
|
|
17
|
-
- [Client-Side Patterns (MEDIUM-HIGH)](#4-client-side-patterns-medium-high)
|
|
18
|
-
- [Re-render Optimization (MEDIUM)](#5-re-render-optimization-medium)
|
|
19
|
-
- [Rendering Performance (MEDIUM)](#6-rendering-performance-medium)
|
|
20
|
-
- [JavaScript Performance (LOW-MEDIUM)](#7-javascript-performance-low-medium)
|
|
21
|
-
- [Advanced Patterns (LOW)](#8-advanced-patterns-low)
|
|
10
|
+
<constraints>
|
|
22
11
|
|
|
23
12
|
## When to Apply
|
|
24
13
|
|
|
@@ -27,6 +16,10 @@ Performance optimization guide for React and Next.js applications, based on Verc
|
|
|
27
16
|
- Reviewing code for performance issues
|
|
28
17
|
- Optimizing bundle size or load times
|
|
29
18
|
|
|
19
|
+
</constraints>
|
|
20
|
+
|
|
21
|
+
<references>
|
|
22
|
+
|
|
30
23
|
## Quick Reference
|
|
31
24
|
|
|
32
25
|
### 1. Async Patterns (CRITICAL)
|
|
@@ -108,3 +101,5 @@ Performance optimization guide for React and Next.js applications, based on Verc
|
|
|
108
101
|
|
|
109
102
|
- Store event handlers in refs -- stable effect subscriptions
|
|
110
103
|
- Initialize app once per load -- module-level guard
|
|
104
|
+
|
|
105
|
+
</references>
|
|
@@ -10,17 +10,12 @@ description: "Service Worker API implementation guide — registration, lifecycl
|
|
|
10
10
|
- [Constraints](#constraints)
|
|
11
11
|
- [Lifecycle](#lifecycle)
|
|
12
12
|
- [Registration](#registration)
|
|
13
|
-
- [Install
|
|
14
|
-
- [Activate Event — Clean Up Old Caches](#activate-event--clean-up-old-caches)
|
|
15
|
-
- [Fetch Event — Intercept Requests](#fetch-event--intercept-requests)
|
|
16
|
-
- [Navigation Preload](#navigation-preload)
|
|
17
|
-
- [Updating a Service Worker](#updating-a-service-worker)
|
|
18
|
-
- [Communicating with Pages](#communicating-with-pages)
|
|
13
|
+
- [Install / Activate / Fetch Events](#install-event--pre-cache-assets)
|
|
19
14
|
- [Common Pitfalls](#common-pitfalls)
|
|
20
|
-
- [Push Notifications & Background Sync](#push-notifications--background-sync)
|
|
21
|
-
- [API Quick Reference](#api-quick-reference)
|
|
22
15
|
- [Next.js Integration](#nextjs-integration)
|
|
23
|
-
- [
|
|
16
|
+
- [Reference files](#reference-files)
|
|
17
|
+
|
|
18
|
+
<constraints>
|
|
24
19
|
|
|
25
20
|
## Constraints
|
|
26
21
|
|
|
@@ -31,6 +26,10 @@ description: "Service Worker API implementation guide — registration, lifecycl
|
|
|
31
26
|
- Scope defaults to the directory containing the SW file
|
|
32
27
|
- `self` refers to `ServiceWorkerGlobalScope`
|
|
33
28
|
|
|
29
|
+
</constraints>
|
|
30
|
+
|
|
31
|
+
<quick_reference>
|
|
32
|
+
|
|
34
33
|
## Lifecycle
|
|
35
34
|
|
|
36
35
|
```
|
|
@@ -45,6 +44,27 @@ register() → Download → Install → [Wait] → Activate → Fetch control
|
|
|
45
44
|
|
|
46
45
|
A document must reload to be controlled (or call `clients.claim()` during activate).
|
|
47
46
|
|
|
47
|
+
## Updating a Service Worker
|
|
48
|
+
|
|
49
|
+
- Browser byte-compares the SW file on each navigation (or every 24h)
|
|
50
|
+
- New version installs in background while old version still serves
|
|
51
|
+
- Increment the cache name (e.g., `v1` → `v2`) in the new version
|
|
52
|
+
- Delete old caches in the `activate` handler
|
|
53
|
+
- Call `self.skipWaiting()` in `install` to activate immediately
|
|
54
|
+
- Call `self.clients.claim()` in `activate` to take control of open pages
|
|
55
|
+
|
|
56
|
+
## DevTools
|
|
57
|
+
|
|
58
|
+
- **Chrome**: `chrome://inspect/#service-workers` or Application > Service Workers
|
|
59
|
+
- **Firefox**: `about:debugging#/runtime/this-firefox` or Application > Service Workers
|
|
60
|
+
- **Edge**: `edge://inspect/#service-workers` or Application > Service Workers
|
|
61
|
+
|
|
62
|
+
Unregister, update, and inspect caches from the Application panel. Use "Update on reload" checkbox during development.
|
|
63
|
+
|
|
64
|
+
</quick_reference>
|
|
65
|
+
|
|
66
|
+
<examples>
|
|
67
|
+
|
|
48
68
|
## Registration
|
|
49
69
|
|
|
50
70
|
```js
|
|
@@ -125,15 +145,6 @@ self.addEventListener("fetch", (event) => {
|
|
|
125
145
|
});
|
|
126
146
|
```
|
|
127
147
|
|
|
128
|
-
## Updating a Service Worker
|
|
129
|
-
|
|
130
|
-
- Browser byte-compares the SW file on each navigation (or every 24h)
|
|
131
|
-
- New version installs in background while old version still serves
|
|
132
|
-
- Increment the cache name (e.g., `v1` → `v2`) in the new version
|
|
133
|
-
- Delete old caches in the `activate` handler
|
|
134
|
-
- Call `self.skipWaiting()` in `install` to activate immediately
|
|
135
|
-
- Call `self.clients.claim()` in `activate` to take control of open pages
|
|
136
|
-
|
|
137
148
|
## Communicating with Pages
|
|
138
149
|
|
|
139
150
|
```js
|
|
@@ -150,22 +161,6 @@ self.addEventListener("message", (event) => {
|
|
|
150
161
|
});
|
|
151
162
|
```
|
|
152
163
|
|
|
153
|
-
## Common Pitfalls
|
|
154
|
-
|
|
155
|
-
1. **Response cloning** — `response.clone()` before both caching and returning, since body streams can only be read once
|
|
156
|
-
2. **Opaque responses** — cross-origin fetches without CORS return opaque responses (status 0). `cache.add()` will refuse them. Use `cache.put()` but you can't inspect the response
|
|
157
|
-
3. **waitUntil timing** — call `event.waitUntil()` synchronously within the event handler, not inside an async callback
|
|
158
|
-
4. **Scope ceiling** — a SW cannot control URLs above its own directory unless `Service-Worker-Allowed` header is set
|
|
159
|
-
5. **No state persistence** — the SW may terminate at any time when idle. Don't store state in global variables — use Cache API or IndexedDB
|
|
160
|
-
|
|
161
|
-
## Push Notifications & Background Sync
|
|
162
|
-
|
|
163
|
-
For push subscription, handling push events, and background sync implementation, see [references/push-and-sync.md](references/push-and-sync.md).
|
|
164
|
-
|
|
165
|
-
## API Quick Reference
|
|
166
|
-
|
|
167
|
-
For detailed interfaces (`Cache`, `CacheStorage`, `FetchEvent`, `Clients`, `ServiceWorkerRegistration`, `ServiceWorkerGlobalScope`), see [references/api-reference.md](references/api-reference.md).
|
|
168
|
-
|
|
169
164
|
## Next.js Integration
|
|
170
165
|
|
|
171
166
|
In Next.js, place the service worker file in `public/sw.js`. `public/sw.js` is intentionally plain JS (not processed by Next.js build pipeline). Register it from a client component:
|
|
@@ -186,10 +181,26 @@ export function ServiceWorkerRegistrar() {
|
|
|
186
181
|
|
|
187
182
|
Add to root layout. Next.js serves `public/` files at the root, so `/sw.js` scope covers `/`.
|
|
188
183
|
|
|
189
|
-
|
|
184
|
+
</examples>
|
|
190
185
|
|
|
191
|
-
|
|
192
|
-
- **Firefox**: `about:debugging#/runtime/this-firefox` or Application > Service Workers
|
|
193
|
-
- **Edge**: `edge://inspect/#service-workers` or Application > Service Workers
|
|
186
|
+
<gotchas>
|
|
194
187
|
|
|
195
|
-
|
|
188
|
+
## Common Pitfalls
|
|
189
|
+
|
|
190
|
+
1. **Response cloning** — `response.clone()` before both caching and returning, since body streams can only be read once
|
|
191
|
+
2. **Opaque responses** — cross-origin fetches without CORS return opaque responses (status 0). `cache.add()` will refuse them. Use `cache.put()` but you can't inspect the response
|
|
192
|
+
3. **waitUntil timing** — call `event.waitUntil()` synchronously within the event handler, not inside an async callback
|
|
193
|
+
4. **Scope ceiling** — a SW cannot control URLs above its own directory unless `Service-Worker-Allowed` header is set
|
|
194
|
+
5. **No state persistence** — the SW may terminate at any time when idle. Don't store state in global variables — use Cache API or IndexedDB
|
|
195
|
+
|
|
196
|
+
</gotchas>
|
|
197
|
+
|
|
198
|
+
<references>
|
|
199
|
+
|
|
200
|
+
## Reference files
|
|
201
|
+
|
|
202
|
+
- **Caching strategies** (cache-first, network-first, stale-while-revalidate): [references/caching-strategies.md](references/caching-strategies.md)
|
|
203
|
+
- **Push notifications & background sync** (push subscription, push events, background sync): [references/push-and-sync.md](references/push-and-sync.md)
|
|
204
|
+
- **API quick reference** (`Cache`, `CacheStorage`, `FetchEvent`, `Clients`, `ServiceWorkerRegistration`, `ServiceWorkerGlobalScope`): [references/api-reference.md](references/api-reference.md)
|
|
205
|
+
|
|
206
|
+
</references>
|
|
@@ -13,6 +13,8 @@ description: |
|
|
|
13
13
|
|
|
14
14
|
# TanStack Query v5 (React)
|
|
15
15
|
|
|
16
|
+
<quick_reference>
|
|
17
|
+
|
|
16
18
|
## Setup
|
|
17
19
|
|
|
18
20
|
```tsx
|
|
@@ -52,6 +54,10 @@ function App() {
|
|
|
52
54
|
|
|
53
55
|
**Key recommendation:** Set `staleTime` above 0 to control refetch frequency rather than disabling individual refetch triggers.
|
|
54
56
|
|
|
57
|
+
</quick_reference>
|
|
58
|
+
|
|
59
|
+
<examples>
|
|
60
|
+
|
|
55
61
|
## queryOptions — co-locate key + fn
|
|
56
62
|
|
|
57
63
|
Always use `queryOptions` to define query configurations. It enables type inference across `useQuery`, `prefetchQuery`, `getQueryData`, and `setQueryData`.
|
|
@@ -325,6 +331,10 @@ const { data } = useQuery({
|
|
|
325
331
|
|
|
326
332
|
`skipToken` prevents `refetch()` from working — use `enabled: false` if you need manual refetch.
|
|
327
333
|
|
|
334
|
+
</examples>
|
|
335
|
+
|
|
336
|
+
<gotchas>
|
|
337
|
+
|
|
328
338
|
## setQueryData — immutability
|
|
329
339
|
|
|
330
340
|
```tsx
|
|
@@ -340,9 +350,15 @@ queryClient.setQueryData(['todo', id], (old) =>
|
|
|
340
350
|
)
|
|
341
351
|
```
|
|
342
352
|
|
|
353
|
+
</gotchas>
|
|
354
|
+
|
|
355
|
+
<references>
|
|
356
|
+
|
|
343
357
|
## Further Reference
|
|
344
358
|
|
|
345
359
|
- **Full API signatures** (useQuery, useMutation, useInfiniteQuery, QueryClient): See [references/api-reference.md](references/api-reference.md)
|
|
346
360
|
- **SSR & Next.js** (hydration, App Router, streaming): See [references/ssr-nextjs.md](references/ssr-nextjs.md)
|
|
347
361
|
- **Testing** (renderHook, mocking, setup): See [references/testing.md](references/testing.md)
|
|
348
362
|
- **Advanced patterns** (TypeScript, Suspense, waterfalls, network modes): See [references/advanced-patterns.md](references/advanced-patterns.md)
|
|
363
|
+
|
|
364
|
+
</references>
|
|
@@ -7,6 +7,8 @@ description: "TypeScript coding conventions for strict, type-safe projects. Use
|
|
|
7
7
|
|
|
8
8
|
Project-wide TypeScript standards that complement agent-specific instructions.
|
|
9
9
|
|
|
10
|
+
<rules>
|
|
11
|
+
|
|
10
12
|
## Type Safety
|
|
11
13
|
|
|
12
14
|
- **No `any`**: Use `unknown` if the type is truly dynamic, then narrow.
|
|
@@ -43,9 +45,15 @@ import { Redis } from "ioredis";
|
|
|
43
45
|
- **Query** (returns data): `get`, `find`, `list`, `fetch`
|
|
44
46
|
- **Command** (changes state): `create`, `update`, `delete`, `add`, `remove`
|
|
45
47
|
|
|
48
|
+
</rules>
|
|
49
|
+
|
|
50
|
+
<anti_patterns>
|
|
51
|
+
|
|
46
52
|
## Anti-Patterns
|
|
47
53
|
|
|
48
54
|
- **Primitive obsession**: Use branded types or Zod enums, not raw strings for IDs and statuses.
|
|
49
55
|
- **Magic numbers/strings**: Use constants from a shared package (e.g., `RATE_LIMITS`, `PAGINATION`, `CACHE`).
|
|
50
56
|
- **Long parameter lists**: Use an options object or a Zod schema.
|
|
51
57
|
- **Premature abstraction**: Three similar lines > one premature helper. Abstract on the third repetition.
|
|
58
|
+
|
|
59
|
+
</anti_patterns>
|
|
@@ -7,15 +7,7 @@ description: "Review UI code for Web Interface Guidelines compliance. Use when a
|
|
|
7
7
|
|
|
8
8
|
Dispatch hub for UI/UX rules. Load the relevant reference file for full details.
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
1. [Rule Categories](#rule-categories-by-priority)
|
|
13
|
-
2. [Workflows](#workflows)
|
|
14
|
-
3. [Anti-patterns](#anti-patterns-flag-these)
|
|
15
|
-
4. [Output Format](#code-review-output-format)
|
|
16
|
-
5. [Reference Files](#reference-files)
|
|
17
|
-
|
|
18
|
-
---
|
|
10
|
+
<rules>
|
|
19
11
|
|
|
20
12
|
## Rule Categories by Priority
|
|
21
13
|
|
|
@@ -31,31 +23,41 @@ Dispatch hub for UI/UX rules. Load the relevant reference file for full details.
|
|
|
31
23
|
| 8 | Content & Navigation | MEDIUM | `forms-content-checklist` |
|
|
32
24
|
| 9 | Charts & Data | LOW | `layout-typography-animation` |
|
|
33
25
|
|
|
34
|
-
|
|
26
|
+
</rules>
|
|
27
|
+
|
|
28
|
+
<workflow>
|
|
35
29
|
|
|
36
30
|
## Workflows
|
|
37
31
|
|
|
38
|
-
|
|
32
|
+
<phase_1_review_ui>
|
|
33
|
+
### Review UI code
|
|
39
34
|
|
|
40
35
|
1. Read the target file(s).
|
|
41
36
|
2. Load the relevant reference file(s) from `references/` based on what the code contains.
|
|
42
37
|
3. Check each applicable rule. Report violations in the output format below.
|
|
38
|
+
</phase_1_review_ui>
|
|
43
39
|
|
|
44
|
-
|
|
40
|
+
<phase_2_build_component>
|
|
41
|
+
### Build new component
|
|
45
42
|
|
|
46
43
|
1. Load `references/accessibility-and-interaction.md` -- all components must meet CRITICAL rules.
|
|
47
44
|
2. Load additional references based on component type:
|
|
48
45
|
- Form component -> `references/forms-content-checklist.md`
|
|
49
46
|
- Layout/visual component -> `references/layout-typography-animation.md`
|
|
50
47
|
3. Follow rules during implementation.
|
|
48
|
+
</phase_2_build_component>
|
|
51
49
|
|
|
52
|
-
|
|
50
|
+
<phase_3_pre_delivery>
|
|
51
|
+
### Pre-delivery checklist
|
|
53
52
|
|
|
54
53
|
1. Load `references/forms-content-checklist.md` for the full checklist.
|
|
55
54
|
2. Load `references/accessibility-and-interaction.md` for the interaction checklist.
|
|
56
55
|
3. Walk through every checkbox before shipping.
|
|
56
|
+
</phase_3_pre_delivery>
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
</workflow>
|
|
59
|
+
|
|
60
|
+
<anti_patterns>
|
|
59
61
|
|
|
60
62
|
## Anti-patterns (flag these)
|
|
61
63
|
|
|
@@ -70,7 +72,9 @@ Dispatch hub for UI/UX rules. Load the relevant reference file for full details.
|
|
|
70
72
|
- Hardcoded date/number formats -- use `Intl.*`
|
|
71
73
|
- Icon-only buttons without `aria-label`
|
|
72
74
|
|
|
73
|
-
|
|
75
|
+
</anti_patterns>
|
|
76
|
+
|
|
77
|
+
<output>
|
|
74
78
|
|
|
75
79
|
## Code Review Output Format
|
|
76
80
|
|
|
@@ -78,7 +82,9 @@ Group findings by file. Use `file:line` format (VS Code clickable). Be terse --
|
|
|
78
82
|
|
|
79
83
|
See [template.md](template.md) for the expected output format.
|
|
80
84
|
|
|
81
|
-
|
|
85
|
+
</output>
|
|
86
|
+
|
|
87
|
+
<references>
|
|
82
88
|
|
|
83
89
|
## Reference Files
|
|
84
90
|
|
|
@@ -87,3 +93,5 @@ Load these as needed during reviews and implementation:
|
|
|
87
93
|
- **[Accessibility & Interaction](references/accessibility-and-interaction.md)** -- Focus, ARIA, keyboard, touch targets, cursors, drag UX
|
|
88
94
|
- **[Layout, Typography & Animation](references/layout-typography-animation.md)** -- Performance, responsive, fonts, color, motion, charts
|
|
89
95
|
- **[Forms, Content & Checklist](references/forms-content-checklist.md)** -- Forms, content handling, navigation, dark mode, locale, hydration, pre-delivery checklist
|
|
96
|
+
|
|
97
|
+
</references>
|
package/skills/yolo/SKILL.md
CHANGED
|
@@ -31,11 +31,11 @@ allowed-tools: Bash(docker *), Bash(ls *), Bash(cat *), Bash(cp *), Bash(mkdir *
|
|
|
31
31
|
- "Set up autonomous mode"
|
|
32
32
|
</trigger_examples>
|
|
33
33
|
|
|
34
|
-
<
|
|
34
|
+
<role>
|
|
35
35
|
You are a devcontainer setup specialist. Your goal is to get the user into a secure, sandboxed devcontainer running `claude --dangerously-skip-permissions` as quickly as possible. You follow a strict decision tree and never skip safety checks.
|
|
36
36
|
|
|
37
37
|
**IMPORTANT SECURITY NOTE:** While the devcontainer provides substantial protections (network firewall, isolation), it is NOT immune to all attacks. Only use devcontainers with **trusted repositories**. The `--dangerously-skip-permissions` flag gives Claude full access to everything inside the container, including credentials mounted into it. Always inform the user of this trade-off.
|
|
38
|
-
</
|
|
38
|
+
</role>
|
|
39
39
|
|
|
40
40
|
<task>
|
|
41
41
|
$ARGUMENTS
|