@musashishao/agent-kit 1.7.0 → 1.8.1
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/.agent/rules/CODEX.md +8 -7
- package/.agent/rules/CODE_RULES.md +15 -0
- package/.agent/rules/REFERENCE.md +7 -2
- package/.agent/skills/brainstorming/SKILL.md +52 -0
- package/.agent/skills/frontend-design/SKILL.md +30 -0
- package/.agent/skills/git-worktrees/SKILL.md +181 -0
- package/.agent/skills/parallel-agents/SKILL.md +89 -0
- package/.agent/skills/react-patterns/SKILL.md +31 -0
- package/.agent/skills/react-patterns/bundle-patterns.md +129 -0
- package/.agent/skills/react-patterns/rerender-patterns.md +163 -0
- package/.agent/skills/react-patterns/server-patterns.md +146 -0
- package/.agent/skills/react-patterns/waterfall-patterns.md +102 -0
- package/.agent/skills/reader-testing/SKILL.md +183 -0
- package/.agent/skills/verification-gate/SKILL.md +129 -0
- package/.agent/skills/web-interface-guidelines/SKILL.md +94 -0
- package/.agent/skills/web-interface-guidelines/animation.md +153 -0
- package/.agent/skills/web-interface-guidelines/anti-patterns.md +204 -0
- package/.agent/skills/web-interface-guidelines/focus-states.md +104 -0
- package/.agent/skills/web-interface-guidelines/forms.md +154 -0
- package/.agent/skills/web-interface-guidelines/touch-interaction.md +150 -0
- package/.agent/workflows/autofix.md +1 -1
- package/.agent/workflows/brainstorm.md +1 -1
- package/.agent/workflows/context.md +1 -1
- package/.agent/workflows/create.md +1 -1
- package/.agent/workflows/dashboard.md +1 -1
- package/.agent/workflows/debug.md +1 -1
- package/.agent/workflows/deploy.md +1 -1
- package/.agent/workflows/enhance.md +1 -1
- package/.agent/workflows/next.md +1 -1
- package/.agent/workflows/orchestrate.md +1 -1
- package/.agent/workflows/plan.md +1 -1
- package/.agent/workflows/preview.md +1 -1
- package/.agent/workflows/quality.md +1 -1
- package/.agent/workflows/spec.md +1 -1
- package/.agent/workflows/status.md +1 -1
- package/.agent/workflows/test.md +1 -1
- package/.agent/workflows/ui-ux-pro-max.md +1 -1
- package/README.md +3 -3
- package/package.json +1 -1
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# Re-render Patterns (MEDIUM)
|
|
2
|
+
|
|
3
|
+
> Optimize re-renders for smoother UX. Profile first, optimize second.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## rerender-memo
|
|
8
|
+
|
|
9
|
+
**Extract expensive work into memoized components.**
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
// ✅ Wrap expensive components
|
|
13
|
+
const ExpensiveList = memo(function ExpensiveList({ items }) {
|
|
14
|
+
return items.map(item => <Item key={item.id} {...item} />);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
// Use when:
|
|
18
|
+
// - Component re-renders often
|
|
19
|
+
// - Props rarely change
|
|
20
|
+
// - Rendering is expensive
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## rerender-functional-setstate
|
|
26
|
+
|
|
27
|
+
**Use functional setState for stable callbacks.**
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
// ❌ BAD: Needs count in dependencies
|
|
31
|
+
const increment = useCallback(() => {
|
|
32
|
+
setCount(count + 1);
|
|
33
|
+
}, [count]);
|
|
34
|
+
|
|
35
|
+
// ✅ GOOD: No dependencies needed
|
|
36
|
+
const increment = useCallback(() => {
|
|
37
|
+
setCount(c => c + 1);
|
|
38
|
+
}, []);
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## rerender-lazy-state-init
|
|
44
|
+
|
|
45
|
+
**Pass function to useState for expensive initial values.**
|
|
46
|
+
|
|
47
|
+
```tsx
|
|
48
|
+
// ❌ BAD: Runs on every render
|
|
49
|
+
const [data] = useState(expensiveCalc());
|
|
50
|
+
|
|
51
|
+
// ✅ GOOD: Runs only on mount
|
|
52
|
+
const [data] = useState(() => expensiveCalc());
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## rerender-derived-state
|
|
58
|
+
|
|
59
|
+
**Subscribe to derived booleans, not raw values.**
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
// ❌ BAD: Re-renders on every items change
|
|
63
|
+
const items = useStore(state => state.items);
|
|
64
|
+
const hasItems = items.length > 0;
|
|
65
|
+
|
|
66
|
+
// ✅ GOOD: Only re-renders when boolean changes
|
|
67
|
+
const hasItems = useStore(state => state.items.length > 0);
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## rerender-derived-state-no-effect
|
|
73
|
+
|
|
74
|
+
**Derive state during render, not in effects.**
|
|
75
|
+
|
|
76
|
+
```tsx
|
|
77
|
+
// ❌ BAD: Extra render cycle
|
|
78
|
+
const [filtered, setFiltered] = useState([]);
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
setFiltered(items.filter(filterFn));
|
|
81
|
+
}, [items]);
|
|
82
|
+
|
|
83
|
+
// ✅ GOOD: Computed during render
|
|
84
|
+
const filtered = useMemo(
|
|
85
|
+
() => items.filter(filterFn),
|
|
86
|
+
[items]
|
|
87
|
+
);
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## rerender-transitions
|
|
93
|
+
|
|
94
|
+
**Use startTransition for non-urgent updates.**
|
|
95
|
+
|
|
96
|
+
```tsx
|
|
97
|
+
// ✅ Keep UI responsive during heavy updates
|
|
98
|
+
const [isPending, startTransition] = useTransition();
|
|
99
|
+
|
|
100
|
+
const handleSearch = (query: string) => {
|
|
101
|
+
setQuery(query); // Urgent: update input
|
|
102
|
+
|
|
103
|
+
startTransition(() => {
|
|
104
|
+
setResults(search(query)); // Non-urgent: update list
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## rerender-use-ref-transient-values
|
|
112
|
+
|
|
113
|
+
**Use refs for transient frequent values.**
|
|
114
|
+
|
|
115
|
+
```tsx
|
|
116
|
+
// ❌ BAD: Re-renders on every mouse move
|
|
117
|
+
const [position, setPosition] = useState({ x: 0, y: 0 });
|
|
118
|
+
|
|
119
|
+
// ✅ GOOD: No re-renders, update DOM directly
|
|
120
|
+
const positionRef = useRef({ x: 0, y: 0 });
|
|
121
|
+
|
|
122
|
+
useEffect(() => {
|
|
123
|
+
const handle = (e) => {
|
|
124
|
+
positionRef.current = { x: e.clientX, y: e.clientY };
|
|
125
|
+
// Update DOM directly if needed
|
|
126
|
+
};
|
|
127
|
+
window.addEventListener('mousemove', handle);
|
|
128
|
+
return () => window.removeEventListener('mousemove', handle);
|
|
129
|
+
}, []);
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## rerender-move-effect-to-event
|
|
135
|
+
|
|
136
|
+
**Put interaction logic in event handlers, not effects.**
|
|
137
|
+
|
|
138
|
+
```tsx
|
|
139
|
+
// ❌ BAD: Effect for user action
|
|
140
|
+
useEffect(() => {
|
|
141
|
+
if (shouldSubmit) {
|
|
142
|
+
submit();
|
|
143
|
+
setShouldSubmit(false);
|
|
144
|
+
}
|
|
145
|
+
}, [shouldSubmit]);
|
|
146
|
+
|
|
147
|
+
// ✅ GOOD: Direct in handler
|
|
148
|
+
const handleClick = () => {
|
|
149
|
+
submit();
|
|
150
|
+
};
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## Quick Detection
|
|
156
|
+
|
|
157
|
+
| Signal | Pattern to Apply |
|
|
158
|
+
|--------|-----------------|
|
|
159
|
+
| Renders on typing | `startTransition` or debounce |
|
|
160
|
+
| Child re-renders when parent does | `memo` the child |
|
|
161
|
+
| Effect sets state from props | Derive during render |
|
|
162
|
+
| High-frequency updates | Use refs |
|
|
163
|
+
| Complex filtering | `useMemo` |
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# Server Patterns (HIGH)
|
|
2
|
+
|
|
3
|
+
> Server Components and caching patterns for optimal performance.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## server-cache-react
|
|
8
|
+
|
|
9
|
+
**Use React.cache() for per-request deduplication.**
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
// ✅ Dedupe within same request
|
|
13
|
+
import { cache } from 'react';
|
|
14
|
+
|
|
15
|
+
export const getUser = cache(async (id: string) => {
|
|
16
|
+
return db.user.findUnique({ where: { id } });
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
// Called multiple times in component tree = 1 DB query
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
| Caching Method | Scope | Use Case |
|
|
23
|
+
|----------------|-------|----------|
|
|
24
|
+
| `React.cache()` | Per-request | Same data in multiple components |
|
|
25
|
+
| `unstable_cache()` | Cross-request | Data shared between users |
|
|
26
|
+
| Data Cache | Persistent | fetch() with revalidate |
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## server-dedup-props
|
|
31
|
+
|
|
32
|
+
**Avoid duplicate serialization in RSC props.**
|
|
33
|
+
|
|
34
|
+
```tsx
|
|
35
|
+
// ❌ BAD: Passes full object to multiple children
|
|
36
|
+
<ChildA user={user} />
|
|
37
|
+
<ChildB user={user} />
|
|
38
|
+
<ChildC user={user} /> // user serialized 3x
|
|
39
|
+
|
|
40
|
+
// ✅ GOOD: Pass minimal data or use context
|
|
41
|
+
<UserProvider user={user}>
|
|
42
|
+
<ChildA />
|
|
43
|
+
<ChildB />
|
|
44
|
+
<ChildC />
|
|
45
|
+
</UserProvider>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## server-parallel-fetching
|
|
51
|
+
|
|
52
|
+
**Restructure components to parallelize fetches.**
|
|
53
|
+
|
|
54
|
+
```tsx
|
|
55
|
+
// ❌ BAD: Sequential in parent
|
|
56
|
+
async function Page() {
|
|
57
|
+
const user = await getUser();
|
|
58
|
+
const posts = await getPosts(user.id); // Waits for user
|
|
59
|
+
return <Content user={user} posts={posts} />;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// ✅ GOOD: Parallel with child components
|
|
63
|
+
async function Page() {
|
|
64
|
+
return (
|
|
65
|
+
<>
|
|
66
|
+
<Suspense><UserSection /></Suspense>
|
|
67
|
+
<Suspense><PostsSection /></Suspense>
|
|
68
|
+
</>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## server-after-nonblocking
|
|
76
|
+
|
|
77
|
+
**Use after() for non-blocking operations.**
|
|
78
|
+
|
|
79
|
+
```tsx
|
|
80
|
+
import { after } from 'next/server';
|
|
81
|
+
|
|
82
|
+
export async function POST(request: Request) {
|
|
83
|
+
const data = await request.json();
|
|
84
|
+
|
|
85
|
+
// Return response immediately
|
|
86
|
+
const result = await saveData(data);
|
|
87
|
+
|
|
88
|
+
// Log after response is sent
|
|
89
|
+
after(async () => {
|
|
90
|
+
await logAnalytics(data);
|
|
91
|
+
await sendNotification(data);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
return Response.json(result);
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## server-auth-actions
|
|
101
|
+
|
|
102
|
+
**Authenticate Server Actions like API routes.**
|
|
103
|
+
|
|
104
|
+
```tsx
|
|
105
|
+
'use server'
|
|
106
|
+
|
|
107
|
+
export async function updateProfile(formData: FormData) {
|
|
108
|
+
// ✅ Always verify auth in server actions
|
|
109
|
+
const session = await getSession();
|
|
110
|
+
if (!session) {
|
|
111
|
+
throw new Error('Unauthorized');
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// ✅ Validate input
|
|
115
|
+
const data = schema.parse(Object.fromEntries(formData));
|
|
116
|
+
|
|
117
|
+
return db.user.update({
|
|
118
|
+
where: { id: session.userId },
|
|
119
|
+
data
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## server-serialization
|
|
127
|
+
|
|
128
|
+
**Minimize data passed to client components.**
|
|
129
|
+
|
|
130
|
+
```tsx
|
|
131
|
+
// ❌ BAD: Passes entire object
|
|
132
|
+
<ClientComponent user={user} /> // Serializes all fields
|
|
133
|
+
|
|
134
|
+
// ✅ GOOD: Pass only needed fields
|
|
135
|
+
<ClientComponent
|
|
136
|
+
name={user.name}
|
|
137
|
+
avatar={user.avatar}
|
|
138
|
+
/>
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
| Rule | Why |
|
|
142
|
+
|------|-----|
|
|
143
|
+
| Only pass primitives | Smaller payload |
|
|
144
|
+
| No functions | Can't serialize |
|
|
145
|
+
| No Date objects | Use ISO strings |
|
|
146
|
+
| No circular refs | JSON.stringify fails |
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# Waterfall Patterns (CRITICAL)
|
|
2
|
+
|
|
3
|
+
> Eliminating request waterfalls is the highest-impact React optimization.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## async-defer-await
|
|
8
|
+
|
|
9
|
+
**Move `await` into branches where actually used.**
|
|
10
|
+
|
|
11
|
+
| ❌ Bad | ✅ Good |
|
|
12
|
+
|--------|---------|
|
|
13
|
+
| Fetch data before checking if needed | Fetch only when condition is true |
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
// ❌ BAD: Always waits even when not needed
|
|
17
|
+
const data = await getData();
|
|
18
|
+
if (condition) {
|
|
19
|
+
use(data);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// ✅ GOOD: Only fetches when needed
|
|
23
|
+
if (condition) {
|
|
24
|
+
const data = await getData();
|
|
25
|
+
use(data);
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## async-parallel
|
|
32
|
+
|
|
33
|
+
**Use Promise.all() for independent operations.**
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
// ❌ BAD: Sequential (2 round trips)
|
|
37
|
+
const user = await getUser();
|
|
38
|
+
const posts = await getPosts();
|
|
39
|
+
|
|
40
|
+
// ✅ GOOD: Parallel (1 round trip)
|
|
41
|
+
const [user, posts] = await Promise.all([
|
|
42
|
+
getUser(),
|
|
43
|
+
getPosts()
|
|
44
|
+
]);
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## async-suspense-boundaries
|
|
50
|
+
|
|
51
|
+
**Use Suspense to stream content progressively.**
|
|
52
|
+
|
|
53
|
+
```tsx
|
|
54
|
+
// ✅ Stream slow components independently
|
|
55
|
+
<Suspense fallback={<Skeleton />}>
|
|
56
|
+
<SlowComponent /> {/* Streams when ready */}
|
|
57
|
+
</Suspense>
|
|
58
|
+
<FastComponent /> {/* Shows immediately */}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
| Pattern | Use When |
|
|
62
|
+
|---------|----------|
|
|
63
|
+
| Single Suspense | One slow data source |
|
|
64
|
+
| Nested Suspense | Multiple independent slow sources |
|
|
65
|
+
| Suspense + loading.tsx | Page-level loading |
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## async-api-routes
|
|
70
|
+
|
|
71
|
+
**Start promises early, await late in API routes.**
|
|
72
|
+
|
|
73
|
+
```tsx
|
|
74
|
+
// ✅ Start all promises immediately
|
|
75
|
+
export async function GET() {
|
|
76
|
+
const userPromise = getUser();
|
|
77
|
+
const postsPromise = getPosts();
|
|
78
|
+
|
|
79
|
+
// Do other sync work here...
|
|
80
|
+
|
|
81
|
+
// Await at the end
|
|
82
|
+
const [user, posts] = await Promise.all([
|
|
83
|
+
userPromise,
|
|
84
|
+
postsPromise
|
|
85
|
+
]);
|
|
86
|
+
|
|
87
|
+
return Response.json({ user, posts });
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Quick Detection
|
|
94
|
+
|
|
95
|
+
| Signal | Likely Waterfall |
|
|
96
|
+
|--------|------------------|
|
|
97
|
+
| Sequential `await` | Use `Promise.all()` |
|
|
98
|
+
| `await` before `if` | Move into branch |
|
|
99
|
+
| No `<Suspense>` with RSC | Add streaming |
|
|
100
|
+
| Nested data fetching | Restructure components |
|
|
101
|
+
|
|
102
|
+
> **Remember:** Profile first with React DevTools and Network tab.
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: reader-testing
|
|
3
|
+
description: Validate documents and code by testing with a fresh AI instance (no context). Use when finalizing docs, specs, READMEs, or any content that others will read. Catches blind spots, assumptions, and gaps before publishing.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Reader Testing
|
|
7
|
+
|
|
8
|
+
> **Core Idea:** Test your document with a "fresh reader" (no context) to catch blind spots before others read it.
|
|
9
|
+
> **Inspired by:** Anthropic's Doc Co-Authoring workflow
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 🎯 When to Use
|
|
14
|
+
|
|
15
|
+
| Trigger | Example |
|
|
16
|
+
|---------|---------|
|
|
17
|
+
| Finalizing docs | "Review my README", "Check this spec" |
|
|
18
|
+
| Before publishing | "Is this doc clear?", "Test this guide" |
|
|
19
|
+
| Knowledge transfer | "Will others understand this?" |
|
|
20
|
+
| API docs | "Test my API documentation" |
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## 🔄 3-Phase Workflow
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
Phase 1: Context Gathering
|
|
28
|
+
└── Understand what the doc is about
|
|
29
|
+
|
|
30
|
+
Phase 2: Question Prediction
|
|
31
|
+
└── Generate questions readers will ask
|
|
32
|
+
|
|
33
|
+
Phase 3: Fresh Reader Test
|
|
34
|
+
└── Test with zero-context AI
|
|
35
|
+
└── Fix gaps found
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Phase 1: Context Gathering
|
|
41
|
+
|
|
42
|
+
Before testing, understand:
|
|
43
|
+
|
|
44
|
+
| Question | Why |
|
|
45
|
+
|----------|-----|
|
|
46
|
+
| Who is the audience? | Technical vs non-technical affects clarity needs |
|
|
47
|
+
| What's the goal? | Reference doc vs tutorial vs decision doc |
|
|
48
|
+
| What context do readers have? | What can you assume they know? |
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Phase 2: Question Prediction
|
|
53
|
+
|
|
54
|
+
Generate 5-10 questions that readers would realistically ask:
|
|
55
|
+
|
|
56
|
+
### Question Types
|
|
57
|
+
|
|
58
|
+
| Type | Example |
|
|
59
|
+
|------|---------|
|
|
60
|
+
| **Discovery** | "How do I do X?" |
|
|
61
|
+
| **Clarification** | "What does Y mean?" |
|
|
62
|
+
| **Edge cases** | "What happens if Z?" |
|
|
63
|
+
| **Prerequisites** | "What do I need first?" |
|
|
64
|
+
| **Troubleshooting** | "Why isn't this working?" |
|
|
65
|
+
|
|
66
|
+
### Example Predictions
|
|
67
|
+
|
|
68
|
+
```markdown
|
|
69
|
+
For a README:
|
|
70
|
+
1. "How do I install this?"
|
|
71
|
+
2. "What are the requirements?"
|
|
72
|
+
3. "How do I run it?"
|
|
73
|
+
4. "Where do I configure X?"
|
|
74
|
+
5. "What does error Y mean?"
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Phase 3: Fresh Reader Test
|
|
80
|
+
|
|
81
|
+
### Option A: Sub-Agent Test (Automated)
|
|
82
|
+
|
|
83
|
+
Use a sub-agent with ONLY the document content:
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
Instructions to sub-agent:
|
|
87
|
+
1. Read ONLY the provided document
|
|
88
|
+
2. Answer the predicted questions
|
|
89
|
+
3. Report what was unclear or missing
|
|
90
|
+
4. Identify assumed knowledge
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Option B: Manual Test
|
|
94
|
+
|
|
95
|
+
1. Open a new AI conversation (fresh context)
|
|
96
|
+
2. Paste the document
|
|
97
|
+
3. Ask the predicted questions
|
|
98
|
+
4. Note what the AI gets wrong
|
|
99
|
+
|
|
100
|
+
### Test Checklist
|
|
101
|
+
|
|
102
|
+
For each question, check:
|
|
103
|
+
|
|
104
|
+
| Check | Pass | Fail |
|
|
105
|
+
|-------|------|------|
|
|
106
|
+
| Answer found in doc? | ✅ | ❌ Add it |
|
|
107
|
+
| Answer is clear? | ✅ | ❌ Rewrite |
|
|
108
|
+
| No wrong assumptions? | ✅ | ❌ Add context |
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## 🛠️ Additional Checks
|
|
113
|
+
|
|
114
|
+
Ask the fresh reader:
|
|
115
|
+
|
|
116
|
+
```markdown
|
|
117
|
+
1. "What in this doc might be ambiguous?"
|
|
118
|
+
2. "What knowledge does this assume readers have?"
|
|
119
|
+
3. "Are there contradictions or inconsistencies?"
|
|
120
|
+
4. "What's missing that you'd expect to find?"
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## 📋 Output Format
|
|
126
|
+
|
|
127
|
+
After testing, report:
|
|
128
|
+
|
|
129
|
+
```markdown
|
|
130
|
+
## Reader Test Results
|
|
131
|
+
|
|
132
|
+
### Questions Tested
|
|
133
|
+
| # | Question | Result | Action |
|
|
134
|
+
|---|----------|--------|--------|
|
|
135
|
+
| 1 | How to install? | ✅ Clear | None |
|
|
136
|
+
| 2 | How to configure? | ❌ Missing | Add config section |
|
|
137
|
+
| 3 | What are prereqs? | ⚠️ Unclear | Clarify Node version |
|
|
138
|
+
|
|
139
|
+
### Gaps Found
|
|
140
|
+
- [ ] Missing: Configuration guide
|
|
141
|
+
- [ ] Unclear: Error handling section
|
|
142
|
+
- [ ] Assumed: Reader knows Docker
|
|
143
|
+
|
|
144
|
+
### Recommended Fixes
|
|
145
|
+
1. Add "Prerequisites" section
|
|
146
|
+
2. Expand "Configuration" with examples
|
|
147
|
+
3. Add "Troubleshooting" FAQ
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## 🔁 Iteration
|
|
153
|
+
|
|
154
|
+
**Exit Condition:** When fresh reader:
|
|
155
|
+
- Answers all questions correctly
|
|
156
|
+
- Finds no new gaps
|
|
157
|
+
- Reports no ambiguities
|
|
158
|
+
|
|
159
|
+
Then the doc is ready! ✅
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## Integration with Other Skills
|
|
164
|
+
|
|
165
|
+
| Combine With | For |
|
|
166
|
+
|--------------|-----|
|
|
167
|
+
| `documentation-templates` | Generate initial doc structure |
|
|
168
|
+
| `spec-writing` | Validate specs before implementation |
|
|
169
|
+
| `plan-writing` | Test project plans for clarity |
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## Quick Reference
|
|
174
|
+
|
|
175
|
+
```
|
|
176
|
+
1. LIST predicted reader questions (5-10)
|
|
177
|
+
2. TEST with fresh AI (no context)
|
|
178
|
+
3. RECORD what failed
|
|
179
|
+
4. FIX gaps
|
|
180
|
+
5. REPEAT until clean
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
> **Remember:** If YOU wrote it, you have context bias. Fresh readers don't.
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: verification-gate
|
|
3
|
+
description: Evidence-based verification before any completion claims. Use ALWAYS before claiming work is done, tests pass, builds succeed, or bugs are fixed. NO COMPLETION CLAIMS WITHOUT FRESH VERIFICATION EVIDENCE.
|
|
4
|
+
allowed-tools: Read, Bash, Grep
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Verification Before Completion
|
|
8
|
+
|
|
9
|
+
> **Iron Law:** NO COMPLETION CLAIMS WITHOUT FRESH VERIFICATION EVIDENCE
|
|
10
|
+
|
|
11
|
+
Claiming work is complete without verification is dishonesty, not efficiency.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## 🔴 The Gate Function (MANDATORY)
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
BEFORE claiming any status or expressing satisfaction:
|
|
19
|
+
|
|
20
|
+
1. IDENTIFY: What command proves this claim?
|
|
21
|
+
2. RUN: Execute the FULL command (fresh, complete)
|
|
22
|
+
3. READ: Full output, check exit code, count failures
|
|
23
|
+
4. VERIFY: Does output confirm the claim?
|
|
24
|
+
- If NO: State actual status with evidence
|
|
25
|
+
- If YES: State claim WITH evidence
|
|
26
|
+
5. ONLY THEN: Make the claim
|
|
27
|
+
|
|
28
|
+
Skip any step = lying, not verifying
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## 📋 Verification Matrix
|
|
34
|
+
|
|
35
|
+
| Claim | Command Required | Evidence Needed | Not Sufficient |
|
|
36
|
+
|-------|------------------|-----------------|----------------|
|
|
37
|
+
| **Tests pass** | `npm test` / `pytest` | 0 failures, exit 0 | "should pass", previous run |
|
|
38
|
+
| **Linter clean** | `npm run lint` / `eslint` | 0 errors | partial check |
|
|
39
|
+
| **Build succeeds** | `npm run build` | exit 0 | linter passing |
|
|
40
|
+
| **Bug fixed** | Test original symptom | passes now | "code changed" |
|
|
41
|
+
| **Types correct** | `tsc --noEmit` | 0 errors | "looks correct" |
|
|
42
|
+
| **Agent completed** | Check VCS diff | changes visible | agent reports "success" |
|
|
43
|
+
| **Requirements met** | Line-by-line checklist | each verified | tests passing |
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## 🚩 Red Flags - STOP IMMEDIATELY
|
|
48
|
+
|
|
49
|
+
**Language Red Flags:**
|
|
50
|
+
- Using "should", "probably", "seems to"
|
|
51
|
+
- Expressing satisfaction ("Great!", "Perfect!", "Done!")
|
|
52
|
+
- About to commit/push/PR without verification
|
|
53
|
+
- ANY wording implying success without evidence
|
|
54
|
+
|
|
55
|
+
**Behavior Red Flags:**
|
|
56
|
+
- Trusting agent success reports
|
|
57
|
+
- Relying on partial verification
|
|
58
|
+
- Thinking "just this once"
|
|
59
|
+
- Tired and wanting work over
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## ❌ Rationalization Prevention
|
|
64
|
+
|
|
65
|
+
| Excuse | Correct Response |
|
|
66
|
+
|--------|------------------|
|
|
67
|
+
| "Should work now" | RUN the verification |
|
|
68
|
+
| "I'm confident" | Confidence ≠ evidence |
|
|
69
|
+
| "Just this once" | No exceptions |
|
|
70
|
+
| "Linter passed" | Linter ≠ compiler |
|
|
71
|
+
| "Agent said success" | Verify independently |
|
|
72
|
+
| "I'm tired" | Exhaustion ≠ excuse |
|
|
73
|
+
| "Partial check is enough" | Partial proves nothing |
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## ✅ Correct Patterns
|
|
78
|
+
|
|
79
|
+
### Tests
|
|
80
|
+
```
|
|
81
|
+
✅ [Run: npm test] [Output: 34/34 pass] "All tests pass"
|
|
82
|
+
❌ "Should pass now" / "Looks correct"
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### TDD Red-Green (Regression Tests)
|
|
86
|
+
```
|
|
87
|
+
✅ Write test → Run (pass) → Revert fix → Run (MUST FAIL) → Restore → Run (pass)
|
|
88
|
+
❌ "I've written a regression test" (without red-green verification)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Build
|
|
92
|
+
```
|
|
93
|
+
✅ [Run: npm run build] [Output: exit 0] "Build passes"
|
|
94
|
+
❌ "Linter passed" (linter doesn't check compilation)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Requirements
|
|
98
|
+
```
|
|
99
|
+
✅ Re-read plan → Create checklist → Verify EACH → Report gaps OR completion
|
|
100
|
+
❌ "Tests pass, phase complete"
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Agent Delegation
|
|
104
|
+
```
|
|
105
|
+
✅ Agent reports success → Check VCS diff → Verify changes → Report actual state
|
|
106
|
+
❌ Trust agent report without verification
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## ⏱️ When to Apply
|
|
112
|
+
|
|
113
|
+
**ALWAYS before:**
|
|
114
|
+
- ANY variation of success/completion claims
|
|
115
|
+
- ANY expression of satisfaction
|
|
116
|
+
- ANY positive statement about work state
|
|
117
|
+
- Committing, PR creation, task completion
|
|
118
|
+
- Moving to next task
|
|
119
|
+
- Delegating to agents
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## 📊 The Bottom Line
|
|
124
|
+
|
|
125
|
+
**No shortcuts for verification.**
|
|
126
|
+
|
|
127
|
+
Run the command. Read the output. THEN claim the result.
|
|
128
|
+
|
|
129
|
+
This is **non-negotiable**.
|