Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add girijashankarj/cursor-handbook --skill query-optimizationgit clone --depth 1 https://github.com/girijashankarj/cursor-handbookWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/girijashankarj/cursor-handbook/query-optimization)<a href="https://agentmods.dev/skills/girijashankarj/cursor-handbook/query-optimization"><img src="https://agentmods.dev/badge/skills/girijashankarj/cursor-handbook/query-optimization.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00028 | $0.00334 |
| Opus 5 | $0.00014 | $0.00167 |
| Sonnet 5 | $0.00006 | $0.00067 |
| Haiku 4.5 | $0.00003 | $0.00033 |
Grade A, and why
query-optimization scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
What it actually says
Skill: Optimize Database Query
Trigger
When a query is slow or user asks to optimize database performance.
Steps
Step 1: Identify Slow Query
- Get the query text
- Measure current execution time
- Check query frequency (how often it runs)
Step 2: Analyze Query Plan
- Run EXPLAIN ANALYZE on the query
- Identify sequential scans on large tables
- Check for missing indexes
- Look for unnecessary joins or subqueries
- Check sort operations (external sorts)
Step 3: Optimize
Common optimizations:
- Add missing indexes
- Rewrite subqueries as JOINs
- Add WHERE clause filters to reduce data
- Use cursor-based pagination instead of OFFSET
- Add partial indexes for filtered queries
- Denormalize if read performance is critical
Step 4: Benchmark
- Run optimized query with EXPLAIN ANALYZE
- Compare before/after execution times
- Test with production-like data volume
- Verify results are identical
Step 5: Implement
- Update query in code
- Create migration for new indexes
- Add monitoring for the query
- Update any affected tests
Completion
Query optimized with measurable improvement and monitoring in place.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 3d ago First seen · 48 lines · 28 tokens per session scan A 653b844863a0
query-optimization is a skill published in the GitHub repository girijashankarj/cursor-handbook (30 stars, last pushed 7d ago), licensed MIT. It adds 28 tokens to every session and 334 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.
Other skills, from other repositories
backend-db-performance
Optimize slow queries, indexes, and N+1s. Use when "slow query", "database performance", "add an index", or "N+1". Schema consistency → audit-db-schema. RLS access control → plan-rls-audit.
sql-optimization-patterns
Master SQL query optimization, indexing strategies, and EXPLAIN analysis to dramatically improve database performance and eliminate slow queries. Use when debugging slow queries, designing database schemas, or optimizing application performance.
octocode-research
Use when code must be checked, not assumed: trace connections (callers, imports, cross-repo wiring, what breaks if I change it), locate behavior, map a system, diagnose a failure, RCA. Also for external repositories, npm packages, upstream/prior art, and general research. Plan a coding flow before writing, validate it…
firebase-cloud-firestore
Use when setting up Firestore, designing schemas, doing CRUD, creating listeners, paginating queries, configuring indexes, enabling offline persistence, or writing security rules.
firebase-database
Use when syncing real-time data, structuring JSON trees, reading/writing, creating listeners, enabling offline persistence, managing presence, sharding, or writing security rules.
firebase-crashlytics
Use when implementing crash reporting, capturing fatal/non-fatal errors, recording isolate/async exceptions, customizing reports, or uploading obfuscated symbols.