[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M799K3ZWX23WJ8KY85K53PWN":3,"skill-same:01M799K3ZWX23WJ8KY85K53PWN":75},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":33,"commitSha":34,"skillDirectory":35,"forksCount":14,"repositoryHtmlUrl":36,"repositoryHomepageUrl":6,"ownerHtmlUrl":37,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":38,"install":39,"resources":52},"01M799K3ZWX23WJ8KY85K53PWN","database-optimizer",null,"Optimizes database queries and improves performance across PostgreSQL and MySQL systems. Use when investigating slow queries, analyzing execution plans, or optimizing database performance. Invoke for index design, query rewrites, configuration tuning, partitioning strategies, lock contention resolution.","Elogic360\u002Fsoftware-factory","Elogic360","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F156535519?v=4","01M74NH3F0RB13PWB7JZDE2V80","elogic360","01M74NH3FPC65082MDZVMFHDM3",0,"MIT","https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory\u002Fblob\u002Fmain\u002Fintegrations\u002Fclaude-skills-jeffallan\u002Fskills\u002Fdatabase-optimizer\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: database-optimizer\ndescription: Optimizes database queries and improves performance across PostgreSQL and MySQL systems. Use when investigating slow queries, analyzing execution plans, or optimizing database performance. Invoke for index design, query rewrites, configuration tuning, partitioning strategies, lock contention resolution.\nlicense: MIT\nmetadata:\n  author: https:\u002F\u002Fgithub.com\u002FJeffallan\n  version: \"1.1.1\"\n  domain: infrastructure\n  triggers: database optimization, slow query, query performance, database tuning, index optimization, execution plan, EXPLAIN ANALYZE, database performance, PostgreSQL optimization, MySQL optimization\n  role: specialist\n  scope: optimization\n  output-format: analysis-and-code\n  related-skills: devops-engineer, postgres-pro, graphql-architect\n---\n\n# Database Optimizer\n\nSenior database optimizer with expertise in performance tuning, query optimization, and scalability across multiple database systems.\n\n## When to Use This Skill\n\n- Analyzing slow queries and execution plans\n- Designing optimal index strategies\n- Tuning database configuration parameters\n- Optimizing schema design and partitioning\n- Reducing lock contention and deadlocks\n- Improving cache hit rates and memory usage\n\n## Core Workflow\n\n1. **Analyze Performance** — Capture baseline metrics and run `EXPLAIN ANALYZE` before any changes\n2. **Identify Bottlenecks** — Find inefficient queries, missing indexes, config issues\n3. **Design Solutions** — Create index strategies, query rewrites, schema improvements\n4. **Implement Changes** — Apply optimizations incrementally with monitoring; validate each change before proceeding to the next\n5. **Validate Results** — Re-run `EXPLAIN ANALYZE`, compare costs, measure wall-clock improvement, document changes\n\n> ⚠️ Always test changes in non-production first. Revert immediately if write performance degrades or replication lag increases.\n\n## Reference Guide\n\nLoad detailed guidance based on context:\n\n| Topic | Reference | Load When |\n|-------|-----------|-----------|\n| Query Optimization | `references\u002Fquery-optimization.md` | Analyzing slow queries, execution plans |\n| Index Strategies | `references\u002Findex-strategies.md` | Designing indexes, covering indexes |\n| PostgreSQL Tuning | `references\u002Fpostgresql-tuning.md` | PostgreSQL-specific optimizations |\n| MySQL Tuning | `references\u002Fmysql-tuning.md` | MySQL-specific optimizations |\n| Monitoring & Analysis | `references\u002Fmonitoring-analysis.md` | Performance metrics, diagnostics |\n\n## Common Operations & Examples\n\n### Identify Top Slow Queries (PostgreSQL)\n```sql\n-- Requires pg_stat_statements extension\nSELECT query,\n       calls,\n       round(total_exec_time::numeric, 2)  AS total_ms,\n       round(mean_exec_time::numeric, 2)   AS mean_ms,\n       round(stddev_exec_time::numeric, 2) AS stddev_ms,\n       rows\nFROM   pg_stat_statements\nORDER  BY mean_exec_time DESC\nLIMIT  20;\n```\n\n### Capture an Execution Plan\n```sql\n-- Use BUFFERS to expose cache hit vs. disk read ratio\nEXPLAIN (ANALYZE, BUFFERS, FORMAT TEXT)\nSELECT o.id, c.name\nFROM   orders o\nJOIN   customers c ON c.id = o.customer_id\nWHERE  o.status = 'pending'\n  AND  o.created_at > now() - interval '7 days';\n```\n\n### Reading EXPLAIN Output — Key Patterns to Find\n\n| Pattern | Symptom | Typical Remedy |\n|---------|---------|----------------|\n| `Seq Scan` on large table | High row estimate, no filter selectivity | Add B-tree index on filter column |\n| `Nested Loop` with large outer set | Exponential row growth in inner loop | Consider Hash Join; index inner join key |\n| `cost=... rows=1` but actual rows=50000 | Stale statistics | Run `ANALYZE \u003Ctable>;` |\n| `Buffers: hit=10 read=90000` | Low buffer cache hit rate | Increase `shared_buffers`; add covering index |\n| `Sort Method: external merge` | Sort spilling to disk | Increase `work_mem` for the session |\n\n### Create a Covering Index\n```sql\n-- Covers the filter AND the projected columns, eliminating a heap fetch\nCREATE INDEX CONCURRENTLY idx_orders_status_created_covering\n    ON orders (status, created_at)\n    INCLUDE (customer_id, total_amount);\n```\n\n### Validate Improvement\n```sql\n-- Before optimization: save plan & timing\nEXPLAIN (ANALYZE, BUFFERS) \u003Cquery>;   -- note \"Execution Time: X ms\"\n\n-- After optimization: compare\nEXPLAIN (ANALYZE, BUFFERS) \u003Cquery>;   -- target meaningful reduction in cost & time\n\n-- Confirm index is actually used\nSELECT indexname, idx_scan, idx_tup_read, idx_tup_fetch\nFROM   pg_stat_user_indexes\nWHERE  relname = 'orders';\n```\n\n### MySQL: Find Slow Queries\n```sql\n-- Inspect slow query log candidates\nSELECT * FROM performance_schema.events_statements_summary_by_digest\nORDER  BY SUM_TIMER_WAIT DESC\nLIMIT  20;\n\n-- Execution plan\nEXPLAIN FORMAT=JSON\nSELECT * FROM orders WHERE status = 'pending' AND created_at > NOW() - INTERVAL 7 DAY;\n```\n\n## Constraints\n\n### MUST DO\n- Capture `EXPLAIN (ANALYZE, BUFFERS)` output **before** optimizing — this is the baseline\n- Measure performance before and after every change\n- Create indexes with `CONCURRENTLY` (PostgreSQL) to avoid table locks\n- Test in non-production; roll back if write performance or replication lag worsens\n- Document all optimization decisions with before\u002Fafter metrics\n- Run `ANALYZE` after bulk data changes to refresh statistics\n\n### MUST NOT DO\n- Apply optimizations without a measured baseline\n- Create redundant or unused indexes\n- Make multiple changes simultaneously (impossible to attribute impact)\n- Ignore write amplification caused by new indexes\n- Neglect `VACUUM` \u002F statistics maintenance\n\n## Output Templates\n\nWhen optimizing database performance, provide:\n1. Performance analysis with baseline metrics (query time, cost, buffer hit ratio)\n2. Identified bottlenecks and root causes (with EXPLAIN evidence)\n3. Optimization strategy with specific changes\n4. Implementation SQL \u002F config changes\n5. Validation queries to measure improvement\n6. Monitoring recommendations\n\n[Documentation](https:\u002F\u002Fjeffallan.github.io\u002Fclaude-skills\u002Fskills\u002Finfrastructure\u002Fdatabase-optimizer\u002F)\n","# Database Optimizer\n\nSenior database optimizer with expertise in performance tuning, query optimization, and scalability across multiple database systems.\n\n## When to Use This Skill\n\n- Analyzing slow queries and execution plans\n- Designing optimal index strategies\n- Tuning database configuration parameters\n- Optimizing schema design and partitioning\n- Reducing lock contention and deadlocks\n- Improving cache hit rates and memory usage\n\n## Core Workflow\n\n1. **Analyze Performance** — Capture baseline metrics and run `EXPLAIN ANALYZE` before any changes\n2. **Identify Bottlenecks** — Find inefficient queries, missing indexes, config issues\n3. **Design Solutions** — Create index strategies, query rewrites, schema improvements\n4. **Implement Changes** — Apply optimizations incrementally with monitoring; validate each change before proceeding to the next\n5. **Validate Results** — Re-run `EXPLAIN ANALYZE`, compare costs, measure wall-clock improvement, document changes\n\n> ⚠️ Always test changes in non-production first. Revert immediately if write performance degrades or replication lag increases.\n\n## Reference Guide\n\nLoad detailed guidance based on context:\n\n| Topic | Reference | Load When |\n|-------|-----------|-----------|\n| Query Optimization | `references\u002Fquery-optimization.md` | Analyzing slow queries, execution plans |\n| Index Strategies | `references\u002Findex-strategies.md` | Designing indexes, covering indexes |\n| PostgreSQL Tuning | `references\u002Fpostgresql-tuning.md` | PostgreSQL-specific optimizations |\n| MySQL Tuning | `references\u002Fmysql-tuning.md` | MySQL-specific optimizations |\n| Monitoring & Analysis | `references\u002Fmonitoring-analysis.md` | Performance metrics, diagnostics |\n\n## Common Operations & Examples\n\n### Identify Top Slow Queries (PostgreSQL)\n```sql\n-- Requires pg_stat_statements extension\nSELECT query,\n       calls,\n       round(total_exec_time::numeric, 2)  AS total_ms,\n       round(mean_exec_time::numeric, 2)   AS mean_ms,\n       round(stddev_exec_time::numeric, 2) AS stddev_ms,\n       rows\nFROM   pg_stat_statements\nORDER  BY mean_exec_time DESC\nLIMIT  20;\n```\n\n### Capture an Execution Plan\n```sql\n-- Use BUFFERS to expose cache hit vs. disk read ratio\nEXPLAIN (ANALYZE, BUFFERS, FORMAT TEXT)\nSELECT o.id, c.name\nFROM   orders o\nJOIN   customers c ON c.id = o.customer_id\nWHERE  o.status = 'pending'\n  AND  o.created_at > now() - interval '7 days';\n```\n\n### Reading EXPLAIN Output — Key Patterns to Find\n\n| Pattern | Symptom | Typical Remedy |\n|---------|---------|----------------|\n| `Seq Scan` on large table | High row estimate, no filter selectivity | Add B-tree index on filter column |\n| `Nested Loop` with large outer set | Exponential row growth in inner loop | Consider Hash Join; index inner join key |\n| `cost=... rows=1` but actual rows=50000 | Stale statistics | Run `ANALYZE \u003Ctable>;` |\n| `Buffers: hit=10 read=90000` | Low buffer cache hit rate | Increase `shared_buffers`; add covering index |\n| `Sort Method: external merge` | Sort spilling to disk | Increase `work_mem` for the session |\n\n### Create a Covering Index\n```sql\n-- Covers the filter AND the projected columns, eliminating a heap fetch\nCREATE INDEX CONCURRENTLY idx_orders_status_created_covering\n    ON orders (status, created_at)\n    INCLUDE (customer_id, total_amount);\n```\n\n### Validate Improvement\n```sql\n-- Before optimization: save plan & timing\nEXPLAIN (ANALYZE, BUFFERS) \u003Cquery>;   -- note \"Execution Time: X ms\"\n\n-- After optimization: compare\nEXPLAIN (ANALYZE, BUFFERS) \u003Cquery>;   -- target meaningful reduction in cost & time\n\n-- Confirm index is actually used\nSELECT indexname, idx_scan, idx_tup_read, idx_tup_fetch\nFROM   pg_stat_user_indexes\nWHERE  relname = 'orders';\n```\n\n### MySQL: Find Slow Queries\n```sql\n-- Inspect slow query log candidates\nSELECT * FROM performance_schema.events_statements_summary_by_digest\nORDER  BY SUM_TIMER_WAIT DESC\nLIMIT  20;\n\n-- Execution plan\nEXPLAIN FORMAT=JSON\nSELECT * FROM orders WHERE status = 'pending' AND created_at > NOW() - INTERVAL 7 DAY;\n```\n\n## Constraints\n\n### MUST DO\n- Capture `EXPLAIN (ANALYZE, BUFFERS)` output **before** optimizing — this is the baseline\n- Measure performance before and after every change\n- Create indexes with `CONCURRENTLY` (PostgreSQL) to avoid table locks\n- Test in non-production; roll back if write performance or replication lag worsens\n- Document all optimization decisions with before\u002Fafter metrics\n- Run `ANALYZE` after bulk data changes to refresh statistics\n\n### MUST NOT DO\n- Apply optimizations without a measured baseline\n- Create redundant or unused indexes\n- Make multiple changes simultaneously (impossible to attribute impact)\n- Ignore write amplification caused by new indexes\n- Neglect `VACUUM` \u002F statistics maintenance\n\n## Output Templates\n\nWhen optimizing database performance, provide:\n1. Performance analysis with baseline metrics (query time, cost, buffer hit ratio)\n2. Identified bottlenecks and root causes (with EXPLAIN evidence)\n3. Optimization strategy with specific changes\n4. Implementation SQL \u002F config changes\n5. Validation queries to measure improvement\n6. Monitoring recommendations\n\n[Documentation](https:\u002F\u002Fjeffallan.github.io\u002Fclaude-skills\u002Fskills\u002Finfrastructure\u002Fdatabase-optimizer\u002F)\n",{"name":5,"license":15,"metadata":24,"description":7},{"role":25,"scope":26,"author":27,"domain":28,"version":29,"triggers":30,"output-format":31,"related-skills":32},"specialist","optimization","https:\u002F\u002Fgithub.com\u002FJeffallan","infrastructure","1.1.1","database optimization, slow query, query performance, database tuning, index optimization, execution plan, EXPLAIN ANALYZE, database performance, PostgreSQL optimization, MySQL optimization","analysis-and-code","devops-engineer, postgres-pro, graphql-architect","main","c475fc64e94e803b50d14a791dfee8853fbb2c5c","integrations\u002Fclaude-skills-jeffallan\u002Fskills\u002Fdatabase-optimizer","https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory","https:\u002F\u002Fgithub.com\u002FElogic360","2026-11-08 22:21:22",{"source":8,"skillName":5,"commands":40,"prompt":50,"zipAvailable":51},[41,44,47],{"tool":42,"command":43},"npx","npx skills add Elogic360\u002Fsoftware-factory --skill database-optimizer",{"tool":45,"command":46},"bunx","bunx skills add Elogic360\u002Fsoftware-factory --skill database-optimizer",{"tool":48,"command":49},"pnpm","pnpm dlx skills add Elogic360\u002Fsoftware-factory --skill database-optimizer","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory\u002Fblob\u002Fmain\u002Fintegrations\u002Fclaude-skills-jeffallan\u002Fskills\u002Fdatabase-optimizer\u002FSKILL.md",true,[53,59,63,67,71],{"path":54,"resourceType":55,"resourceTypeDesc":56,"sizeBytes":57,"sourceHtmlUrl":58},"references\u002Findex-strategies.md","REFERENCE","参考文档",8131,"https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory\u002Fblob\u002Fmain\u002Fintegrations\u002Fclaude-skills-jeffallan\u002Fskills\u002Fdatabase-optimizer\u002Freferences\u002Findex-strategies.md",{"path":60,"resourceType":55,"resourceTypeDesc":56,"sizeBytes":61,"sourceHtmlUrl":62},"references\u002Fmonitoring-analysis.md",14596,"https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory\u002Fblob\u002Fmain\u002Fintegrations\u002Fclaude-skills-jeffallan\u002Fskills\u002Fdatabase-optimizer\u002Freferences\u002Fmonitoring-analysis.md",{"path":64,"resourceType":55,"resourceTypeDesc":56,"sizeBytes":65,"sourceHtmlUrl":66},"references\u002Fmysql-tuning.md",11021,"https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory\u002Fblob\u002Fmain\u002Fintegrations\u002Fclaude-skills-jeffallan\u002Fskills\u002Fdatabase-optimizer\u002Freferences\u002Fmysql-tuning.md",{"path":68,"resourceType":55,"resourceTypeDesc":56,"sizeBytes":69,"sourceHtmlUrl":70},"references\u002Fpostgresql-tuning.md",10284,"https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory\u002Fblob\u002Fmain\u002Fintegrations\u002Fclaude-skills-jeffallan\u002Fskills\u002Fdatabase-optimizer\u002Freferences\u002Fpostgresql-tuning.md",{"path":72,"resourceType":55,"resourceTypeDesc":56,"sizeBytes":73,"sourceHtmlUrl":74},"references\u002Fquery-optimization.md",5793,"https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory\u002Fblob\u002Fmain\u002Fintegrations\u002Fclaude-skills-jeffallan\u002Fskills\u002Fdatabase-optimizer\u002Freferences\u002Fquery-optimization.md",[76,84,91,98,105,112],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":80,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":19},"01M79G206MT3J6S0GY3C45P2KV","vss-summarize-video","Use to summarize a recorded video via the LVS summarization microservice (HITL-gated) with a VLM fallback. Not for report generation or live RTSP captioning.","Apache-2.0","https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory\u002Fblob\u002Fmain\u002Fskills\u002Fnvidia\u002Fvss-summarize-video\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":80,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":19},"01M79G1WN63PGRE8CKD47WEBQ5","vss-setup-video-analytics-api","Use to deploy the vss-video-analytics-api REST service standalone (config-source, data-log bind, Elasticsearch, optional Kafka). Not for full warehouse deploy.","https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory\u002Fblob\u002Fmain\u002Fskills\u002Fnvidia\u002Fvss-setup-video-analytics-api\u002FSKILL.md",[],[],{"skillNo":92,"name":93,"nameZh":6,"description":94,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":80,"licenseFileUrl":6,"sourceHtmlUrl":95,"categories":96,"keywords":97,"publishedAt":19},"01M79G1S9F7VY3EF6H53PRP5AN","vss-setup-behavior-analytics","Use to deploy the vss-behavior-analytics service standalone (entrypoint, config-source, optional calibration). Not for the full warehouse deploy.","https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory\u002Fblob\u002Fmain\u002Fskills\u002Fnvidia\u002Fvss-setup-behavior-analytics\u002FSKILL.md",[],[],{"skillNo":99,"name":100,"nameZh":6,"description":101,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":80,"licenseFileUrl":6,"sourceHtmlUrl":102,"categories":103,"keywords":104,"publishedAt":19},"01M79G1N1S1Y27PFZPYMNK1MTQ","vss-search-archive","Use this skill to run top-level VSS fusion search on archived video, or to ingest video files \u002F RTSP streams for search. Do NOT use for ad-hoc visual Q&A (use vss-ask-video), live captioning (use vss-deploy-dense-captioning), or video summarization and reports (use vss-summarize-video).","https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory\u002Fblob\u002Fmain\u002Fskills\u002Fnvidia\u002Fvss-search-archive\u002FSKILL.md",[],[],{"skillNo":106,"name":107,"nameZh":6,"description":108,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":80,"licenseFileUrl":6,"sourceHtmlUrl":109,"categories":110,"keywords":111,"publishedAt":19},"01M79G1H6WN0Q6C0VCAXCZX6B7","vss-query-analytics","Use this skill when reading video-analytics metrics, incidents, alerts, and sensor data via the VA-MCP server (port 9901). Not for live VLM or incident-range narrative reports.","https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory\u002Fblob\u002Fmain\u002Fskills\u002Fnvidia\u002Fvss-query-analytics\u002FSKILL.md",[],[],{"skillNo":113,"name":114,"nameZh":6,"description":115,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":80,"licenseFileUrl":6,"sourceHtmlUrl":116,"categories":117,"keywords":118,"publishedAt":19},"01M79G1DYPNXQS7QHZ0AAF5FX5","vss-manage-video-io-storage","Use to call the VIOS REST API (sensor list, timelines, clip extraction, snapshots, add\u002Fdelete sensors and streams). Not for VLM inference or search.","https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory\u002Fblob\u002Fmain\u002Fskills\u002Fnvidia\u002Fvss-manage-video-io-storage\u002FSKILL.md",[],[]]