performance-gate
Verify performance implications were considered and no obvious anti-patterns exist. Issues result in WARNINGS.
Best use case
performance-gate is best used when you need a repeatable AI agent workflow instead of a one-off prompt. It is especially useful for teams working in multi. Verify performance implications were considered and no obvious anti-patterns exist. Issues result in WARNINGS.
Verify performance implications were considered and no obvious anti-patterns exist. Issues result in WARNINGS.
Users should expect a more consistent workflow output, faster repeated execution, and less time spent rewriting prompts from scratch.
Practical example
Example input
Use the "performance-gate" skill to help with this workflow task. Context: Verify performance implications were considered and no obvious anti-patterns exist. Issues result in WARNINGS.
Example output
A structured workflow result with clearer steps, more consistent formatting, and an output that is easier to reuse in the next run.
When to use this skill
- Use this skill when you want a reusable workflow rather than writing the same prompt again and again.
When not to use this skill
- Do not use this when you only need a one-off answer and do not need a reusable workflow.
- Do not use it if you cannot install or maintain the related files, repository context, or supporting tools.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/performance-gate/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How performance-gate Compares
| Feature / Agent | performance-gate | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Verify performance implications were considered and no obvious anti-patterns exist. Issues result in WARNINGS.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Gate 4: Performance Review
> "Code that works is step one. Code that scales is step two."
## Purpose
This gate catches performance anti-patterns before they cause problems. The focus is on obvious issues, not micro-optimizations.
## Gate Status
- **PASS** — No obvious performance issues
- **WARNING** — Issues found that could cause problems at scale
---
## Gate Questions
### Question 1: Scalability
> "What happens when there are 10,000 items? 1,000,000?"
**Looking for:**
- Awareness of data growth
- Pagination for large datasets
- Efficient data structures
- No unnecessary loops
### Question 2: Query Efficiency
> "How many database queries does this operation make?"
**Looking for:**
- No N+1 queries
- Bulk operations where appropriate
- Indexes on queried columns
- Awareness of query cost
### Question 3: Re-render Awareness (Frontend)
> "When this state changes, what components re-render?"
**Looking for:**
- Awareness of render triggers
- Appropriate memoization
- State placement optimization
- No expensive computations in render
---
## Performance Checklist
### Database Operations
- [ ] No N+1 queries (queries inside loops)
- [ ] Pagination for list endpoints
- [ ] Indexes on frequently queried columns
- [ ] SELECT only needed columns (not SELECT *)
### Frontend Rendering
- [ ] Expensive computations use useMemo
- [ ] Event handlers use useCallback where needed
- [ ] Large lists use virtualization
- [ ] Heavy components are lazy loaded
### API & Network
- [ ] Response payloads are minimal
- [ ] Large data is paginated
- [ ] Caching headers where appropriate
- [ ] No redundant API calls
### General
- [ ] No nested loops (O(n²)) without justification
- [ ] No blocking operations
- [ ] Cleanup of intervals/timeouts
- [ ] Reasonable memory usage
---
## Response Templates
### If PASS
```
✅ 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...
```
### If WARNING
```
⚠️ 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.
```
---
## Common Issues to Check
### 1. The N+1 Query Problem
```
❌ 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
```
### 2. Fetching Everything
```
❌ // 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
```
### 3. Expensive Render Calculations
```
❌ 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>;
}
```
### 4. Inline Functions Causing Re-renders
```
❌ function Parent() {
return <Child onClick={() => doSomething()} />;
// New function every render → Child re-renders
}
✅ function Parent() {
const handleClick = useCallback(() => doSomething(), []);
return <Child onClick={handleClick} />;
}
```
### 5. Missing Cleanup
```
❌ useEffect(() => {
const interval = setInterval(fetchData, 5000);
// Memory leak! Runs forever
}, []);
✅ useEffect(() => {
const interval = setInterval(fetchData, 5000);
return () => clearInterval(interval);
}, []);
```
---
## Socratic Performance Questions
Instead of pointing out the fix, ask:
1. "How many queries does this endpoint execute for 100 users?"
2. "If I add 10,000 more items, what breaks?"
3. "Does this array get re-sorted on every render?"
4. "What clears this interval when the component unmounts?"
5. "Do we need all 50 columns from this table?"
---
## Big O Quick Reference
| 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 |
---
## Performance Red Flags
| 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 |
---
## When to NOT Worry
Not everything needs optimization:
- **Small datasets**: Don't paginate 20 items
- **Rare operations**: One-time admin scripts can be slow
- **Prototype phase**: Get it working first
- **Micro-optimizations**: Focus on algorithms, not `for` vs `forEach`
The gate is about catching **obvious** issues, not micro-optimization.Related Skills
web-performance-seo
Fix PageSpeed Insights/Lighthouse accessibility "!" errors caused by contrast audit failures (CSS filters, OKLCH/OKLAB, low opacity, gradient text, image backgrounds). Use for accessibility-driven SEO/performance debugging and remediation.
web-performance-optimization
Optimize website and web application performance including loading speed, Core Web Vitals, bundle size, caching strategies, and runtime performance
performance-testing-review-multi-agent-review
Use when working with performance testing review multi agent review
performance-testing-review-ai-review
You are an expert AI-powered code review specialist combining automated static analysis, intelligent pattern recognition, and modern DevOps practices. Leverage AI tools (GitHub Copilot, Qodo, GPT-5, C
performance-profiling
Performance profiling principles. Measurement, analysis, and optimization techniques.
performance-engineer
Expert performance engineer specializing in modern observability, application optimization, and scalable system performance. Masters OpenTelemetry, distributed tracing, load testing, multi-tier caching, Core Web Vitals, and performance monitoring. Handles end-to-end optimization, real user monitoring, and scalability patterns. Use PROACTIVELY for performance optimization, observability, or scalability challenges.
clarity-gate
Pre-ingestion verification for epistemic quality in RAG systems with 9-point verification and Two-Round HITL workflow
application-performance-performance-optimization
Optimize end-to-end application performance with profiling, observability, and backend/frontend tuning. Use when coordinating performance optimization across the stack.
azure-aigateway
Configure Azure API Management (APIM) as AI Gateway to secure, observe, control AI models, MCP servers, agents. Helps with rate limiting, semantic caching, content safety, load balancing. USE FOR: AI Gateway, APIM, setup gateway, configure gateway, add gateway, model gateway, MCP server, rate limit, token limit, semantic cache, content safety, load balance, OpenAPI import, convert API to MCP. DO NOT USE FOR: deploy models (use microsoft-foundry), Azure Functions (use azure-functions), databases (use azure-postgres).
fixing-motion-performance
Fix animation performance issues.
convex-performance-audit
Audits and optimizes Convex application performance across hot-path reads, write contention, subscription cost, and function limits. Use this skill when a Convex feature is slow or expensive, npx convex insights shows high bytes or documents read, OCC conflict errors or mutation retries appear, subscriptions or UI updates are costly, functions hit execution or transaction limits, or the user mentions performance, latency, read amplification, or invalidation problems in a Convex app.
gate-mcp-installer
One-click installer and configurator for Gate MCP (mcporter) in OpenClaw. Use when the user wants to (1) Install mcporter CLI tool, (2) Configure Gate MCP server connection, (3) Verify Gate MCP setup, or (4) Troubleshoot Gate MCP connectivity issues.