Automated summary
This skill tunes slow SQLite queries through a three-phase workflow: execution-plan analysis, query rewriting and indexing, then measurement-based validation.
Strengths
- Measurement-driven approach: EXPLAIN QUERY PLAN analysis precedes any change, followed by before/after comparison.
- Covers index design, query rewriting, and N+1 problem resolution.
- Ships graded references (basics through expert) and a slow-query analysis script.
- Includes a dedicated validation phase that quantifies performance gains.
Limitations
- SQLite-specific; execution plans and techniques do not transfer directly to PostgreSQL or MySQL.
- Result quality depends on how representative the user's data and benchmarks are.
- It flags write-performance tradeoffs from indexes but leaves the final tradeoff decision to the user.
Use it when a SQLite query is reported as slow or an execution plan needs review.
Avoid it for non-SQLite databases or when you cannot access the data and run measurements.
Security analysis
SafeThe skill provides legitimate SQLite query performance tuning guidance using Bash for running analysis scripts and database commands. No destructive, exfiltrating, or obfuscated actions are described; the declared scripts are for analysis, logging, and validation.
No concerns found
How this analysis is madeExamples
This SQLite query takes about 1.2s on a 500k-row table. Run EXPLAIN QUERY PLAN, identify the bottleneck, and give me the index DDL that would fix it: SELECT * FROM orders WHERE customer_id = ? AND created_at > ? ORDER BY created_at DESC LIMIT 50;My ORM issues one query per order to load line items (N+1). Here are the schema and the generated SQL; rewrite this as a join or batched query, and measure the improvement before and after.We added three indexes and write throughput dropped noticeably. Analyze whether they help our top read queries, run EXPLAIN QUERY PLAN on each, and recommend which indexes to keep or drop.name: query-performance-tuning description: | SQLiteクエリパフォーマンス最適化を専門とするスキル。EXPLAIN QUERY PLAN分析、インデックス戦略、クエリリライトを通じて、遅いクエリを診断し実行計画を改善します。
Anchors: • High Performance MySQL (Baron Schwartz) / 適用: クエリ分析と診断手法 / 目的: 体系的なパフォーマンス診断 • Use The Index, Luke (Markus Winand) / 適用: インデックス設計原則 / 目的: 効果的なインデックス活用 • Systems Performance (Brendan Gregg) / 適用: 測定駆動のアプローチ / 目的: 定量的な効果検証
Trigger: Use when optimizing slow queries, analyzing execution plans, designing indexes, resolving N+1 problems, or improving database performance systematically. Keywords: slow query, EXPLAIN QUERY PLAN, index optimization, query rewriting, N+1 problem, database performance, SQLite performance allowed-tools:
- Read
- Write
- Edit
- Bash
- Glob
- Grep
Query Performance Tuning
概要
SQLiteクエリパフォーマンスを測定駆動で最適化します。遅いクエリの診断、実行計画の分析、インデックス設計、クエリリライトを段階的に実施し、パフォーマンス改善を実現します。
ワークフロー
Phase 1: Analysis(分析)
目的: 遅いクエリを特定し、実行計画を分析してボトルネックを診断
Task: agents/analysis.md
入力:
- 対象クエリ(SQL文)
- パフォーマンス要件(許容レスポンス時間)
出力:
- EXPLAIN QUERY PLAN 分析結果
- ボトルネック診断レポート
- 最適化の優先順位
実行タイミング: クエリが遅いと報告された時、パフォーマンス問題の調査時
Phase 2: Optimization(最適化)
目的: インデックス設計、クエリリライト、N+1問題解決を実施
Task: agents/optimization.md
入力:
- Phase 1 の分析結果
- データベーススキーマ
- クエリパターン
出力:
- インデックス設計案(DDL含む)
- 最適化されたクエリ
- 実装手順書
実行タイミング: 分析後の改善実施、インデックス追加判断時
Phase 3: Validation(検証)
目的: 最適化効果を測定し、パフォーマンス改善を検証
Task: agents/validation.md
入力:
- 最適化前後のクエリ
- ベンチマーク条件
出力:
- パフォーマンス比較レポート
- 改善率の測定結果
- 残存課題の特定
実行タイミング: 最適化実施後、効果測定が必要な時
Task仕様
| Task | 起動タイミング | 入力 | 出力 | | ------------ | -------------- | ------------------ | ----------------------- | | analysis | Phase 1開始時 | クエリ・要件 | ボトルネック診断 | | optimization | Phase 2開始時 | 分析結果・スキーマ | インデックス・最適化SQL | | validation | Phase 3開始時 | 最適化前後クエリ | 検証レポート |
詳細仕様: 各Taskの詳細は agents/ ディレクトリを参照
ベストプラクティス
すべきこと
- 測定から始める(推測による最適化を避ける)
- EXPLAIN QUERY PLAN で実行計画を必ず確認
- インデックス追加前にクエリパターンを分析
- N+1問題は早期に特定して解決
- 最適化効果を数値で検証
- 書き込み性能への影響を考慮
避けるべきこと
- 測定なしの盲目的なインデックス追加
- 実行計画を見ずにクエリを変更
- 過度なインデックス(書き込み性能の劣化)
- 単一クエリのみの最適化(全体像を見失う)
- 統計的妥当性のない測定
リソース参照
references/(詳細知識)
| リソース | パス | 内容 | | -------------------------- | -------------------------------------------------------------------------- | ------------------ | | 基礎知識 | references/Level1_basics.md | 基礎概念と用語 | | 実務パターン | references/Level2_intermediate.md | 実務での適用 | | 高度な最適化 | references/Level3_advanced.md | 高度な最適化技法 | | 専門トラブルシューティング | references/Level4_expert.md | 専門的な問題解決 | | EXPLAIN解析 | references/explain-analyze-guide.md | 実行計画の読解 | | インデックス戦略 | references/index-strategies.md | インデックス設計 | | クエリパターン | references/query-patterns.md | 最適化パターン | | 監視クエリ | references/monitoring-queries.md | パフォーマンス監視 |
scripts/(決定論的処理)
| スクリプト | 用途 | 使用例 |
| -------------------------- | -------------- | ---------------------------------------------------------------------------- |
| analyze-slow-queries.mjs | 遅いクエリ分析 | node scripts/analyze-slow-queries.mjs --query "SELECT ..." --threshold 100 |
| log_usage.mjs | 使用履歴記録 | node scripts/log_usage.mjs --result success --phase analysis |
| validate-skill.mjs | 構造検証 | node scripts/validate-skill.mjs |
assets/(テンプレート)
| テンプレート | 用途 |
| -------------------------------- | -------------------------- |
| performance-report-template.md | パフォーマンス分析レポート |
変更履歴
| Version | Date | Changes | | ------- | ---------- | ------------------------------------------------------------ | | 3.0.0 | 2026-01-02 | 18-skills.md仕様完全準拠: optimization/validation agents追加 | | 2.1.0 | 2026-01-02 | Task仕様テーブル形式化 | | 2.0.0 | 2025-12-31 | 18-skills.md 仕様に準拠、agents/ Task追加 | | 1.0.0 | 2025-12-24 | 初版 |
From the file to a first result
The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.
View the source and supporting filesThis download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.
1. Download the file
Download SKILL.mdFrom the root of a test project, save the file as .skill-downloads/sqlite-query-performance-tuning-ms5lrggm/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.
Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.
mkdir -p '.skill-downloads/sqlite-query-performance-tuning-ms5lrggm' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/sqlite-query-performance-tuning-ms5lrggm/download' --output '.skill-downloads/sqlite-query-performance-tuning-ms5lrggm/SKILL.md.part' && mv '.skill-downloads/sqlite-query-performance-tuning-ms5lrggm/SKILL.md.part' '.skill-downloads/sqlite-query-performance-tuning-ms5lrggm/SKILL.md'2. Check prerequisites
Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.
No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.
The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.
3. Load the skill
After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.
Claude Code
test -f '.skill-downloads/sqlite-query-performance-tuning-ms5lrggm/SKILL.md' && test -s '.skill-downloads/sqlite-query-performance-tuning-ms5lrggm/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/query-performance-tuning' && cp -R '.skill-downloads/sqlite-query-performance-tuning-ms5lrggm' '.claude/skills/query-performance-tuning'OpenSkills
OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.
Official OpenSkills installationopenskills install './.skill-downloads/sqlite-query-performance-tuning-ms5lrggm'openskills read 'sqlite-query-performance-tuning-ms5lrggm'Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.
For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.
openskills syncManual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.
4. Try a first task
Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:
Read .skill-downloads/sqlite-query-performance-tuning-ms5lrggm/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.
React Hook Form Best Practices
Development
Master React Hook Form: avoid anti-patterns, manage subscriptions, and handle reset, dirty state, and controlled inputs correctly.
Emotion to Mantine Migration
Development
Migrate Emotion styled-components to Mantine components with style props and CSS modules. Use when converting .styled.tsx files or removing @emotion imports.
Scope Creep Detector
Development
Analyzes git diffs against a stated intent to detect scope creep, unrelated files, broad PRs, and oversized changes, then suggests keep, split, or justify actions.