ai-toolkit-rules
Mandatory engineering, security, testing, git, performance, quality, and response rules.…
Performance: golden signals, p50/p95/p99, flame graphs, load testing. Triggers: performance, slow, latency, p99, flame graph, bottleneck, memory leak.
$ npx -y skills add softspark/ai-toolkit --skill performance-profiling --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/performance-profilingContext preview
The summary Claude sees to decide when to auto-load this skill.
Performance: golden signals, p50/p95/p99, flame graphs, load testing. Triggers: performance, slow, latency, p99, flame graph, bottleneck, memory leak.
name: performance-profiling description: "Performance: golden signals, p50/p95/p99, flame graphs, load testing. Triggers: performance, slow, latency, p99, flame graph, bottleneck, memory leak." effort: medium allowed-tools: Read, Grep user-invocable: false
**"Don't optimize without a baseline."** Always measure -> change -> measure.
1. **Latency**: Time it takes to serve a request. (p50, p95, p99) 2. **Traffic**: Demand on your system (req/sec). 3. **Errors**: Rate of requests that fail. 4. **Saturation**: How "full" your service is (CPU/Memory usage).
# Record flamegraph py-spy record -o profile.svg --pid <pid>
import cProfile
cProfile.run('main()')node --prof app.js node --prof-process isolate-0xnnnnn.log > processed.txt
EXPLAIN (ANALYZE, BUFFERS) SELECT * FROM users WHERE active = 1;
1. **Database/IO**: (Indexing, Caching, Batching) - *Biggest Gains* 2. **Algorithm**: (O(n²) -> O(n log n)) 3. **Memory**: (Allocation churn, GC pressure) 4. **Micro-optimization**: (Loop unrolling, etc.) - *Smallest Gains*
| Excuse | Why It's Wrong | |--------|----------------| | "It feels slow, let me optimize this function" | Feelings aren't data — profile first, then optimize the actual bottleneck | | "We should optimize everything" | Premature optimization is the root of all evil — focus on the critical path | | "Caching will fix it" | Caching masks problems and adds complexity — fix the root cause first | | "It's fast enough in dev" | Dev has 1 user — production has thousands and cold caches | | "We'll optimize later" | Performance debt compounds — a 100ms regression per sprint = 5s in a year |
# Capture a 30-second CPU flamegraph from a running Python service py-spy record -o profile.svg --duration 30 --pid "$(pgrep -f my-service)" # Identify top 3 hot functions py-spy top --pid "$(pgrep -f my-service)"
Then, per the optimization hierarchy, start with DB/IO fixes (indexing, batching, caching the right layer) before touching algorithm-level changes.
AI coding toolkit with machine-enforced safety, 116 skills, 44 agents, lifecycle hooks, persona presets, opt-in plugin packs, and benchmark tooling.
Repo: softspark/ai-toolkit
Mandatory engineering, security, testing, git, performance, quality, and response rules.…
Searches past coding sessions for observations, decisions, context. Triggers: mem-search,…
Accessibility validator: WCAG 2.1 AA, EN 301 549, EAA. Triggers: a11y, accessibility, WCAG,…
Creates new specialized agents with frontmatter, tools, delegation. Triggers: new agent,…
Analyzes code quality, complexity, patterns across codebase. Triggers: quality report,…
API design: naming, versioning, pagination, idempotency, OpenAPI, error contracts and safe…