devflow-kit 1.0.0 → 1.2.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/CHANGELOG.md +69 -0
- package/README.md +35 -11
- package/dist/cli.js +5 -1
- package/dist/commands/ambient.d.ts +18 -0
- package/dist/commands/ambient.js +136 -0
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.js +97 -10
- package/dist/commands/memory.d.ts +22 -0
- package/dist/commands/memory.js +175 -0
- package/dist/commands/uninstall.js +72 -5
- package/dist/plugins.js +74 -3
- package/dist/utils/post-install.d.ts +12 -0
- package/dist/utils/post-install.js +82 -1
- package/dist/utils/safe-delete-install.d.ts +7 -0
- package/dist/utils/safe-delete-install.js +40 -5
- package/package.json +2 -1
- package/plugins/devflow-accessibility/.claude-plugin/plugin.json +15 -0
- package/plugins/devflow-ambient/.claude-plugin/plugin.json +7 -0
- package/plugins/devflow-ambient/README.md +49 -0
- package/plugins/devflow-ambient/commands/ambient.md +110 -0
- package/plugins/devflow-ambient/skills/ambient-router/SKILL.md +89 -0
- package/plugins/devflow-ambient/skills/ambient-router/references/skill-catalog.md +68 -0
- package/plugins/devflow-audit-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/devflow-code-review/.claude-plugin/plugin.json +1 -4
- package/plugins/devflow-code-review/agents/reviewer.md +8 -0
- package/plugins/devflow-code-review/commands/code-review-teams.md +11 -1
- package/plugins/devflow-code-review/commands/code-review.md +12 -2
- package/plugins/devflow-core-skills/.claude-plugin/plugin.json +3 -6
- package/plugins/devflow-core-skills/skills/docs-framework/SKILL.md +10 -6
- package/plugins/devflow-core-skills/skills/test-driven-development/SKILL.md +139 -0
- package/plugins/devflow-core-skills/skills/test-driven-development/references/rationalization-prevention.md +111 -0
- package/plugins/devflow-debug/.claude-plugin/plugin.json +1 -1
- package/plugins/devflow-frontend-design/.claude-plugin/plugin.json +15 -0
- package/plugins/devflow-go/.claude-plugin/plugin.json +15 -0
- package/plugins/devflow-go/skills/go/SKILL.md +187 -0
- package/plugins/devflow-go/skills/go/references/concurrency.md +312 -0
- package/plugins/devflow-go/skills/go/references/detection.md +129 -0
- package/plugins/devflow-go/skills/go/references/patterns.md +232 -0
- package/plugins/devflow-go/skills/go/references/violations.md +205 -0
- package/plugins/devflow-implement/.claude-plugin/plugin.json +1 -3
- package/plugins/devflow-implement/agents/coder.md +11 -6
- package/plugins/devflow-java/.claude-plugin/plugin.json +15 -0
- package/plugins/devflow-java/skills/java/SKILL.md +183 -0
- package/plugins/devflow-java/skills/java/references/detection.md +120 -0
- package/plugins/devflow-java/skills/java/references/modern-java.md +270 -0
- package/plugins/devflow-java/skills/java/references/patterns.md +235 -0
- package/plugins/devflow-java/skills/java/references/violations.md +213 -0
- package/plugins/devflow-python/.claude-plugin/plugin.json +15 -0
- package/plugins/devflow-python/skills/python/SKILL.md +188 -0
- package/plugins/devflow-python/skills/python/references/async.md +220 -0
- package/plugins/devflow-python/skills/python/references/detection.md +128 -0
- package/plugins/devflow-python/skills/python/references/patterns.md +226 -0
- package/plugins/devflow-python/skills/python/references/violations.md +204 -0
- package/plugins/devflow-react/.claude-plugin/plugin.json +15 -0
- package/plugins/{devflow-core-skills → devflow-react}/skills/react/SKILL.md +1 -1
- package/plugins/{devflow-core-skills → devflow-react}/skills/react/references/patterns.md +3 -3
- package/plugins/devflow-resolve/.claude-plugin/plugin.json +1 -1
- package/plugins/devflow-rust/.claude-plugin/plugin.json +15 -0
- package/plugins/devflow-rust/skills/rust/SKILL.md +193 -0
- package/plugins/devflow-rust/skills/rust/references/detection.md +131 -0
- package/plugins/devflow-rust/skills/rust/references/ownership.md +242 -0
- package/plugins/devflow-rust/skills/rust/references/patterns.md +210 -0
- package/plugins/devflow-rust/skills/rust/references/violations.md +191 -0
- package/plugins/devflow-self-review/.claude-plugin/plugin.json +1 -1
- package/plugins/devflow-specify/.claude-plugin/plugin.json +1 -1
- package/plugins/devflow-typescript/.claude-plugin/plugin.json +15 -0
- package/plugins/{devflow-core-skills → devflow-typescript}/skills/typescript/references/patterns.md +3 -3
- package/scripts/hooks/ambient-prompt.sh +48 -0
- package/scripts/hooks/background-memory-update.sh +49 -8
- package/scripts/hooks/ensure-memory-gitignore.sh +17 -0
- package/scripts/hooks/pre-compact-memory.sh +12 -6
- package/scripts/hooks/session-start-memory.sh +50 -8
- package/scripts/hooks/stop-update-memory.sh +10 -6
- package/shared/agents/coder.md +11 -6
- package/shared/agents/reviewer.md +8 -0
- package/shared/skills/ambient-router/SKILL.md +89 -0
- package/shared/skills/ambient-router/references/skill-catalog.md +68 -0
- package/shared/skills/docs-framework/SKILL.md +10 -6
- package/shared/skills/go/SKILL.md +187 -0
- package/shared/skills/go/references/concurrency.md +312 -0
- package/shared/skills/go/references/detection.md +129 -0
- package/shared/skills/go/references/patterns.md +232 -0
- package/shared/skills/go/references/violations.md +205 -0
- package/shared/skills/java/SKILL.md +183 -0
- package/shared/skills/java/references/detection.md +120 -0
- package/shared/skills/java/references/modern-java.md +270 -0
- package/shared/skills/java/references/patterns.md +235 -0
- package/shared/skills/java/references/violations.md +213 -0
- package/shared/skills/python/SKILL.md +188 -0
- package/shared/skills/python/references/async.md +220 -0
- package/shared/skills/python/references/detection.md +128 -0
- package/shared/skills/python/references/patterns.md +226 -0
- package/shared/skills/python/references/violations.md +204 -0
- package/shared/skills/react/SKILL.md +1 -1
- package/shared/skills/react/references/patterns.md +3 -3
- package/shared/skills/rust/SKILL.md +193 -0
- package/shared/skills/rust/references/detection.md +131 -0
- package/shared/skills/rust/references/ownership.md +242 -0
- package/shared/skills/rust/references/patterns.md +210 -0
- package/shared/skills/rust/references/violations.md +191 -0
- package/shared/skills/test-driven-development/SKILL.md +139 -0
- package/shared/skills/test-driven-development/references/rationalization-prevention.md +111 -0
- package/shared/skills/typescript/references/patterns.md +3 -3
- package/src/templates/managed-settings.json +14 -0
- package/plugins/devflow-code-review/skills/react/SKILL.md +0 -276
- package/plugins/devflow-code-review/skills/react/references/patterns.md +0 -1331
- package/plugins/devflow-core-skills/skills/accessibility/SKILL.md +0 -229
- package/plugins/devflow-core-skills/skills/accessibility/references/detection.md +0 -171
- package/plugins/devflow-core-skills/skills/accessibility/references/patterns.md +0 -670
- package/plugins/devflow-core-skills/skills/accessibility/references/violations.md +0 -419
- package/plugins/devflow-core-skills/skills/frontend-design/SKILL.md +0 -254
- package/plugins/devflow-core-skills/skills/frontend-design/references/detection.md +0 -184
- package/plugins/devflow-core-skills/skills/frontend-design/references/patterns.md +0 -511
- package/plugins/devflow-core-skills/skills/frontend-design/references/violations.md +0 -453
- package/plugins/devflow-core-skills/skills/react/references/violations.md +0 -565
- package/plugins/devflow-implement/skills/accessibility/SKILL.md +0 -229
- package/plugins/devflow-implement/skills/accessibility/references/detection.md +0 -171
- package/plugins/devflow-implement/skills/accessibility/references/patterns.md +0 -670
- package/plugins/devflow-implement/skills/accessibility/references/violations.md +0 -419
- package/plugins/devflow-implement/skills/frontend-design/SKILL.md +0 -254
- package/plugins/devflow-implement/skills/frontend-design/references/detection.md +0 -184
- package/plugins/devflow-implement/skills/frontend-design/references/patterns.md +0 -511
- package/plugins/devflow-implement/skills/frontend-design/references/violations.md +0 -453
- /package/plugins/{devflow-code-review → devflow-accessibility}/skills/accessibility/SKILL.md +0 -0
- /package/plugins/{devflow-code-review → devflow-accessibility}/skills/accessibility/references/detection.md +0 -0
- /package/plugins/{devflow-code-review → devflow-accessibility}/skills/accessibility/references/patterns.md +0 -0
- /package/plugins/{devflow-code-review → devflow-accessibility}/skills/accessibility/references/violations.md +0 -0
- /package/plugins/{devflow-code-review → devflow-frontend-design}/skills/frontend-design/SKILL.md +0 -0
- /package/plugins/{devflow-code-review → devflow-frontend-design}/skills/frontend-design/references/detection.md +0 -0
- /package/plugins/{devflow-code-review → devflow-frontend-design}/skills/frontend-design/references/patterns.md +0 -0
- /package/plugins/{devflow-code-review → devflow-frontend-design}/skills/frontend-design/references/violations.md +0 -0
- /package/plugins/{devflow-code-review → devflow-react}/skills/react/references/violations.md +0 -0
- /package/plugins/{devflow-core-skills → devflow-typescript}/skills/typescript/SKILL.md +0 -0
- /package/plugins/{devflow-core-skills → devflow-typescript}/skills/typescript/references/violations.md +0 -0
|
@@ -1,276 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: react
|
|
3
|
-
description: This skill should be used when the user works with React components (.tsx/.jsx), asks about "hooks", "state management", "context providers", "memo optimization", "useEffect", or discusses component composition and rendering performance. Provides patterns for hooks, state, effects, memoization, and React-specific architecture.
|
|
4
|
-
user-invocable: false
|
|
5
|
-
allowed-tools: Read, Grep, Glob
|
|
6
|
-
activation:
|
|
7
|
-
file-patterns:
|
|
8
|
-
- "**/*.tsx"
|
|
9
|
-
- "**/*.jsx"
|
|
10
|
-
exclude:
|
|
11
|
-
- "node_modules/**"
|
|
12
|
-
- "**/*.test.*"
|
|
13
|
-
- "**/*.spec.*"
|
|
14
|
-
---
|
|
15
|
-
|
|
16
|
-
# React Patterns
|
|
17
|
-
|
|
18
|
-
Reference for React-specific patterns, component design, hooks, and performance optimization.
|
|
19
|
-
|
|
20
|
-
## Iron Law
|
|
21
|
-
|
|
22
|
-
> **COMPOSITION OVER PROPS**
|
|
23
|
-
>
|
|
24
|
-
> Use children and compound components, not prop drilling. If a component has >5 props,
|
|
25
|
-
> it's doing too much. Split it. If you're passing data through 3+ levels, use context
|
|
26
|
-
> or composition. Props are for configuration, not data plumbing.
|
|
27
|
-
|
|
28
|
-
## When This Skill Activates
|
|
29
|
-
|
|
30
|
-
- Working with React codebases
|
|
31
|
-
- Creating components and hooks
|
|
32
|
-
- Managing state and side effects
|
|
33
|
-
- Optimizing render performance
|
|
34
|
-
|
|
35
|
-
---
|
|
36
|
-
|
|
37
|
-
## Component Patterns
|
|
38
|
-
|
|
39
|
-
### Functional Component Structure
|
|
40
|
-
|
|
41
|
-
```tsx
|
|
42
|
-
export function UserCard({ user, className }: UserCardProps) {
|
|
43
|
-
const [isExpanded, setIsExpanded] = useState(false); // 1. Hooks first
|
|
44
|
-
const displayName = user.firstName + ' ' + user.lastName; // 2. Derived state
|
|
45
|
-
const handleToggle = () => setIsExpanded((prev) => !prev); // 3. Handlers
|
|
46
|
-
return ( // 4. Render
|
|
47
|
-
<div className={cn('user-card', className)}>
|
|
48
|
-
<h3>{displayName}</h3>
|
|
49
|
-
{isExpanded && <UserDetails user={user} />}
|
|
50
|
-
<button onClick={handleToggle}>{isExpanded ? 'Collapse' : 'Expand'}</button>
|
|
51
|
-
</div>
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
### Composition Over Props
|
|
57
|
-
|
|
58
|
-
```tsx
|
|
59
|
-
function Card({ children }: { children: React.ReactNode }) {
|
|
60
|
-
return <div className="card">{children}</div>;
|
|
61
|
-
}
|
|
62
|
-
Card.Header = ({ children }) => <div className="card-header">{children}</div>;
|
|
63
|
-
Card.Body = ({ children }) => <div className="card-body">{children}</div>;
|
|
64
|
-
|
|
65
|
-
// Usage - flexible, not rigid props
|
|
66
|
-
<Card>
|
|
67
|
-
<Card.Header><h2>Title</h2></Card.Header>
|
|
68
|
-
<Card.Body><p>Content</p></Card.Body>
|
|
69
|
-
</Card>
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
---
|
|
73
|
-
|
|
74
|
-
## Hook Patterns
|
|
75
|
-
|
|
76
|
-
```tsx
|
|
77
|
-
function useLocalStorage<T>(key: string, initialValue: T) {
|
|
78
|
-
const [value, setValue] = useState<T>(() => {
|
|
79
|
-
const stored = localStorage.getItem(key);
|
|
80
|
-
return stored ? JSON.parse(stored) : initialValue;
|
|
81
|
-
});
|
|
82
|
-
useEffect(() => localStorage.setItem(key, JSON.stringify(value)), [key, value]);
|
|
83
|
-
return [value, setValue] as const;
|
|
84
|
-
}
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
---
|
|
88
|
-
|
|
89
|
-
## State Management
|
|
90
|
-
|
|
91
|
-
```tsx
|
|
92
|
-
const AuthContext = createContext<AuthContextValue | null>(null);
|
|
93
|
-
|
|
94
|
-
export function AuthProvider({ children }: { children: React.ReactNode }) {
|
|
95
|
-
const [user, setUser] = useState<User | null>(null);
|
|
96
|
-
const login = async (creds: Credentials) => setUser(await authApi.login(creds));
|
|
97
|
-
const logout = () => { authApi.logout(); setUser(null); };
|
|
98
|
-
return <AuthContext.Provider value={{ user, login, logout }}>{children}</AuthContext.Provider>;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export function useAuth() {
|
|
102
|
-
const ctx = useContext(AuthContext);
|
|
103
|
-
if (!ctx) throw new Error('useAuth must be used within AuthProvider');
|
|
104
|
-
return ctx;
|
|
105
|
-
}
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
---
|
|
109
|
-
|
|
110
|
-
## Performance
|
|
111
|
-
|
|
112
|
-
```tsx
|
|
113
|
-
function UserList({ users, filter }: { users: User[]; filter: string }) {
|
|
114
|
-
const filtered = useMemo(() => users.filter((u) => u.name.includes(filter)), [users, filter]);
|
|
115
|
-
const onClick = useCallback(() => console.log('Clicked'), []);
|
|
116
|
-
return <ul>{filtered.map((u) => <MemoItem key={u.id} user={u} onClick={onClick} />)}</ul>;
|
|
117
|
-
}
|
|
118
|
-
const MemoItem = memo(({ user }: { user: User }) => <li>{user.name}</li>);
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
---
|
|
122
|
-
|
|
123
|
-
## Async Parallelization
|
|
124
|
-
|
|
125
|
-
```tsx
|
|
126
|
-
// CORRECT: Independent fetches run in parallel
|
|
127
|
-
async function loadDashboard(userId: string) {
|
|
128
|
-
const [user, orders, preferences] = await Promise.all([
|
|
129
|
-
fetchUser(userId),
|
|
130
|
-
fetchOrders(userId),
|
|
131
|
-
fetchPreferences(userId),
|
|
132
|
-
]);
|
|
133
|
-
return { user, orders, preferences };
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
// VIOLATION: Sequential fetches (3x slower)
|
|
137
|
-
async function loadDashboardSlow(userId: string) {
|
|
138
|
-
const user = await fetchUser(userId);
|
|
139
|
-
const orders = await fetchOrders(userId);
|
|
140
|
-
const preferences = await fetchPreferences(userId);
|
|
141
|
-
return { user, orders, preferences };
|
|
142
|
-
}
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
---
|
|
146
|
-
|
|
147
|
-
## Bundle Size
|
|
148
|
-
|
|
149
|
-
```tsx
|
|
150
|
-
// CORRECT: Direct imports (tree-shakable)
|
|
151
|
-
import { Button } from '@/components/Button';
|
|
152
|
-
import { Card } from '@/components/Card';
|
|
153
|
-
|
|
154
|
-
// VIOLATION: Barrel imports (imports entire library)
|
|
155
|
-
import { Button, Card } from '@/components';
|
|
156
|
-
|
|
157
|
-
// CORRECT: Dynamic import for heavy components
|
|
158
|
-
const Chart = lazy(() => import('./Chart'));
|
|
159
|
-
const Editor = lazy(() => import('./Editor'));
|
|
160
|
-
|
|
161
|
-
function Dashboard() {
|
|
162
|
-
return (
|
|
163
|
-
<Suspense fallback={<Skeleton />}>
|
|
164
|
-
{showChart && <Chart data={data} />}
|
|
165
|
-
</Suspense>
|
|
166
|
-
);
|
|
167
|
-
}
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
---
|
|
171
|
-
|
|
172
|
-
## Re-render Optimization
|
|
173
|
-
|
|
174
|
-
```tsx
|
|
175
|
-
// CORRECT: Primitive deps (stable references)
|
|
176
|
-
useEffect(() => {
|
|
177
|
-
fetchData(userId, isActive);
|
|
178
|
-
}, [userId, isActive]); // primitives don't cause unnecessary runs
|
|
179
|
-
|
|
180
|
-
// VIOLATION: Object/array deps (new reference every render)
|
|
181
|
-
useEffect(() => {
|
|
182
|
-
fetchData(options);
|
|
183
|
-
}, [options]); // { page: 1 } !== { page: 1 }
|
|
184
|
-
|
|
185
|
-
// CORRECT: Stable callback with useCallback
|
|
186
|
-
const handleClick = useCallback((id: string) => {
|
|
187
|
-
setSelected(id);
|
|
188
|
-
}, []); // no deps = stable reference
|
|
189
|
-
|
|
190
|
-
// VIOLATION: Inline function (new reference every render)
|
|
191
|
-
<List onItemClick={(id) => setSelected(id)} />
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
---
|
|
195
|
-
|
|
196
|
-
## Image Optimization
|
|
197
|
-
|
|
198
|
-
```tsx
|
|
199
|
-
// CORRECT: Optimized image with all attributes
|
|
200
|
-
<img
|
|
201
|
-
src={url}
|
|
202
|
-
alt={description}
|
|
203
|
-
width={400}
|
|
204
|
-
height={300}
|
|
205
|
-
loading="lazy"
|
|
206
|
-
decoding="async"
|
|
207
|
-
style={{ aspectRatio: '4/3' }}
|
|
208
|
-
/>
|
|
209
|
-
|
|
210
|
-
// VIOLATION: Unoptimized image
|
|
211
|
-
<img src={url} /> // No dimensions, no lazy loading, layout shift
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
---
|
|
215
|
-
|
|
216
|
-
## Data Structure Performance
|
|
217
|
-
|
|
218
|
-
```tsx
|
|
219
|
-
// CORRECT: Set for O(1) membership checks
|
|
220
|
-
const selectedIds = new Set(selected);
|
|
221
|
-
const isSelected = (id: string) => selectedIds.has(id);
|
|
222
|
-
|
|
223
|
-
// VIOLATION: Array.includes is O(n)
|
|
224
|
-
const isSelected = (id: string) => selected.includes(id);
|
|
225
|
-
|
|
226
|
-
// CORRECT: Map for key-value lookups
|
|
227
|
-
const usersById = new Map(users.map(u => [u.id, u]));
|
|
228
|
-
const getUser = (id: string) => usersById.get(id);
|
|
229
|
-
|
|
230
|
-
// VIOLATION: Array.find is O(n)
|
|
231
|
-
const getUser = (id: string) => users.find(u => u.id === id);
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
---
|
|
235
|
-
|
|
236
|
-
## Anti-Patterns
|
|
237
|
-
|
|
238
|
-
```tsx
|
|
239
|
-
// BAD: Derived state in useState | GOOD: useMemo
|
|
240
|
-
const filtered = useMemo(() => items.filter(i => i.active), [items]);
|
|
241
|
-
|
|
242
|
-
// BAD: Missing dependency | GOOD: Include all deps
|
|
243
|
-
useEffect(() => { fetchData(userId); }, [userId]);
|
|
244
|
-
|
|
245
|
-
// BAD: State update in render | GOOD: Use effect
|
|
246
|
-
useEffect(() => { setState(value); }, [value]);
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
---
|
|
250
|
-
|
|
251
|
-
## Extended References
|
|
252
|
-
|
|
253
|
-
- `references/patterns.md` - Render props, reducers, virtualization, lazy loading
|
|
254
|
-
- `references/hooks.md` - useQuery, useDebouncedValue, usePrevious, useClickOutside
|
|
255
|
-
- `references/forms.md` - Controlled forms, validation hooks, multi-step forms
|
|
256
|
-
- `references/error-handling.md` - Error boundaries, async error handling
|
|
257
|
-
|
|
258
|
-
---
|
|
259
|
-
|
|
260
|
-
## Checklist
|
|
261
|
-
|
|
262
|
-
- [ ] Hooks at top level only
|
|
263
|
-
- [ ] All useEffect deps included
|
|
264
|
-
- [ ] useCallback for handlers passed to children
|
|
265
|
-
- [ ] useMemo for expensive computations
|
|
266
|
-
- [ ] Context at appropriate level
|
|
267
|
-
- [ ] Error boundaries around risky components
|
|
268
|
-
- [ ] Keys on list items (not index)
|
|
269
|
-
- [ ] Loading/error states handled
|
|
270
|
-
- [ ] Accessibility (aria-*, role)
|
|
271
|
-
- [ ] Independent fetches parallelized with Promise.all
|
|
272
|
-
- [ ] No barrel imports (direct imports for tree-shaking)
|
|
273
|
-
- [ ] Large components lazy-loaded
|
|
274
|
-
- [ ] Object/array deps avoided in useEffect (use primitives)
|
|
275
|
-
- [ ] Set/Map used for lookups instead of Array.includes/find
|
|
276
|
-
- [ ] Images have dimensions, lazy loading, and aspect-ratio
|