@chankov/agent-skills 0.3.2 → 0.3.3

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 (159) hide show
  1. package/.versions/0.3.3/.claude/commands/build.md +18 -0
  2. package/.versions/0.3.3/.claude/commands/code-simplify.md +22 -0
  3. package/.versions/0.3.3/.claude/commands/design-agent.md +14 -0
  4. package/.versions/0.3.3/.claude/commands/doctor-agent-skills.md +13 -0
  5. package/.versions/0.3.3/.claude/commands/plan.md +16 -0
  6. package/.versions/0.3.3/.claude/commands/prime.md +22 -0
  7. package/.versions/0.3.3/.claude/commands/review.md +16 -0
  8. package/.versions/0.3.3/.claude/commands/setup-agent-skills.md +19 -0
  9. package/.versions/0.3.3/.claude/commands/ship.md +17 -0
  10. package/.versions/0.3.3/.claude/commands/spec.md +15 -0
  11. package/.versions/0.3.3/.claude/commands/test.md +19 -0
  12. package/.versions/0.3.3/.opencode/commands/as-build.md +17 -0
  13. package/.versions/0.3.3/.opencode/commands/as-code-simplify.md +16 -0
  14. package/.versions/0.3.3/.opencode/commands/as-design-agent.md +15 -0
  15. package/.versions/0.3.3/.opencode/commands/as-doctor-agent-skills.md +11 -0
  16. package/.versions/0.3.3/.opencode/commands/as-plan.md +16 -0
  17. package/.versions/0.3.3/.opencode/commands/as-prime.md +22 -0
  18. package/.versions/0.3.3/.opencode/commands/as-review.md +15 -0
  19. package/.versions/0.3.3/.opencode/commands/as-setup-agent-skills.md +11 -0
  20. package/.versions/0.3.3/.opencode/commands/as-ship.md +16 -0
  21. package/.versions/0.3.3/.opencode/commands/as-spec.md +16 -0
  22. package/.versions/0.3.3/.opencode/commands/as-test.md +21 -0
  23. package/.versions/0.3.3/.pi/agents/agent-chain.yaml +49 -0
  24. package/.versions/0.3.3/.pi/agents/bowser.md +19 -0
  25. package/.versions/0.3.3/.pi/agents/pi-pi/agent-expert.md +98 -0
  26. package/.versions/0.3.3/.pi/agents/pi-pi/cli-expert.md +41 -0
  27. package/.versions/0.3.3/.pi/agents/pi-pi/config-expert.md +63 -0
  28. package/.versions/0.3.3/.pi/agents/pi-pi/ext-expert.md +43 -0
  29. package/.versions/0.3.3/.pi/agents/pi-pi/keybinding-expert.md +134 -0
  30. package/.versions/0.3.3/.pi/agents/pi-pi/pi-orchestrator.md +57 -0
  31. package/.versions/0.3.3/.pi/agents/pi-pi/prompt-expert.md +70 -0
  32. package/.versions/0.3.3/.pi/agents/pi-pi/skill-expert.md +42 -0
  33. package/.versions/0.3.3/.pi/agents/pi-pi/theme-expert.md +40 -0
  34. package/.versions/0.3.3/.pi/agents/pi-pi/tui-expert.md +85 -0
  35. package/.versions/0.3.3/.pi/agents/teams.yaml +31 -0
  36. package/.versions/0.3.3/.pi/damage-control-rules.yaml +278 -0
  37. package/.versions/0.3.3/.pi/extensions/agent-skills-update-check/README.md +58 -0
  38. package/.versions/0.3.3/.pi/extensions/agent-skills-update-check/index.ts +161 -0
  39. package/.versions/0.3.3/.pi/extensions/agent-skills-update-check/package.json +6 -0
  40. package/.versions/0.3.3/.pi/extensions/chrome-devtools-mcp/README.md +39 -0
  41. package/.versions/0.3.3/.pi/extensions/chrome-devtools-mcp/index.ts +61 -0
  42. package/.versions/0.3.3/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
  43. package/.versions/0.3.3/.pi/extensions/compact-and-continue/README.md +42 -0
  44. package/.versions/0.3.3/.pi/extensions/compact-and-continue/index.ts +120 -0
  45. package/.versions/0.3.3/.pi/extensions/compact-and-continue/package.json +6 -0
  46. package/.versions/0.3.3/.pi/extensions/mcp-bridge/README.md +46 -0
  47. package/.versions/0.3.3/.pi/extensions/mcp-bridge/index.ts +206 -0
  48. package/.versions/0.3.3/.pi/extensions/mcp-bridge/package.json +6 -0
  49. package/.versions/0.3.3/.pi/extensions/package-lock.json +1143 -0
  50. package/.versions/0.3.3/.pi/extensions/package.json +9 -0
  51. package/.versions/0.3.3/.pi/harnesses/agent-chain/README.md +37 -0
  52. package/.versions/0.3.3/.pi/harnesses/agent-chain/index.ts +795 -0
  53. package/.versions/0.3.3/.pi/harnesses/agent-chain/package.json +6 -0
  54. package/.versions/0.3.3/.pi/harnesses/agent-team/README.md +38 -0
  55. package/.versions/0.3.3/.pi/harnesses/agent-team/index.ts +732 -0
  56. package/.versions/0.3.3/.pi/harnesses/agent-team/package.json +6 -0
  57. package/.versions/0.3.3/.pi/harnesses/coms/README.md +36 -0
  58. package/.versions/0.3.3/.pi/harnesses/coms/index.ts +1595 -0
  59. package/.versions/0.3.3/.pi/harnesses/coms/package.json +6 -0
  60. package/.versions/0.3.3/.pi/harnesses/coms-net/README.md +46 -0
  61. package/.versions/0.3.3/.pi/harnesses/coms-net/index.ts +1637 -0
  62. package/.versions/0.3.3/.pi/harnesses/coms-net/package.json +6 -0
  63. package/.versions/0.3.3/.pi/harnesses/damage-control/README.md +38 -0
  64. package/.versions/0.3.3/.pi/harnesses/damage-control/index.ts +207 -0
  65. package/.versions/0.3.3/.pi/harnesses/damage-control/package.json +6 -0
  66. package/.versions/0.3.3/.pi/harnesses/damage-control-continue/README.md +37 -0
  67. package/.versions/0.3.3/.pi/harnesses/damage-control-continue/index.ts +234 -0
  68. package/.versions/0.3.3/.pi/harnesses/damage-control-continue/package.json +6 -0
  69. package/.versions/0.3.3/.pi/harnesses/minimal/README.md +27 -0
  70. package/.versions/0.3.3/.pi/harnesses/minimal/index.ts +32 -0
  71. package/.versions/0.3.3/.pi/harnesses/minimal/package.json +6 -0
  72. package/.versions/0.3.3/.pi/harnesses/package-lock.json +35 -0
  73. package/.versions/0.3.3/.pi/harnesses/package.json +9 -0
  74. package/.versions/0.3.3/.pi/harnesses/pi-pi/README.md +39 -0
  75. package/.versions/0.3.3/.pi/harnesses/pi-pi/index.ts +631 -0
  76. package/.versions/0.3.3/.pi/harnesses/pi-pi/package.json +6 -0
  77. package/.versions/0.3.3/.pi/harnesses/purpose-gate/README.md +27 -0
  78. package/.versions/0.3.3/.pi/harnesses/purpose-gate/index.ts +82 -0
  79. package/.versions/0.3.3/.pi/harnesses/purpose-gate/package.json +6 -0
  80. package/.versions/0.3.3/.pi/harnesses/session-replay/README.md +28 -0
  81. package/.versions/0.3.3/.pi/harnesses/session-replay/index.ts +214 -0
  82. package/.versions/0.3.3/.pi/harnesses/session-replay/package.json +6 -0
  83. package/.versions/0.3.3/.pi/harnesses/subagent-widget/README.md +36 -0
  84. package/.versions/0.3.3/.pi/harnesses/subagent-widget/index.ts +479 -0
  85. package/.versions/0.3.3/.pi/harnesses/subagent-widget/package.json +6 -0
  86. package/.versions/0.3.3/.pi/harnesses/system-select/README.md +39 -0
  87. package/.versions/0.3.3/.pi/harnesses/system-select/index.ts +165 -0
  88. package/.versions/0.3.3/.pi/harnesses/system-select/package.json +6 -0
  89. package/.versions/0.3.3/.pi/harnesses/tilldone/README.md +35 -0
  90. package/.versions/0.3.3/.pi/harnesses/tilldone/index.ts +724 -0
  91. package/.versions/0.3.3/.pi/harnesses/tilldone/package.json +6 -0
  92. package/.versions/0.3.3/.pi/harnesses/tool-counter/README.md +31 -0
  93. package/.versions/0.3.3/.pi/harnesses/tool-counter/index.ts +100 -0
  94. package/.versions/0.3.3/.pi/harnesses/tool-counter/package.json +6 -0
  95. package/.versions/0.3.3/.pi/harnesses/tool-counter-widget/README.md +27 -0
  96. package/.versions/0.3.3/.pi/harnesses/tool-counter-widget/index.ts +66 -0
  97. package/.versions/0.3.3/.pi/harnesses/tool-counter-widget/package.json +6 -0
  98. package/.versions/0.3.3/.pi/prompts/build.md +24 -0
  99. package/.versions/0.3.3/.pi/prompts/code-simplify.md +22 -0
  100. package/.versions/0.3.3/.pi/prompts/doctor-agent-skills.md +13 -0
  101. package/.versions/0.3.3/.pi/prompts/plan.md +16 -0
  102. package/.versions/0.3.3/.pi/prompts/review.md +16 -0
  103. package/.versions/0.3.3/.pi/prompts/setup-agent-skills.md +19 -0
  104. package/.versions/0.3.3/.pi/prompts/ship.md +17 -0
  105. package/.versions/0.3.3/.pi/prompts/spec.md +15 -0
  106. package/.versions/0.3.3/.pi/prompts/test.md +19 -0
  107. package/.versions/0.3.3/.pi/skills/bowser/SKILL.md +114 -0
  108. package/.versions/0.3.3/.version +1 -0
  109. package/.versions/0.3.3/agents/builder.md +6 -0
  110. package/.versions/0.3.3/agents/code-reviewer.md +93 -0
  111. package/.versions/0.3.3/agents/documenter.md +6 -0
  112. package/.versions/0.3.3/agents/plan-reviewer.md +22 -0
  113. package/.versions/0.3.3/agents/planner.md +6 -0
  114. package/.versions/0.3.3/agents/scout.md +6 -0
  115. package/.versions/0.3.3/agents/security-auditor.md +97 -0
  116. package/.versions/0.3.3/agents/test-engineer.md +89 -0
  117. package/.versions/0.3.3/hooks/SIMPLIFY-IGNORE.md +90 -0
  118. package/.versions/0.3.3/hooks/hooks.json +14 -0
  119. package/.versions/0.3.3/hooks/session-start.sh +74 -0
  120. package/.versions/0.3.3/hooks/simplify-ignore-test.sh +247 -0
  121. package/.versions/0.3.3/hooks/simplify-ignore.sh +302 -0
  122. package/.versions/0.3.3/references/accessibility-checklist.md +159 -0
  123. package/.versions/0.3.3/references/performance-checklist.md +121 -0
  124. package/.versions/0.3.3/references/prompting-patterns.md +380 -0
  125. package/.versions/0.3.3/references/security-checklist.md +134 -0
  126. package/.versions/0.3.3/references/testing-patterns.md +236 -0
  127. package/.versions/0.3.3/scripts/coms-net-server.ts +1741 -0
  128. package/.versions/0.3.3/skills/api-and-interface-design/SKILL.md +294 -0
  129. package/.versions/0.3.3/skills/browser-testing-with-devtools/SKILL.md +335 -0
  130. package/.versions/0.3.3/skills/ci-cd-and-automation/SKILL.md +390 -0
  131. package/.versions/0.3.3/skills/code-review-and-quality/SKILL.md +347 -0
  132. package/.versions/0.3.3/skills/code-simplification/SKILL.md +331 -0
  133. package/.versions/0.3.3/skills/context-engineering/SKILL.md +291 -0
  134. package/.versions/0.3.3/skills/debugging-and-error-recovery/SKILL.md +300 -0
  135. package/.versions/0.3.3/skills/deprecation-and-migration/SKILL.md +206 -0
  136. package/.versions/0.3.3/skills/designing-agents/SKILL.md +394 -0
  137. package/.versions/0.3.3/skills/designing-agents/pi-harness-authoring.md +213 -0
  138. package/.versions/0.3.3/skills/documentation-and-adrs/SKILL.md +278 -0
  139. package/.versions/0.3.3/skills/frontend-ui-engineering/SKILL.md +322 -0
  140. package/.versions/0.3.3/skills/git-workflow-and-versioning/SKILL.md +316 -0
  141. package/.versions/0.3.3/skills/guided-workspace-setup/SKILL.md +345 -0
  142. package/.versions/0.3.3/skills/idea-refine/SKILL.md +178 -0
  143. package/.versions/0.3.3/skills/idea-refine/examples.md +238 -0
  144. package/.versions/0.3.3/skills/idea-refine/frameworks.md +99 -0
  145. package/.versions/0.3.3/skills/idea-refine/refinement-criteria.md +113 -0
  146. package/.versions/0.3.3/skills/idea-refine/scripts/idea-refine.sh +15 -0
  147. package/.versions/0.3.3/skills/incremental-implementation/SKILL.md +279 -0
  148. package/.versions/0.3.3/skills/performance-optimization/SKILL.md +350 -0
  149. package/.versions/0.3.3/skills/planning-and-task-breakdown/SKILL.md +237 -0
  150. package/.versions/0.3.3/skills/security-and-hardening/SKILL.md +349 -0
  151. package/.versions/0.3.3/skills/shipping-and-launch/SKILL.md +309 -0
  152. package/.versions/0.3.3/skills/source-driven-development/SKILL.md +194 -0
  153. package/.versions/0.3.3/skills/spec-driven-development/SKILL.md +237 -0
  154. package/.versions/0.3.3/skills/test-driven-development/SKILL.md +379 -0
  155. package/.versions/0.3.3/skills/using-agent-skills/SKILL.md +176 -0
  156. package/CHANGELOG.md +17 -0
  157. package/bin/snapshot-version.js +8 -1
  158. package/package.json +2 -1
  159. package/scripts/coms-net-server.ts +1741 -0
@@ -0,0 +1,322 @@
1
+ ---
2
+ name: frontend-ui-engineering
3
+ description: Builds production-quality UIs. Use when building or modifying user-facing interfaces. Use when creating components, implementing layouts, managing state, or when the output needs to look and feel production-quality rather than AI-generated.
4
+ ---
5
+
6
+ # Frontend UI Engineering
7
+
8
+ ## Overview
9
+
10
+ Build production-quality user interfaces that are accessible, performant, and visually polished. The goal is UI that looks like it was built by a design-aware engineer at a top company — not like it was generated by an AI. This means real design system adherence, proper accessibility, thoughtful interaction patterns, and no generic "AI aesthetic."
11
+
12
+ ## When to Use
13
+
14
+ - Building new UI components or pages
15
+ - Modifying existing user-facing interfaces
16
+ - Implementing responsive layouts
17
+ - Adding interactivity or state management
18
+ - Fixing visual or UX issues
19
+
20
+ ## Component Architecture
21
+
22
+ ### File Structure
23
+
24
+ Colocate everything related to a component:
25
+
26
+ ```
27
+ src/components/
28
+ TaskList/
29
+ TaskList.tsx # Component implementation
30
+ TaskList.test.tsx # Tests
31
+ TaskList.stories.tsx # Storybook stories (if using)
32
+ use-task-list.ts # Custom hook (if complex state)
33
+ types.ts # Component-specific types (if needed)
34
+ ```
35
+
36
+ ### Component Patterns
37
+
38
+ **Prefer composition over configuration:**
39
+
40
+ ```tsx
41
+ // Good: Composable
42
+ <Card>
43
+ <CardHeader>
44
+ <CardTitle>Tasks</CardTitle>
45
+ </CardHeader>
46
+ <CardBody>
47
+ <TaskList tasks={tasks} />
48
+ </CardBody>
49
+ </Card>
50
+
51
+ // Avoid: Over-configured
52
+ <Card
53
+ title="Tasks"
54
+ headerVariant="large"
55
+ bodyPadding="md"
56
+ content={<TaskList tasks={tasks} />}
57
+ />
58
+ ```
59
+
60
+ **Keep components focused:**
61
+
62
+ ```tsx
63
+ // Good: Does one thing
64
+ export function TaskItem({ task, onToggle, onDelete }: TaskItemProps) {
65
+ return (
66
+ <li className="flex items-center gap-3 p-3">
67
+ <Checkbox checked={task.done} onChange={() => onToggle(task.id)} />
68
+ <span className={task.done ? 'line-through text-muted' : ''}>{task.title}</span>
69
+ <Button variant="ghost" size="sm" onClick={() => onDelete(task.id)}>
70
+ <TrashIcon />
71
+ </Button>
72
+ </li>
73
+ );
74
+ }
75
+ ```
76
+
77
+ **Separate data fetching from presentation:**
78
+
79
+ ```tsx
80
+ // Container: handles data
81
+ export function TaskListContainer() {
82
+ const { tasks, isLoading, error } = useTasks();
83
+
84
+ if (isLoading) return <TaskListSkeleton />;
85
+ if (error) return <ErrorState message="Failed to load tasks" retry={refetch} />;
86
+ if (tasks.length === 0) return <EmptyState message="No tasks yet" />;
87
+
88
+ return <TaskList tasks={tasks} />;
89
+ }
90
+
91
+ // Presentation: handles rendering
92
+ export function TaskList({ tasks }: { tasks: Task[] }) {
93
+ return (
94
+ <ul role="list" className="divide-y">
95
+ {tasks.map(task => <TaskItem key={task.id} task={task} />)}
96
+ </ul>
97
+ );
98
+ }
99
+ ```
100
+
101
+ ## State Management
102
+
103
+ **Choose the simplest approach that works:**
104
+
105
+ ```
106
+ Local state (useState) → Component-specific UI state
107
+ Lifted state → Shared between 2-3 sibling components
108
+ Context → Theme, auth, locale (read-heavy, write-rare)
109
+ URL state (searchParams) → Filters, pagination, shareable UI state
110
+ Server state (React Query, SWR) → Remote data with caching
111
+ Global store (Zustand, Redux) → Complex client state shared app-wide
112
+ ```
113
+
114
+ **Avoid prop drilling deeper than 3 levels.** If you're passing props through components that don't use them, introduce context or restructure the component tree.
115
+
116
+ ## Design System Adherence
117
+
118
+ ### Avoid the AI Aesthetic
119
+
120
+ AI-generated UI has recognizable patterns. Avoid all of them:
121
+
122
+ | AI Default | Why It Is a Problem | Production Quality |
123
+ |---|---|---|
124
+ | Purple/indigo everything | Models default to visually "safe" palettes, making every app look identical | Use the project's actual color palette |
125
+ | Excessive gradients | Gradients add visual noise and clash with most design systems | Flat or subtle gradients matching the design system |
126
+ | Rounded everything (rounded-2xl) | Maximum rounding signals "friendly" but ignores the hierarchy of corner radii in real designs | Consistent border-radius from the design system |
127
+ | Generic hero sections | Template-driven layout with no connection to the actual content or user need | Content-first layouts |
128
+ | Lorem ipsum-style copy | Placeholder text hides layout problems that real content reveals (length, wrapping, overflow) | Realistic placeholder content |
129
+ | Oversized padding everywhere | Equal generous padding destroys visual hierarchy and wastes screen space | Consistent spacing scale |
130
+ | Stock card grids | Uniform grids are a layout shortcut that ignores information priority and scanning patterns | Purpose-driven layouts |
131
+ | Shadow-heavy design | Layered shadows add depth that competes with content and slows rendering on low-end devices | Subtle or no shadows unless the design system specifies |
132
+
133
+ ### Spacing and Layout
134
+
135
+ Use a consistent spacing scale. Don't invent values:
136
+
137
+ ```css
138
+ /* Use the scale: 0.25rem increments (or whatever the project uses) */
139
+ /* Good */ padding: 1rem; /* 16px */
140
+ /* Good */ gap: 0.75rem; /* 12px */
141
+ /* Bad */ padding: 13px; /* Not on any scale */
142
+ /* Bad */ margin-top: 2.3rem; /* Not on any scale */
143
+ ```
144
+
145
+ ### Typography
146
+
147
+ Respect the type hierarchy:
148
+
149
+ ```
150
+ h1 → Page title (one per page)
151
+ h2 → Section title
152
+ h3 → Subsection title
153
+ body → Default text
154
+ small → Secondary/helper text
155
+ ```
156
+
157
+ Don't skip heading levels. Don't use heading styles for non-heading content.
158
+
159
+ ### Color
160
+
161
+ - Use semantic color tokens: `text-primary`, `bg-surface`, `border-default` — not raw hex values
162
+ - Ensure sufficient contrast (4.5:1 for normal text, 3:1 for large text)
163
+ - Don't rely solely on color to convey information (use icons, text, or patterns too)
164
+
165
+ ## Accessibility (WCAG 2.1 AA)
166
+
167
+ Every component must meet these standards:
168
+
169
+ ### Keyboard Navigation
170
+
171
+ ```tsx
172
+ // Every interactive element must be keyboard accessible
173
+ <button onClick={handleClick}>Click me</button> // ✓ Focusable by default
174
+ <div onClick={handleClick}>Click me</div> // ✗ Not focusable
175
+ <div role="button" tabIndex={0} onClick={handleClick} // ✓ But prefer <button>
176
+ onKeyDown={e => e.key === 'Enter' && handleClick()}>
177
+ Click me
178
+ </div>
179
+ ```
180
+
181
+ ### ARIA Labels
182
+
183
+ ```tsx
184
+ // Label interactive elements that lack visible text
185
+ <button aria-label="Close dialog"><XIcon /></button>
186
+
187
+ // Label form inputs
188
+ <label htmlFor="email">Email</label>
189
+ <input id="email" type="email" />
190
+
191
+ // Or use aria-label when no visible label exists
192
+ <input aria-label="Search tasks" type="search" />
193
+ ```
194
+
195
+ ### Focus Management
196
+
197
+ ```tsx
198
+ // Move focus when content changes
199
+ function Dialog({ isOpen, onClose }: DialogProps) {
200
+ const closeRef = useRef<HTMLButtonElement>(null);
201
+
202
+ useEffect(() => {
203
+ if (isOpen) closeRef.current?.focus();
204
+ }, [isOpen]);
205
+
206
+ // Trap focus inside dialog when open
207
+ return (
208
+ <dialog open={isOpen}>
209
+ <button ref={closeRef} onClick={onClose}>Close</button>
210
+ {/* dialog content */}
211
+ </dialog>
212
+ );
213
+ }
214
+ ```
215
+
216
+ ### Meaningful Empty and Error States
217
+
218
+ ```tsx
219
+ // Don't show blank screens
220
+ function TaskList({ tasks }: { tasks: Task[] }) {
221
+ if (tasks.length === 0) {
222
+ return (
223
+ <div role="status" className="text-center py-12">
224
+ <TasksEmptyIcon className="mx-auto h-12 w-12 text-muted" />
225
+ <h3 className="mt-2 text-sm font-medium">No tasks</h3>
226
+ <p className="mt-1 text-sm text-muted">Get started by creating a new task.</p>
227
+ <Button className="mt-4" onClick={onCreateTask}>Create Task</Button>
228
+ </div>
229
+ );
230
+ }
231
+
232
+ return <ul role="list">...</ul>;
233
+ }
234
+ ```
235
+
236
+ ## Responsive Design
237
+
238
+ Design for mobile first, then expand:
239
+
240
+ ```tsx
241
+ // Tailwind: mobile-first responsive
242
+ <div className="
243
+ grid grid-cols-1 /* Mobile: single column */
244
+ sm:grid-cols-2 /* Small: 2 columns */
245
+ lg:grid-cols-3 /* Large: 3 columns */
246
+ gap-4
247
+ ">
248
+ ```
249
+
250
+ Test at these breakpoints: 320px, 768px, 1024px, 1440px.
251
+
252
+ ## Loading and Transitions
253
+
254
+ ```tsx
255
+ // Skeleton loading (not spinners for content)
256
+ function TaskListSkeleton() {
257
+ return (
258
+ <div className="space-y-3" aria-busy="true" aria-label="Loading tasks">
259
+ {Array.from({ length: 3 }).map((_, i) => (
260
+ <div key={i} className="h-12 bg-muted animate-pulse rounded" />
261
+ ))}
262
+ </div>
263
+ );
264
+ }
265
+
266
+ // Optimistic updates for perceived speed
267
+ function useToggleTask() {
268
+ const queryClient = useQueryClient();
269
+
270
+ return useMutation({
271
+ mutationFn: toggleTask,
272
+ onMutate: async (taskId) => {
273
+ await queryClient.cancelQueries({ queryKey: ['tasks'] });
274
+ const previous = queryClient.getQueryData(['tasks']);
275
+
276
+ queryClient.setQueryData(['tasks'], (old: Task[]) =>
277
+ old.map(t => t.id === taskId ? { ...t, done: !t.done } : t)
278
+ );
279
+
280
+ return { previous };
281
+ },
282
+ onError: (_err, _taskId, context) => {
283
+ queryClient.setQueryData(['tasks'], context?.previous);
284
+ },
285
+ });
286
+ }
287
+ ```
288
+
289
+ ## See Also
290
+
291
+ For detailed accessibility requirements and testing tools, see `references/accessibility-checklist.md`.
292
+
293
+ ## Common Rationalizations
294
+
295
+ | Rationalization | Reality |
296
+ |---|---|
297
+ | "Accessibility is a nice-to-have" | It's a legal requirement in many jurisdictions and an engineering quality standard. |
298
+ | "We'll make it responsive later" | Retrofitting responsive design is 3x harder than building it from the start. |
299
+ | "The design isn't final, so I'll skip styling" | Use the design system defaults. Unstyled UI creates a broken first impression for reviewers. |
300
+ | "This is just a prototype" | Prototypes become production code. Build the foundation right. |
301
+ | "The AI aesthetic is fine for now" | It signals low quality. Use the project's actual design system from the start. |
302
+
303
+ ## Red Flags
304
+
305
+ - Components with more than 200 lines (split them)
306
+ - Inline styles or arbitrary pixel values
307
+ - Missing error states, loading states, or empty states
308
+ - No keyboard navigation testing
309
+ - Color as the sole indicator of state (red/green without text or icons)
310
+ - Generic "AI look" (purple gradients, oversized cards, stock layouts)
311
+
312
+ ## Verification
313
+
314
+ After building UI:
315
+
316
+ - [ ] Component renders without console errors
317
+ - [ ] All interactive elements are keyboard accessible (Tab through the page)
318
+ - [ ] Screen reader can convey the page's content and structure
319
+ - [ ] Responsive: works at 320px, 768px, 1024px, 1440px
320
+ - [ ] Loading, error, and empty states all handled
321
+ - [ ] Follows the project's design system (spacing, colors, typography)
322
+ - [ ] No accessibility warnings in dev tools or axe-core
@@ -0,0 +1,316 @@
1
+ ---
2
+ name: git-workflow-and-versioning
3
+ description: Structures git workflow practices. Use when making any code change. Use when committing, branching, resolving conflicts, or when you need to organize work across multiple parallel streams.
4
+ ---
5
+
6
+ # Git Workflow and Versioning
7
+
8
+ ## Overview
9
+
10
+ Git is your safety net. Treat commits as save points, branches as sandboxes, and history as documentation. With AI agents generating code at high speed, disciplined version control is the mechanism that keeps changes manageable, reviewable, and reversible.
11
+
12
+ ## When to Use
13
+
14
+ Always. Every code change flows through git.
15
+
16
+ ## Agent Operating Rule: Stay on the Current Branch
17
+
18
+ **The agent does not create, switch, or delete branches.** Branch selection belongs to the human — they check out the branch they want before handing work to the agent. Work in whatever branch is currently checked out.
19
+
20
+ - If the current branch looks unsuitable for the change (for example, you are on `main`/`master` and the change is not a trivial one), **stop and tell the user** so they can create the branch. Do not create it for them.
21
+ - You may still split work into separate atomic commits on the current branch — and you *should* propose that whenever a change mixes concerns.
22
+ - Worktrees are a human-initiated technique for parallel work (see [Working with Worktrees](#working-with-worktrees)); setting them up is not an agent action under this skill.
23
+
24
+ The branching material below — trunk-based development, feature branches, naming — is **reference guidance for humans** deciding how to organize work. It is not a license for the agent to create branches.
25
+
26
+ **Project overrides:** if `.ai/agent-skills-overrides.md` has a `## git-workflow-and-versioning` section with `branching: allow`, the agent may create feature branches following the naming guidance below. The default is `branching: never`. See [docs/agent-skills-setup.md](../../docs/agent-skills-setup.md).
27
+
28
+ ## Core Principles
29
+
30
+ ### Trunk-Based Development (Recommended)
31
+
32
+ Keep `main` always deployable. Work in short-lived feature branches that merge back within 1-3 days. Long-lived development branches are hidden costs — they diverge, create merge conflicts, and delay integration. DORA research consistently shows trunk-based development correlates with high-performing engineering teams.
33
+
34
+ ```
35
+ main ──●──●──●──●──●──●──●──●──●── (always deployable)
36
+ ╲ ╱ ╲ ╱
37
+ ●──●─╱ ●──╱ ← short-lived feature branches (1-3 days)
38
+ ```
39
+
40
+ This is the recommended default. Teams using gitflow or long-lived branches can adapt the principles (atomic commits, small changes, descriptive messages) to their branching model — the commit discipline matters more than the specific branching strategy.
41
+
42
+ - **Dev branches are costs.** Every day a branch lives, it accumulates merge risk.
43
+ - **Release branches are acceptable.** When you need to stabilize a release while main moves forward.
44
+ - **Feature flags > long branches.** Prefer deploying incomplete work behind flags rather than keeping it on a branch for weeks.
45
+
46
+ ### 1. Commit Early, Commit Often
47
+
48
+ Each successful increment gets its own commit. Don't accumulate large uncommitted changes.
49
+
50
+ ```
51
+ Work pattern:
52
+ Implement slice → Test → Verify → Commit → Next slice
53
+
54
+ Not this:
55
+ Implement everything → Hope it works → Giant commit
56
+ ```
57
+
58
+ Commits are save points. If the next change breaks something, you can revert to the last known-good state instantly.
59
+
60
+ ### 2. Atomic Commits
61
+
62
+ Each commit does one logical thing:
63
+
64
+ ```
65
+ # Good: Each commit is self-contained
66
+ git log --oneline
67
+ a1b2c3d Add task creation endpoint with validation
68
+ d4e5f6g Add task creation form component
69
+ h7i8j9k Connect form to API and add loading state
70
+ m1n2o3p Add task creation tests (unit + integration)
71
+
72
+ # Bad: Everything mixed together
73
+ git log --oneline
74
+ x1y2z3a Add task feature, fix sidebar, update deps, refactor utils
75
+ ```
76
+
77
+ ### 3. Descriptive Messages
78
+
79
+ Commit messages explain the *why*, not just the *what*:
80
+
81
+ ```
82
+ # Good: Explains intent
83
+ feat: add email validation to registration endpoint
84
+
85
+ Prevents invalid email formats from reaching the database.
86
+ Uses Zod schema validation at the route handler level,
87
+ consistent with existing validation patterns in auth.ts.
88
+
89
+ # Bad: Describes what's obvious from the diff
90
+ update auth.ts
91
+ ```
92
+
93
+ **Format:**
94
+ ```
95
+ <type>: <short description>
96
+
97
+ <optional body explaining why, not what>
98
+ ```
99
+
100
+ **Types:**
101
+ - `feat` — New feature
102
+ - `fix` — Bug fix
103
+ - `refactor` — Code change that neither fixes a bug nor adds a feature
104
+ - `test` — Adding or updating tests
105
+ - `docs` — Documentation only
106
+ - `chore` — Tooling, dependencies, config
107
+
108
+ ### 4. Keep Concerns Separate
109
+
110
+ Don't combine formatting changes with behavior changes. Don't combine refactors with features. Each type of change should be a separate commit — and ideally a separate PR:
111
+
112
+ ```
113
+ # Good: Separate concerns
114
+ git commit -m "refactor: extract validation logic to shared utility"
115
+ git commit -m "feat: add phone number validation to registration"
116
+
117
+ # Bad: Mixed concerns
118
+ git commit -m "refactor validation and add phone number field"
119
+ ```
120
+
121
+ **Separate refactoring from feature work.** A refactoring change and a feature change are two different changes — submit them separately. This makes each change easier to review, revert, and understand in history. Small cleanups (renaming a variable) can be included in a feature commit at reviewer discretion.
122
+
123
+ ### 5. Size Your Changes
124
+
125
+ Target ~100 lines per commit/PR. Changes over ~1000 lines should be split. See the splitting strategies in `code-review-and-quality` for how to break down large changes.
126
+
127
+ ```
128
+ ~100 lines → Easy to review, easy to revert
129
+ ~300 lines → Acceptable for a single logical change
130
+ ~1000 lines → Split into smaller changes
131
+ ```
132
+
133
+ ## Branching Strategy
134
+
135
+ > Reference guidance for humans organizing work. Per the [Agent Operating Rule](#agent-operating-rule-stay-on-the-current-branch), the agent does not create or switch branches unless the project opts in with `branching: allow`.
136
+
137
+ ### Feature Branches
138
+
139
+ ```
140
+ main (always deployable)
141
+
142
+ ├── feature/task-creation ← One feature per branch
143
+ ├── feature/user-settings ← Parallel work
144
+ └── fix/duplicate-tasks ← Bug fixes
145
+ ```
146
+
147
+ - Branch from `main` (or the team's default branch)
148
+ - Keep branches short-lived (merge within 1-3 days) — long-lived branches are hidden costs
149
+ - Delete branches after merge
150
+ - Prefer feature flags over long-lived branches for incomplete features
151
+
152
+ ### Branch Naming
153
+
154
+ ```
155
+ feature/<short-description> → feature/task-creation
156
+ fix/<short-description> → fix/duplicate-tasks
157
+ chore/<short-description> → chore/update-deps
158
+ refactor/<short-description> → refactor/auth-module
159
+ ```
160
+
161
+ ## Working with Worktrees
162
+
163
+ > Human-initiated setup for parallel work — not an agent action under this skill.
164
+
165
+ For parallel AI agent work, use git worktrees to run multiple branches simultaneously:
166
+
167
+ ```bash
168
+ # Create a worktree for a feature branch
169
+ git worktree add ../project-feature-a feature/task-creation
170
+ git worktree add ../project-feature-b feature/user-settings
171
+
172
+ # Each worktree is a separate directory with its own branch
173
+ # Agents can work in parallel without interfering
174
+ ls ../
175
+ project/ ← main branch
176
+ project-feature-a/ ← task-creation branch
177
+ project-feature-b/ ← user-settings branch
178
+
179
+ # When done, merge and clean up
180
+ git worktree remove ../project-feature-a
181
+ ```
182
+
183
+ Benefits:
184
+ - Multiple agents can work on different features simultaneously
185
+ - No branch switching needed (each directory has its own branch)
186
+ - If one experiment fails, delete the worktree — nothing is lost
187
+ - Changes are isolated until explicitly merged
188
+
189
+ ## The Save Point Pattern
190
+
191
+ ```
192
+ Agent starts work
193
+
194
+ ├── Makes a change
195
+ │ ├── Test passes? → Commit → Continue
196
+ │ └── Test fails? → Revert to last commit → Investigate
197
+
198
+ ├── Makes another change
199
+ │ ├── Test passes? → Commit → Continue
200
+ │ └── Test fails? → Revert to last commit → Investigate
201
+
202
+ └── Feature complete → All commits form a clean history
203
+ ```
204
+
205
+ This pattern means you never lose more than one increment of work. If an agent goes off the rails, `git reset --hard HEAD` takes you back to the last successful state.
206
+
207
+ ## Change Summaries
208
+
209
+ After any modification, provide a structured summary. This makes review easier, documents scope discipline, and surfaces unintended changes:
210
+
211
+ ```
212
+ CHANGES MADE:
213
+ - src/routes/tasks.ts: Added validation middleware to POST endpoint
214
+ - src/lib/validation.ts: Added TaskCreateSchema using Zod
215
+
216
+ THINGS I DIDN'T TOUCH (intentionally):
217
+ - src/routes/auth.ts: Has similar validation gap but out of scope
218
+ - src/middleware/error.ts: Error format could be improved (separate task)
219
+
220
+ POTENTIAL CONCERNS:
221
+ - The Zod schema is strict — rejects extra fields. Confirm this is desired.
222
+ - Added zod as a dependency (72KB gzipped) — already in package.json
223
+ ```
224
+
225
+ This pattern catches wrong assumptions early and gives reviewers a clear map of the change. The "DIDN'T TOUCH" section is especially important — it shows you exercised scope discipline and didn't go on an unsolicited renovation.
226
+
227
+ ## Pre-Commit Hygiene
228
+
229
+ Before every commit:
230
+
231
+ ```bash
232
+ # 1. Check what you're about to commit
233
+ git diff --staged
234
+
235
+ # 2. Ensure no secrets
236
+ git diff --staged | grep -i "password\|secret\|api_key\|token"
237
+
238
+ # 3. Run tests
239
+ npm test
240
+
241
+ # 4. Run linting
242
+ npm run lint
243
+
244
+ # 5. Run type checking
245
+ npx tsc --noEmit
246
+ ```
247
+
248
+ Automate this with git hooks:
249
+
250
+ ```json
251
+ // package.json (using lint-staged + husky)
252
+ {
253
+ "lint-staged": {
254
+ "*.{ts,tsx}": ["eslint --fix", "prettier --write"],
255
+ "*.{json,md}": ["prettier --write"]
256
+ }
257
+ }
258
+ ```
259
+
260
+ ## Handling Generated Files
261
+
262
+ - **Commit generated files** only if the project expects them (e.g., `package-lock.json`, Prisma migrations)
263
+ - **Don't commit** build output (`dist/`, `.next/`), environment files (`.env`), or IDE config (`.vscode/settings.json` unless shared)
264
+ - **Have a `.gitignore`** that covers: `node_modules/`, `dist/`, `.env`, `.env.local`, `*.pem`
265
+
266
+ ## Using Git for Debugging
267
+
268
+ ```bash
269
+ # Find which commit introduced a bug
270
+ git bisect start
271
+ git bisect bad HEAD
272
+ git bisect good <known-good-commit>
273
+ # Git checkouts midpoints; run your test at each to narrow down
274
+
275
+ # View what changed recently
276
+ git log --oneline -20
277
+ git diff HEAD~5..HEAD -- src/
278
+
279
+ # Find who last changed a specific line
280
+ git blame src/services/task.ts
281
+
282
+ # Search commit messages for a keyword
283
+ git log --grep="validation" --oneline
284
+ ```
285
+
286
+ ## Common Rationalizations
287
+
288
+ | Rationalization | Reality |
289
+ |---|---|
290
+ | "I'll commit when the feature is done" | One giant commit is impossible to review, debug, or revert. Commit each slice. |
291
+ | "The message doesn't matter" | Messages are documentation. Future you (and future agents) will need to understand what changed and why. |
292
+ | "I'll squash it all later" | Squashing destroys the development narrative. Prefer clean incremental commits from the start. |
293
+ | "Branches add overhead" | Short-lived branches are free and prevent conflicting work from colliding. Long-lived branches are the problem — merge within 1-3 days. |
294
+ | "I'll split this change later" | Large changes are harder to review, riskier to deploy, and harder to revert. Split before submitting, not after. |
295
+ | "I don't need a .gitignore" | Until `.env` with production secrets gets committed. Set it up immediately. |
296
+
297
+ ## Red Flags
298
+
299
+ - Large uncommitted changes accumulating
300
+ - Commit messages like "fix", "update", "misc"
301
+ - Formatting changes mixed with behavior changes
302
+ - No `.gitignore` in the project
303
+ - Committing `node_modules/`, `.env`, or build artifacts
304
+ - Long-lived branches that diverge significantly from main
305
+ - Force-pushing to shared branches
306
+
307
+ ## Verification
308
+
309
+ For every commit:
310
+
311
+ - [ ] Commit does one logical thing
312
+ - [ ] Message explains the why, follows type conventions
313
+ - [ ] Tests pass before committing
314
+ - [ ] No secrets in the diff
315
+ - [ ] No formatting-only changes mixed with behavior changes
316
+ - [ ] `.gitignore` covers standard exclusions