skills/code-perf/SKILL.md
Performance profiling and optimization. Use when code is slow, has memory issues, or needs optimization. Triggers on "slow", "performance", "optimize", "memory leak", "profiling", "bottleneck", or any performance-related concern.
npx skillsauth add martinffx/claude-code-atelier code-perfInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Performance profiling and optimization workflow.
Never optimize without profiling.
You don't know where the bottleneck is until you measure. Making changes without profiling wastes time and often makes things worse.
Measure the current performance.
Questions:
Tools:
Find the hot paths.
Look for:
Apply the right optimization pattern.
Re-profile to confirm improvement.
See references/common-bottlenecks.md for detailed patterns:
| Pattern | Symptom | Solution | |---------|---------|----------| | N+1 | Multiple DB queries | Eager load, batch | | Memory leak | Growing RSS | Clear caches, weak refs | | Blocking I/O | Thread blocked | Async, worker pool | | Unnecessary work | CPU high | Skip redundant calc | | Large data | Slow serialization | Pagination, streams |
See references/optimization-patterns.md for:
// Before: every call hits DB
const user = await db.users.find(id);
// After: cache
const cacheKey = `user:${id}`;
let user = await redis.get(cacheKey);
if (!user) {
user = await db.users.find(id);
await redis.set(cacheKey, user, 'EX', 300);
}
// Before: load everything
const allUsers = await db.users.findMany();
// After: paginate
const users = await db.users.findMany({
take: 20,
skip: page * 20
});
// Before: new connection each time
const client = new Client();
await client.connect();
// After: pool
const pool = new Pool({ max: 20 });
// Use pool.query() throughout
See references/profiling-tools.md for:
# CPU profiling
node --prof app.js
# Memory
node --inspect app.js # Chrome DevTools
# clinic.js
npx clinic doctor -- node app.js
# cProfile
python -m cProfile -o profile.prof app.py
# view with: python -m cProfile -s cumulative app.py
# pprof
go test -cpuprofile=cpu.prof
go tool pprof cpu.prof
# Web interface
go tool pprof -http=:8080 cpu.prof
development
Security architecture and threat modeling knowledge. Auto-invokes when designing features that handle untrusted data, authentication, authorization, external integrations, file uploads, or sensitive data. Provides risk assessment frameworks, trust boundary analysis, and security design principles — not implementation code.
testing
Adversarial review of non-trivial decisions using fresh-context scrutiny. Use when correctness matters more than speed, when stakes are high (production, security-sensitive logic, irreversible operations), or before committing significant architectural or implementation choices.
development
Compact the current conversation into a handoff document for another agent to pick up.
testing
Socratic interrogation of plans against the project's domain model and documented decisions. Use when the user wants to stress-test a plan, clarify terminology, or validate assumptions against existing domain language. Updates CONTEXT.md and ADRs inline as decisions crystallise.