@mr.dj2u/knowledge 0.1.7 → 0.1.9

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.
Files changed (68) hide show
  1. package/dist/content/checklists/push-merge-loop.md +17 -17
  2. package/dist/content/checklists/unified-agent-bundle-validation.md +9 -9
  3. package/dist/content/examples/push-merge-loop.md +14 -14
  4. package/dist/content/examples/unified-agent-bundle-bootstrap.md +8 -8
  5. package/dist/content/guides/post-create-onboarding.md +150 -140
  6. package/dist/content/patterns/api/api-routes.md +313 -313
  7. package/dist/content/patterns/api/error-handling.md +310 -310
  8. package/dist/content/patterns/database/drizzle-schema.md +279 -279
  9. package/dist/content/patterns/database/migrations.md +364 -364
  10. package/dist/content/patterns/database/query-organization.md +536 -536
  11. package/dist/content/patterns/database/relations.md +449 -449
  12. package/dist/content/patterns/deployment/build-configuration.md +440 -440
  13. package/dist/content/patterns/deployment/ci-cd-patterns.md +447 -447
  14. package/dist/content/patterns/deployment/environment-config.md +379 -379
  15. package/dist/content/patterns/deployment/hosting-setup.md +424 -424
  16. package/dist/content/patterns/project/configuration-patterns.md +459 -459
  17. package/dist/content/patterns/project/documentation-org.md +506 -506
  18. package/dist/content/patterns/project/folder-structure.md +397 -397
  19. package/dist/content/patterns/project/library-exports.md +464 -464
  20. package/dist/content/patterns/project/monorepo-structure.md +500 -500
  21. package/dist/content/patterns/routing/dynamic-routes.md +220 -220
  22. package/dist/content/patterns/routing/file-based-routing.md +185 -185
  23. package/dist/content/patterns/routing/route-groups.md +428 -428
  24. package/dist/content/patterns/state/persistence-middleware.md +520 -520
  25. package/dist/content/patterns/state/selector-hooks.md +537 -537
  26. package/dist/content/patterns/state/store-organization.md +538 -538
  27. package/dist/content/patterns/state/zustand-patterns.md +347 -347
  28. package/dist/content/patterns/styling/component-styling.md +467 -467
  29. package/dist/content/patterns/styling/responsive-patterns.md +397 -397
  30. package/dist/content/patterns/styling/theme-configuration.md +425 -425
  31. package/dist/content/patterns/styling/uniwind-setup.md +411 -411
  32. package/dist/content/prompts/continue-development.md +41 -35
  33. package/dist/content/prompts/create-expo-super-stack.md +4 -1
  34. package/dist/content/prompts/fix-seo.md +29 -29
  35. package/dist/content/prompts/onboard-new-expo-app.md +11 -11
  36. package/dist/content/prompts/prepare-deploy.md +29 -29
  37. package/dist/content/prompts/project-research-plan.md +29 -29
  38. package/dist/content/prompts/push-merge-loop.md +25 -25
  39. package/dist/content/prompts/retrospective-project-onboarding.md +23 -0
  40. package/dist/content/prompts/review-expo-project.md +29 -29
  41. package/dist/content/prompts/run-doctor.md +38 -38
  42. package/dist/content/prompts/wrap-up.md +70 -67
  43. package/dist/content/reference/create-expo-stack-uniwind.md +29 -29
  44. package/dist/content/reference/doctor-dogfood.md +1 -1
  45. package/dist/content/reference/mcp-sdk-transport.md +30 -30
  46. package/dist/content/reference/reference-repo-evacuation.md +31 -31
  47. package/dist/content/resource-index.json +1 -0
  48. package/dist/content/rules/env-hygiene.md +10 -0
  49. package/dist/content/rules/ssr-safety.md +7 -0
  50. package/dist/content/skills/api-routes.md +34 -33
  51. package/dist/content/skills/continue-development.md +49 -32
  52. package/dist/content/skills/debugging.md +32 -32
  53. package/dist/content/skills/deployment.md +32 -32
  54. package/dist/content/skills/dev-server-management.md +32 -32
  55. package/dist/content/skills/env-vars.md +32 -32
  56. package/dist/content/skills/expo-router-architecture.md +34 -33
  57. package/dist/content/skills/expo-ssr-safety.md +32 -32
  58. package/dist/content/skills/plugin-creation.md +41 -41
  59. package/dist/content/skills/production-server-patterns.md +31 -31
  60. package/dist/content/skills/project-onboarding.md +35 -31
  61. package/dist/content/skills/research-plan-intake.md +32 -32
  62. package/dist/content/skills/seo-metadata.md +31 -31
  63. package/dist/content/skills/super-stack-startup.md +38 -34
  64. package/dist/content/skills/uniwind-theming.md +32 -32
  65. package/dist/prompts/index.d.ts.map +1 -1
  66. package/dist/prompts/index.js +11 -0
  67. package/dist/prompts/index.js.map +1 -1
  68. package/package.json +7 -1
@@ -1,221 +1,221 @@
1
- # Dynamic Routes with Parameters
2
-
3
- ## Description
4
-
5
- Dynamic routes capture URL parameters using bracket syntax `[param].tsx` in Expo Router. Parameters are extracted via `useLocalSearchParams()` hook with full TypeScript support. This enables parameterized pages for lists (detail views, user profiles, etc.) while maintaining type safety.
6
-
7
- ## When to Use
8
-
9
- **Use dynamic routes** for:
10
- - ✅ Detail pages from lists (`/events/123`, `/user/alice`)
11
- - ✅ Nested hierarchies (`/guides/PLZA/strategies/15`)
12
- - ✅ Optional parameters with catch-all routes (`[...slug]`)
13
- - ✅ Single or multiple dynamic segments
14
-
15
- ## Code Example
16
-
17
- ### Single Dynamic Segment
18
-
19
- ```typescript
20
- // File: app/events/[id].tsx
21
- import { useLocalSearchParams } from 'expo-router';
22
- import { EventDetailScreen } from '@/components/EventDetailScreen';
23
-
24
- export default function EventDetailRoute() {
25
- const { id } = useLocalSearchParams<{ id: string }>();
26
-
27
- if (!id) {
28
- return <ErrorScreen message="Event ID is required" />;
29
- }
30
-
31
- return <EventDetailScreen eventId={id} />;
32
- }
33
-
34
- // Navigation
35
- import { router } from 'expo-router';
36
- router.push(`/events/${eventId}`);
37
- router.push({
38
- pathname: '/events/[id]',
39
- params: { id: eventId },
40
- });
41
- ```
42
-
43
- **From:** PokePages/src/app/(drawer)/events/[event].tsx
44
-
45
- ### Multiple Dynamic Segments
46
-
47
- ```typescript
48
- // File: app/guides/[region]/[guide].tsx
49
- import { useLocalSearchParams } from 'expo-router';
50
-
51
- export default function GuideDetailRoute() {
52
- const { region, guide } = useLocalSearchParams<{
53
- region: string;
54
- guide: string;
55
- }>();
56
-
57
- return (
58
- <GuideDetailScreen
59
- region={region}
60
- guide={guide}
61
- />
62
- );
63
- }
64
-
65
- // Usage
66
- router.push({
67
- pathname: '/guides/[region]/[guide]',
68
- params: { region: 'PLZA', guide: 'elite-four' },
69
- });
70
- // Results in: /guides/PLZA/elite-four
71
- ```
72
-
73
- **From:** PokePages/src/app/(drawer)/guides/PLZA/strategies/[id].tsx pattern
74
-
75
- ### Catch-All Routes (Variable Segments)
76
-
77
- ```typescript
78
- // File: app/docs/[...slug].tsx
79
- import { useLocalSearchParams } from 'expo-router';
80
-
81
- export default function DocsRoute() {
82
- const { slug } = useLocalSearchParams<{ slug: string[] }>();
83
- // slug is an array: ['api', 'reference', 'functions']
84
-
85
- return (
86
- <DocsScreen
87
- path={slug?.join('/') || ''}
88
- breadcrumbs={slug}
89
- />
90
- );
91
- }
92
-
93
- // Navigation
94
- router.push('/docs/api/reference/functions');
95
- // slug becomes: ['api', 'reference', 'functions']
96
- ```
97
-
98
- **From:** Expo Router conventions, applicable to content-heavy hierarchies
99
-
100
- ## Configuration
101
-
102
- ### TypeScript Setup for Type-Safe Params
103
-
104
- ```typescript
105
- // Define param types for each route
106
- type EventDetailParams = {
107
- id: string;
108
- };
109
-
110
- type GuideDetailParams = {
111
- region: string;
112
- guide: string;
113
- };
114
-
115
- // In route file
116
- const { id } = useLocalSearchParams<EventDetailParams>();
117
- ```
118
-
119
- ### Query Parameters (Search Strings)
120
-
121
- ```typescript
122
- // Navigation with query params
123
- router.push({
124
- pathname: '/search',
125
- params: {
126
- q: 'pikachu',
127
- type: 'pokemon',
128
- generation: '1'
129
- }
130
- });
131
-
132
- // Results in: /search?q=pikachu&type=pokemon&generation=1
133
-
134
- // In route
135
- const { q, type, generation } = useLocalSearchParams<{
136
- q?: string;
137
- type?: string;
138
- generation?: string;
139
- }>();
140
- ```
141
-
142
- ## Best Practices
143
-
144
- ### ✅ DO
145
-
146
- 1. **Type your params** for IDE autocomplete and type checking
147
- ```typescript
148
- const { id } = useLocalSearchParams<{ id: string }>();
149
- // TypeScript knows id is string
150
- ```
151
-
152
- 2. **Handle missing params** with validation
153
- ```typescript
154
- const { id } = useLocalSearchParams<{ id: string }>();
155
-
156
- if (!id) {
157
- return <ErrorScreen />;
158
- }
159
-
160
- // Safe to use id here
161
- ```
162
-
163
- 3. **Use descriptive param names**
164
- ```
165
- ✅ [userId].tsx
166
- ✅ [eventId].tsx
167
- ❌ [id].tsx (too generic)
168
- ```
169
-
170
- 4. **Nest dynamic routes** for logical hierarchies
171
- ```
172
- guides/
173
- ├── [region]/
174
- │ ├── [guide].tsx → /guides/:region/:guide
175
- ```
176
-
177
- 5. **Use catch-all for documentation or content hierarchies**
178
- ```
179
- docs/[...slug].tsx → /docs/api/reference/functions
180
- ```
181
-
182
- ### ❌ DON'T
183
-
184
- 1. **Don't mix route parameters and query parameters unnecessarily**
185
- ```typescript
186
- // ❌ AVOID
187
- /events/123?id=456&eventId=789
188
-
189
- // ✅ BETTER - use route params
190
- /events/123
191
- ```
192
-
193
- 2. **Don't rely on optional params without defaults**
194
- ```typescript
195
- // ❌ RISKY
196
- const { id } = useLocalSearchParams<{ id: string }>();
197
- return <EventDetail id={id} />; // Could be undefined
198
-
199
- // ✅ SAFE
200
- const { id } = useLocalSearchParams<{ id?: string }>();
201
- if (!id) return <ErrorScreen />;
202
- return <EventDetail id={id} />;
203
- ```
204
-
205
- 3. **Don't create overly deep param nesting** without cause
206
- ```
207
- ❌ /app/[userId]/posts/[postId]/comments/[commentId]/likes/[likeId]
208
- ✅ /posts/[postId] with comment data in store/props
209
- ```
210
-
211
- ## Related Patterns
212
-
213
- - [File-Based Routing](./file-based-routing.md) — Route file structure
214
- - [Route Groups](./route-groups.md) — Organizing routes hierarchically
215
- - [Navigation Patterns](./navigation-patterns.md) — router.push, Link components
216
- - [API Routes](./api-routes.md) — Dynamic API endpoints
217
-
218
- ---
219
-
220
- *Pattern extracted from production repositories: PokePages, not-hot-dog, Expo Router documentation*
1
+ # Dynamic Routes with Parameters
2
+
3
+ ## Description
4
+
5
+ Dynamic routes capture URL parameters using bracket syntax `[param].tsx` in Expo Router. Parameters are extracted via `useLocalSearchParams()` hook with full TypeScript support. This enables parameterized pages for lists (detail views, user profiles, etc.) while maintaining type safety.
6
+
7
+ ## When to Use
8
+
9
+ **Use dynamic routes** for:
10
+ - ✅ Detail pages from lists (`/events/123`, `/user/alice`)
11
+ - ✅ Nested hierarchies (`/guides/PLZA/strategies/15`)
12
+ - ✅ Optional parameters with catch-all routes (`[...slug]`)
13
+ - ✅ Single or multiple dynamic segments
14
+
15
+ ## Code Example
16
+
17
+ ### Single Dynamic Segment
18
+
19
+ ```typescript
20
+ // File: app/events/[id].tsx
21
+ import { useLocalSearchParams } from 'expo-router';
22
+ import { EventDetailScreen } from '@/components/EventDetailScreen';
23
+
24
+ export default function EventDetailRoute() {
25
+ const { id } = useLocalSearchParams<{ id: string }>();
26
+
27
+ if (!id) {
28
+ return <ErrorScreen message="Event ID is required" />;
29
+ }
30
+
31
+ return <EventDetailScreen eventId={id} />;
32
+ }
33
+
34
+ // Navigation
35
+ import { router } from 'expo-router';
36
+ router.push(`/events/${eventId}`);
37
+ router.push({
38
+ pathname: '/events/[id]',
39
+ params: { id: eventId },
40
+ });
41
+ ```
42
+
43
+ **From:** PokePages/src/app/(drawer)/events/[event].tsx
44
+
45
+ ### Multiple Dynamic Segments
46
+
47
+ ```typescript
48
+ // File: app/guides/[region]/[guide].tsx
49
+ import { useLocalSearchParams } from 'expo-router';
50
+
51
+ export default function GuideDetailRoute() {
52
+ const { region, guide } = useLocalSearchParams<{
53
+ region: string;
54
+ guide: string;
55
+ }>();
56
+
57
+ return (
58
+ <GuideDetailScreen
59
+ region={region}
60
+ guide={guide}
61
+ />
62
+ );
63
+ }
64
+
65
+ // Usage
66
+ router.push({
67
+ pathname: '/guides/[region]/[guide]',
68
+ params: { region: 'PLZA', guide: 'elite-four' },
69
+ });
70
+ // Results in: /guides/PLZA/elite-four
71
+ ```
72
+
73
+ **From:** PokePages/src/app/(drawer)/guides/PLZA/strategies/[id].tsx pattern
74
+
75
+ ### Catch-All Routes (Variable Segments)
76
+
77
+ ```typescript
78
+ // File: app/docs/[...slug].tsx
79
+ import { useLocalSearchParams } from 'expo-router';
80
+
81
+ export default function DocsRoute() {
82
+ const { slug } = useLocalSearchParams<{ slug: string[] }>();
83
+ // slug is an array: ['api', 'reference', 'functions']
84
+
85
+ return (
86
+ <DocsScreen
87
+ path={slug?.join('/') || ''}
88
+ breadcrumbs={slug}
89
+ />
90
+ );
91
+ }
92
+
93
+ // Navigation
94
+ router.push('/docs/api/reference/functions');
95
+ // slug becomes: ['api', 'reference', 'functions']
96
+ ```
97
+
98
+ **From:** Expo Router conventions, applicable to content-heavy hierarchies
99
+
100
+ ## Configuration
101
+
102
+ ### TypeScript Setup for Type-Safe Params
103
+
104
+ ```typescript
105
+ // Define param types for each route
106
+ type EventDetailParams = {
107
+ id: string;
108
+ };
109
+
110
+ type GuideDetailParams = {
111
+ region: string;
112
+ guide: string;
113
+ };
114
+
115
+ // In route file
116
+ const { id } = useLocalSearchParams<EventDetailParams>();
117
+ ```
118
+
119
+ ### Query Parameters (Search Strings)
120
+
121
+ ```typescript
122
+ // Navigation with query params
123
+ router.push({
124
+ pathname: '/search',
125
+ params: {
126
+ q: 'pikachu',
127
+ type: 'pokemon',
128
+ generation: '1'
129
+ }
130
+ });
131
+
132
+ // Results in: /search?q=pikachu&type=pokemon&generation=1
133
+
134
+ // In route
135
+ const { q, type, generation } = useLocalSearchParams<{
136
+ q?: string;
137
+ type?: string;
138
+ generation?: string;
139
+ }>();
140
+ ```
141
+
142
+ ## Best Practices
143
+
144
+ ### ✅ DO
145
+
146
+ 1. **Type your params** for IDE autocomplete and type checking
147
+ ```typescript
148
+ const { id } = useLocalSearchParams<{ id: string }>();
149
+ // TypeScript knows id is string
150
+ ```
151
+
152
+ 2. **Handle missing params** with validation
153
+ ```typescript
154
+ const { id } = useLocalSearchParams<{ id: string }>();
155
+
156
+ if (!id) {
157
+ return <ErrorScreen />;
158
+ }
159
+
160
+ // Safe to use id here
161
+ ```
162
+
163
+ 3. **Use descriptive param names**
164
+ ```
165
+ ✅ [userId].tsx
166
+ ✅ [eventId].tsx
167
+ ❌ [id].tsx (too generic)
168
+ ```
169
+
170
+ 4. **Nest dynamic routes** for logical hierarchies
171
+ ```
172
+ guides/
173
+ ├── [region]/
174
+ │ ├── [guide].tsx → /guides/:region/:guide
175
+ ```
176
+
177
+ 5. **Use catch-all for documentation or content hierarchies**
178
+ ```
179
+ docs/[...slug].tsx → /docs/api/reference/functions
180
+ ```
181
+
182
+ ### ❌ DON'T
183
+
184
+ 1. **Don't mix route parameters and query parameters unnecessarily**
185
+ ```typescript
186
+ // ❌ AVOID
187
+ /events/123?id=456&eventId=789
188
+
189
+ // ✅ BETTER - use route params
190
+ /events/123
191
+ ```
192
+
193
+ 2. **Don't rely on optional params without defaults**
194
+ ```typescript
195
+ // ❌ RISKY
196
+ const { id } = useLocalSearchParams<{ id: string }>();
197
+ return <EventDetail id={id} />; // Could be undefined
198
+
199
+ // ✅ SAFE
200
+ const { id } = useLocalSearchParams<{ id?: string }>();
201
+ if (!id) return <ErrorScreen />;
202
+ return <EventDetail id={id} />;
203
+ ```
204
+
205
+ 3. **Don't create overly deep param nesting** without cause
206
+ ```
207
+ ❌ /app/[userId]/posts/[postId]/comments/[commentId]/likes/[likeId]
208
+ ✅ /posts/[postId] with comment data in store/props
209
+ ```
210
+
211
+ ## Related Patterns
212
+
213
+ - [File-Based Routing](./file-based-routing.md) — Route file structure
214
+ - [Route Groups](./route-groups.md) — Organizing routes hierarchically
215
+ - [Navigation Patterns](./navigation-patterns.md) — router.push, Link components
216
+ - [API Routes](./api-routes.md) — Dynamic API endpoints
217
+
218
+ ---
219
+
220
+ *Pattern extracted from production repositories: PokePages, not-hot-dog, Expo Router documentation*
221
221
  *Implementations: PokePages/src\app\(drawer)\events\[event].tsx*