Install
openclaw skills install perfguardPerformance anti-pattern scanner — finds N+1 queries, sync I/O, missing pagination, and memory leaks before they hit production
openclaw skills install perfguardPerfGuard scans your codebase for performance anti-patterns including N+1 queries, synchronous I/O in async code, missing pagination, unbounded loops, memory leaks, and inefficient serialization. It supports Python (Django, Flask, FastAPI, SQLAlchemy), JavaScript/TypeScript (Node.js, React, Express), Ruby (Rails), and Java (JPA/Hibernate). All scanning happens locally using regex-based pattern matching -- no code is sent to external servers.
perfguard scan [file|directory]One-shot performance anti-pattern scan.
How to execute:
bash "<SKILL_DIR>/scripts/perfguard.sh" scan [target]
What it does:
Example usage scenarios:
perfguard scan .perfguard scan .perfguard scan src/perfguard scan path/to/file.pyperfguard scan .perfguard scan [file|directory] (unlimited)Full performance scan with no file limit and all 40+ checks enabled.
How to execute:
bash "<SKILL_DIR>/scripts/perfguard.sh" scan [target]
What it does (beyond free):
perfguard hooks installInstall git pre-commit hooks that scan staged files for performance anti-patterns before every commit.
How to execute:
bash "<SKILL_DIR>/scripts/perfguard.sh" hooks install
What it does:
perfguard hooks uninstallRemove PerfGuard git hooks.
bash "<SKILL_DIR>/scripts/perfguard.sh" hooks uninstall
perfguard report [directory]Generate a markdown performance audit report.
bash "<SKILL_DIR>/scripts/perfguard.sh" report [directory]
What it does:
perfguard hotspots [directory]Identify the files with the most performance anti-patterns (hot paths).
bash "<SKILL_DIR>/scripts/perfguard.sh" hotspots [directory]
What it does:
perfguard budget [directory]Check code against performance budgets.
bash "<SKILL_DIR>/scripts/perfguard.sh" budget [directory]
What it does:
perfguard trend [directory]Show performance trend over recent git history.
bash "<SKILL_DIR>/scripts/perfguard.sh" trend [directory]
What it does:
PerfGuard checks for 40+ performance anti-patterns across 4 categories:
| Check | Description | Severity |
|---|---|---|
| N+1 Query | Query inside a loop / loop inside a query | Critical |
| SELECT * | Using SELECT * instead of specific columns | High |
| Missing Eager Loading | No select_related/prefetch_related (Django), includes/eager_load (Rails), JOIN FETCH (JPA) | Critical |
| Unbounded Query | Query without LIMIT or pagination | High |
| Sequential Queries | Multiple queries that could be batched | Medium |
| String SQL Concatenation | Building SQL with string concatenation | Critical |
| Missing Index Hint | Complex queries without index annotations | Medium |
| Check | Description | Severity |
|---|---|---|
| Await in Loop | Sequential async operations instead of parallel | Critical |
| Missing Promise.all | Multiple independent awaits without Promise.all | High |
| Sync File I/O | readFileSync/writeFileSync in server code | High |
| JSON Clone | JSON.parse(JSON.stringify()) for deep cloning | Medium |
| Unbounded Array Ops | Large array operations without chunking | Medium |
| Memory Leak | Event listeners without cleanup | High |
| Missing Memoization | React components without useMemo/useCallback/React.memo | Medium |
| Full Lodash Import | Importing entire lodash instead of specific functions | High |
| Missing Pagination | API responses without pagination | High |
| Console in Production | console.log statements in production code | Low |
| Check | Description | Severity |
|---|---|---|
| Heavy Module in Function | Importing heavy modules inside functions | Medium |
| List vs Generator | Large list comprehensions that should be generators | Medium |
| String Concat in Loop | String concatenation in loops instead of join | Medium |
| Sleep in Async | time.sleep() in async code | Critical |
| Missing Connection Pool | Direct connections without pooling | High |
| Sync in Async | Synchronous I/O in async functions | High |
| Full File Load | Loading entire files into memory | Medium |
| Regex in Loop | Compiling regex inside loops | Medium |
| Check | Description | Severity |
|---|---|---|
| Unbounded Retry | Retries without exponential backoff | High |
| Missing Timeout | HTTP requests without timeout | High |
| Polling | Polling instead of webhooks/events | Medium |
| Hardcoded Delay | Hardcoded sleep/delay values | Low |
| Missing Cache | Repeated computations without caching | Medium |
| No Memoization | Recursive functions without memoization | Medium |
| Large Payload | Serialization without streaming | Medium |
Users can configure PerfGuard in ~/.openclaw/openclaw.json:
{
"skills": {
"entries": {
"perfguard": {
"enabled": true,
"apiKey": "YOUR_LICENSE_KEY_HERE",
"config": {
"severityThreshold": "high",
"excludePatterns": ["**/node_modules/**", "**/dist/**", "**/.git/**"],
"reportFormat": "markdown"
}
}
}
}
}
hooks install, prompt to install itThe user might say things like:
brew install lefthook