一键导入
performance-gate
Verifies performance including N+1 query detection, scalability assessment, and complexity analysis. WARNING gate triggered during /own:done flow.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Verifies performance including N+1 query detection, scalability assessment, and complexity analysis. WARNING gate triggered during /own:done flow.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Transforms completed work into powerful resume bullet points with action verbs, technical context, and quantified impact. Use when completing tasks, updating portfolio, or preparing job applications.
Transforms completed work into STAR interview stories (Situation, Task, Action, Result). Use when completing tasks, preparing for behavioral interviews, or documenting achievements.
Reviews accessibility including WCAG, ARIA, keyboard navigation. Use when junior builds forms, buttons, modals, interactive elements, or asks "is this accessible", "a11y", "screen reader".
Reviews API design, REST conventions, and backend architecture. Use when junior builds API endpoints, Express routes, middleware, controllers, or asks "is this RESTful", "check my endpoint".
Reviews schema design, SQL queries, ORM patterns. Use when junior creates schema, writes queries, adds migrations, works with Prisma/MongoDB/PostgreSQL, or asks "is this SQL safe", "N+1", "index".
Guides systematic debugging through Protocol D (READ, ISOLATE, DOCS, HYPOTHESIZE, VERIFY). Use when junior says "stuck", "not working", "broken", "bug", "error", "crashed", "failing", "can't figure out", or expresses frustration. Do NOT use for general questions.
| name | performance-gate |
| description | Verifies performance including N+1 query detection, scalability assessment, and complexity analysis. WARNING gate triggered during /own:done flow. |
"Code that works is step one. Code that scales is step two."
This gate catches performance anti-patterns before they cause problems. The focus is on obvious issues, not micro-optimizations.
"What happens when there are 10,000 items? 1,000,000?"
Looking for:
"How many database queries does this operation make?"
Looking for:
"When this state changes, what components re-render?"
Looking for:
✅ PERFORMANCE GATE: PASSED
Performance considerations look good:
- Data fetching is efficient
- No obvious N+1 patterns
- Appropriate pagination in place
Moving to the next gate...
⚠️ PERFORMANCE GATE: WARNING
Found [X] performance concerns:
**Issue 1: [N+1 Query / Inefficient Loop]**
Location: `file.ts:42`
Question: "This makes [N] queries. Can we batch into 1?"
**Issue 2: [Missing Pagination]**
Location: `file.ts:88`
Question: "What happens with 100,000 records?"
**Issue 3: [Expensive Render]**
Location: `Component.tsx:15`
Question: "Does this need to recalculate on every render?"
These may not matter now, but will become problems as the app grows.
❌ const users = await User.findAll();
for (const user of users) {
user.posts = await Post.findByUserId(user.id);
}
// 1 + N queries!
✅ const users = await User.findAll({
include: [{ model: Post }]
});
// 1 query with JOIN
❌ // Returns 10,000 users with 50 fields each
GET /api/users
✅ // Paginated with only needed fields
GET /api/users?page=1&limit=20&fields=id,name,email
❌ function UserList({ users }) {
// Runs on every render
const sorted = users.sort((a, b) => a.name.localeCompare(b.name));
return <ul>{sorted.map(...)}</ul>;
}
✅ function UserList({ users }) {
const sorted = useMemo(
() => [...users].sort((a, b) => a.name.localeCompare(b.name)),
[users]
);
return <ul>{sorted.map(...)}</ul>;
}
❌ function Parent() {
return <Child onClick={() => doSomething()} />;
// New function every render → Child re-renders
}
✅ function Parent() {
const handleClick = useCallback(() => doSomething(), []);
return <Child onClick={handleClick} />;
}
❌ useEffect(() => {
const interval = setInterval(fetchData, 5000);
// Memory leak! Runs forever
}, []);
✅ useEffect(() => {
const interval = setInterval(fetchData, 5000);
return () => clearInterval(interval);
}, []);
Instead of pointing out the fix, ask:
| Pattern | Complexity | 10,000 items | Concern Level |
|---|---|---|---|
| Map lookup | O(1) | 1 op | Fine |
| Single loop | O(n) | 10,000 ops | Usually fine |
| Nested loop | O(n²) | 100M ops | Warning |
| Triple loop | O(n³) | 1T ops | Critical |
| Flag | Question | Why |
|---|---|---|
| Query in a loop | "Can we batch?" | N+1 problem |
| No pagination | "What at scale?" | Memory/time explosion |
| SELECT * | "Need all fields?" | Wasted bandwidth |
| setInterval no cleanup | "What clears this?" | Memory leak |
| Inline object/function in JSX | "New reference?" | Unnecessary re-renders |
| Array.sort() in render | "Cached?" | Runs every render |
Not everything needs optimization:
for vs forEachThe gate is about catching obvious issues, not micro-optimization.