[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M71AWPEH6ZS3XF87NGXGA7HT":3,"skill-same:01M71AWPEH6ZS3XF87NGXGA7HT":85},{"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":23,"publishedAt":44,"linkOnly":45,"markdownContent":46,"markdownBody":47,"frontMatter":48,"refName":61,"commitSha":62,"skillDirectory":63,"forksCount":64,"repositoryHtmlUrl":65,"repositoryHomepageUrl":66,"ownerHtmlUrl":67,"ownerBlogUrl":68,"ownerDescription":69,"updatedAt":70,"install":71,"resources":84},"01M71AWPEH6ZS3XF87NGXGA7HT","db-optimize",null,"Database performance audit — detects N+1 queries, missing indexes, join\nopportunities, slow queries, EXPLAIN analysis, and per-endpoint DB call counts.\nUse when asked to \"optimize the database\", \"find slow queries\", \"check for N+1\",\n\"analyze query performance\", or \"audit DB calls\".","ariadoss\u002Fsuperskills","ariadoss","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F414341?v=4","01M71AC7383PT6JCRZSQJ4AVTM","Danilo Stern-Sapad","01M71AC73Y7NTBTJ9KQYNENRRE",12,"MIT","https:\u002F\u002Fgithub.com\u002Fariadoss\u002Fsuperskills\u002Fblob\u002Fmain\u002Fskills\u002Fdb-optimize\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000010","后端与接口","SCENARIO","使用场景",[24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43],"optimize","db optimize","db","call","database performance","when","for","calls","missing","join","database","query","analysis","performance","queries","use","check","explain","analyze","Bash","2026-11-10 10:12:30",false,"---\nname: db-optimize\nversion: 1.0.0\ndescription: |\n  Database performance audit — detects N+1 queries, missing indexes, join\n  opportunities, slow queries, EXPLAIN analysis, and per-endpoint DB call counts.\n  Use when asked to \"optimize the database\", \"find slow queries\", \"check for N+1\",\n  \"analyze query performance\", or \"audit DB calls\".\ntriggers:\n  - optimize database\n  - find slow queries\n  - check for N+1\n  - database performance\n  - audit DB calls\n  - explain query\nallowed-tools:\n  - Bash\n  - Read\n  - Grep\n  - Glob\n---\n\n# \u002Fdb-optimize\n\nComprehensive database performance audit: N+1 detection, EXPLAIN analysis, slow query log review, index gaps, join opportunities, and per-endpoint call counts.\n\n## Step 1: Check for DBMAP.md\n\n```bash\n[ -f DBMAP.md ] && echo \"DBMAP_EXISTS=true\" || echo \"DBMAP_EXISTS=false\"\n```\n\nIf `DBMAP_EXISTS=false`, tell the user: \"No DBMAP.md found. Run `\u002Fdbmap` first to generate a schema map — this audit uses it to cross-reference indexes and table structure.\"\n\n## Step 2: Slow query log\n\nCheck if a slow query log exists or can be accessed:\n\n```bash\n# PostgreSQL — check pg_stat_statements if available\npsql \"$DATABASE_URL\" -c \"SELECT query, calls, total_exec_time, mean_exec_time, rows FROM pg_stat_statements ORDER BY mean_exec_time DESC LIMIT 20;\" 2>\u002Fdev\u002Fnull || echo \"PG_STAT_UNAVAILABLE\"\n\n# MySQL — check slow query log location\nmysql -e \"SHOW VARIABLES LIKE 'slow_query_log%';\" 2>\u002Fdev\u002Fnull || echo \"MYSQL_UNAVAILABLE\"\n```\n\nIf neither is available, scan the codebase for query logging output files:\n\n```bash\nfind . -name \"*.log\" | xargs grep -l \"slow\\|duration\\|query_time\" 2>\u002Fdev\u002Fnull | head -5\n```\n\nReport the 10 slowest queries found, sorted by mean execution time. For each: query text (truncated to 120 chars), call count, mean time (ms), total time (ms).\n\n## Step 3: EXPLAIN analysis\n\nFor each slow query identified in Step 2 (or any query the user provides), run EXPLAIN ANALYZE:\n\n```sql\nEXPLAIN (ANALYZE, BUFFERS, FORMAT TEXT) \u003Cquery>;\n```\n\nInterpret the output and flag:\n- **Seq Scan** on large tables (>1000 rows) — missing index\n- **Nested Loop** with high row estimates — consider hash join or index\n- **Hash Join** with high memory usage — consider work_mem tuning\n- **Sort** without index — consider index on ORDER BY column\n- **high actual rows >> estimated rows** — stale statistics, suggest `ANALYZE \u003Ctable>`\n\nFormat findings as:\n```\nEXPLAIN: \u003Cquery summary>\n  ⚠ Seq Scan on orders (5,432 rows) — add index on orders.user_id\n  ⚠ Sort on created_at — add index on events(created_at)\n  ✓ Index Scan on users — OK\n```\n\n## Step 4: N+1 detection\n\nScan the codebase for N+1 patterns:\n\n**ORM patterns to flag:**\n- A loop containing a DB call (`.find`, `.where`, `.query`, `.fetch`, `.get`, `.filter`, `.select`)\n- Accessing a relation inside a loop without eager loading (`.user`, `.author`, `.comments`, `.items` etc. on a model instance inside a loop)\n- Multiple sequential awaits on DB calls inside a loop\n\n```bash\n# Find loops with DB calls inside\ngrep -rn \"for\\|each\\|map\\|forEach\\|loop\" --include=\"*.rb\" --include=\"*.py\" --include=\"*.js\" --include=\"*.ts\" --include=\"*.go\" --include=\"*.java\" . | head -5\n```\n\nFor each file with loop+query patterns, read the surrounding context and determine if it's a true N+1.\n\nFlag as:\n```\n⚠ N+1 DETECTED: app\u002Fcontrollers\u002Forders_controller.rb:45\n  Loop over orders calls order.user on each iteration\n  Fix: Use includes(:user) \u002F eager_load(:user) \u002F preload(:user)\n  SQL impact: 1 query → 1+N queries (N = number of orders)\n```\n\n## Step 5: Per-endpoint DB call audit\n\nScan route handlers \u002F controller actions for query counts:\n\nFor each endpoint\u002Faction found, count the number of distinct DB calls made:\n- Direct SQL: `db.query`, `connection.execute`, `pool.query`\n- ORM: `.find`, `.findAll`, `.where`, `.first`, `.save`, `.create`, `.update`\n- Each call inside a loop counts as N calls\n\nFlag any endpoint making **more than 3 DB calls** as a candidate for optimization:\n```\n⚠ HIGH DB CALL COUNT: GET \u002Fapi\u002Forders (OrdersController#index)\n  8 DB calls detected:\n    - Order.all (1)\n    - order.user (N — N+1 pattern)\n    - order.items (N — N+1 pattern)\n  Fix: Use a single query with LEFT JOINs or eager loading\n```\n\n## Step 6: Join opportunities\n\nFind places where multiple sequential queries fetch related data that could be a single LEFT JOIN:\n\nPattern: two queries where the second uses IDs from the first result.\n\n```\n💡 JOIN OPPORTUNITY: app\u002Fservices\u002Fdashboard_service.rb:23-31\n  Query 1: SELECT * FROM orders WHERE user_id = ?\n  Query 2: SELECT * FROM items WHERE order_id IN (...)\n  Fix: SELECT o.*, i.* FROM orders o LEFT JOIN items i ON i.order_id = o.id WHERE o.user_id = ?\n```\n\n## Step 7: Summary report\n\nOutput a prioritized findings report:\n\n```\n## DB Optimization Report\n\n### Critical (fix immediately)\n- N+1 queries: X found\n- Endpoints with >10 DB calls: Y found\n\n### High Priority\n- Slow queries (>100ms mean): Z found\n- Missing indexes on FK columns: W found (see DBMAP.md Index Analysis)\n\n### Optimization Opportunities\n- JOIN consolidations: V found\n- EXPLAIN issues: U found\n\n### Recommended next steps\n1. [highest impact fix]\n2. [second fix]\n3. ...\n```\n\nAsk the user: \"Want me to implement any of these fixes now? I can start with the highest-impact items.\"\n","# \u002Fdb-optimize\n\nComprehensive database performance audit: N+1 detection, EXPLAIN analysis, slow query log review, index gaps, join opportunities, and per-endpoint call counts.\n\n## Step 1: Check for DBMAP.md\n\n```bash\n[ -f DBMAP.md ] && echo \"DBMAP_EXISTS=true\" || echo \"DBMAP_EXISTS=false\"\n```\n\nIf `DBMAP_EXISTS=false`, tell the user: \"No DBMAP.md found. Run `\u002Fdbmap` first to generate a schema map — this audit uses it to cross-reference indexes and table structure.\"\n\n## Step 2: Slow query log\n\nCheck if a slow query log exists or can be accessed:\n\n```bash\n# PostgreSQL — check pg_stat_statements if available\npsql \"$DATABASE_URL\" -c \"SELECT query, calls, total_exec_time, mean_exec_time, rows FROM pg_stat_statements ORDER BY mean_exec_time DESC LIMIT 20;\" 2>\u002Fdev\u002Fnull || echo \"PG_STAT_UNAVAILABLE\"\n\n# MySQL — check slow query log location\nmysql -e \"SHOW VARIABLES LIKE 'slow_query_log%';\" 2>\u002Fdev\u002Fnull || echo \"MYSQL_UNAVAILABLE\"\n```\n\nIf neither is available, scan the codebase for query logging output files:\n\n```bash\nfind . -name \"*.log\" | xargs grep -l \"slow\\|duration\\|query_time\" 2>\u002Fdev\u002Fnull | head -5\n```\n\nReport the 10 slowest queries found, sorted by mean execution time. For each: query text (truncated to 120 chars), call count, mean time (ms), total time (ms).\n\n## Step 3: EXPLAIN analysis\n\nFor each slow query identified in Step 2 (or any query the user provides), run EXPLAIN ANALYZE:\n\n```sql\nEXPLAIN (ANALYZE, BUFFERS, FORMAT TEXT) \u003Cquery>;\n```\n\nInterpret the output and flag:\n- **Seq Scan** on large tables (>1000 rows) — missing index\n- **Nested Loop** with high row estimates — consider hash join or index\n- **Hash Join** with high memory usage — consider work_mem tuning\n- **Sort** without index — consider index on ORDER BY column\n- **high actual rows >> estimated rows** — stale statistics, suggest `ANALYZE \u003Ctable>`\n\nFormat findings as:\n```\nEXPLAIN: \u003Cquery summary>\n  ⚠ Seq Scan on orders (5,432 rows) — add index on orders.user_id\n  ⚠ Sort on created_at — add index on events(created_at)\n  ✓ Index Scan on users — OK\n```\n\n## Step 4: N+1 detection\n\nScan the codebase for N+1 patterns:\n\n**ORM patterns to flag:**\n- A loop containing a DB call (`.find`, `.where`, `.query`, `.fetch`, `.get`, `.filter`, `.select`)\n- Accessing a relation inside a loop without eager loading (`.user`, `.author`, `.comments`, `.items` etc. on a model instance inside a loop)\n- Multiple sequential awaits on DB calls inside a loop\n\n```bash\n# Find loops with DB calls inside\ngrep -rn \"for\\|each\\|map\\|forEach\\|loop\" --include=\"*.rb\" --include=\"*.py\" --include=\"*.js\" --include=\"*.ts\" --include=\"*.go\" --include=\"*.java\" . | head -5\n```\n\nFor each file with loop+query patterns, read the surrounding context and determine if it's a true N+1.\n\nFlag as:\n```\n⚠ N+1 DETECTED: app\u002Fcontrollers\u002Forders_controller.rb:45\n  Loop over orders calls order.user on each iteration\n  Fix: Use includes(:user) \u002F eager_load(:user) \u002F preload(:user)\n  SQL impact: 1 query → 1+N queries (N = number of orders)\n```\n\n## Step 5: Per-endpoint DB call audit\n\nScan route handlers \u002F controller actions for query counts:\n\nFor each endpoint\u002Faction found, count the number of distinct DB calls made:\n- Direct SQL: `db.query`, `connection.execute`, `pool.query`\n- ORM: `.find`, `.findAll`, `.where`, `.first`, `.save`, `.create`, `.update`\n- Each call inside a loop counts as N calls\n\nFlag any endpoint making **more than 3 DB calls** as a candidate for optimization:\n```\n⚠ HIGH DB CALL COUNT: GET \u002Fapi\u002Forders (OrdersController#index)\n  8 DB calls detected:\n    - Order.all (1)\n    - order.user (N — N+1 pattern)\n    - order.items (N — N+1 pattern)\n  Fix: Use a single query with LEFT JOINs or eager loading\n```\n\n## Step 6: Join opportunities\n\nFind places where multiple sequential queries fetch related data that could be a single LEFT JOIN:\n\nPattern: two queries where the second uses IDs from the first result.\n\n```\n💡 JOIN OPPORTUNITY: app\u002Fservices\u002Fdashboard_service.rb:23-31\n  Query 1: SELECT * FROM orders WHERE user_id = ?\n  Query 2: SELECT * FROM items WHERE order_id IN (...)\n  Fix: SELECT o.*, i.* FROM orders o LEFT JOIN items i ON i.order_id = o.id WHERE o.user_id = ?\n```\n\n## Step 7: Summary report\n\nOutput a prioritized findings report:\n\n```\n## DB Optimization Report\n\n### Critical (fix immediately)\n- N+1 queries: X found\n- Endpoints with >10 DB calls: Y found\n\n### High Priority\n- Slow queries (>100ms mean): Z found\n- Missing indexes on FK columns: W found (see DBMAP.md Index Analysis)\n\n### Optimization Opportunities\n- JOIN consolidations: V found\n- EXPLAIN issues: U found\n\n### Recommended next steps\n1. [highest impact fix]\n2. [second fix]\n3. ...\n```\n\nAsk the user: \"Want me to implement any of these fixes now? I can start with the highest-impact items.\"\n",{"name":5,"version":49,"triggers":50,"description":56,"allowed-tools":57},"1.0.0",[51,52,53,28,54,55],"optimize database","find slow queries","check for N+1","audit DB calls","explain query","Database performance audit — detects N+1 queries, missing indexes, join\nopportunities, slow queries, EXPLAIN analysis, and per-endpoint DB call counts.\nUse when asked to \"optimize the database\", \"find slow queries\", \"check for N+1\",\n\"analyze query performance\", or \"audit DB calls\".\n",[43,58,59,60],"Read","Grep","Glob","main","c7ec8d78e5dc37484c2cfe90ab04de163d97dd41","skills\u002Fdb-optimize",0,"https:\u002F\u002Fgithub.com\u002Fariadoss\u002Fsuperskills","https:\u002F\u002Fhyperion360.com\u002Fblog\u002Fparallel-ai-agents-engineering-workflow\u002F","https:\u002F\u002Fgithub.com\u002Fariadoss","https:\u002F\u002Fdanilosapad.com\u002F","CEO & Founder of @Hyperion360","2026-11-01 12:36:50",{"source":8,"skillName":5,"commands":72,"prompt":82,"zipAvailable":83},[73,76,79],{"tool":74,"command":75},"npx","npx skills add ariadoss\u002Fsuperskills --skill db-optimize",{"tool":77,"command":78},"bunx","bunx skills add ariadoss\u002Fsuperskills --skill db-optimize",{"tool":80,"command":81},"pnpm","pnpm dlx skills add ariadoss\u002Fsuperskills --skill db-optimize","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fariadoss\u002Fsuperskills\u002Fblob\u002Fmain\u002Fskills\u002Fdb-optimize\u002FSKILL.md",true,[],[86,110,134,153,180,196],{"skillNo":87,"name":88,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":95,"publishedAt":44},"01M71AZE3MPF891RM354EMRYA1","youtube","Download YouTube video transcripts when user provides a YouTube URL or asks to download\u002Fget\u002Ffetch a transcript from YouTube. Also use when user wants to transcribe or get captions\u002Fsubtitles from a YouTube video.","https:\u002F\u002Fgithub.com\u002Fariadoss\u002Fsuperskills\u002Fblob\u002Fmain\u002Fskills\u002Fyoutube\u002FSKILL.md",[92],{"categoryNo":93,"categoryName":94,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000016","图像与多媒体",[88,96,97,98,99,100,101,43,102,29,103,104,105,106,107,39,108,109],"user","download","transcribe","write","transcript","video transcripts","URL","Captions","get","fetch","Video","read","subtitles","transcripts",{"skillNo":111,"name":112,"nameZh":6,"description":113,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":114,"categories":115,"keywords":116,"publishedAt":44},"01M71AZAYR85PW6BJGSQXS4BN2","write-plan","Use when you have a spec or requirements for a multi-step task, before touching code. Produces an engineering plan complete with TDD tasks, DRY\u002FSOLID\u002FYAGNI principles, a required Test Plan & Verification section, and a coverage target — then auto-runs \u002Fplan-eng-review as an independent double-check before execution.","https:\u002F\u002Fgithub.com\u002Fariadoss\u002Fsuperskills\u002Fblob\u002Fmain\u002Fskills\u002Fwrite-plan\u002FSKILL.md",[],[117,118,99,119,120,121,122,123,124,29,125,126,127,128,129,30,130,131,132,133],"write plan","plan","dry","verification","review","tasks","code","you","auto","eng","coverage","complete","section","test plan","target","as","yagni",{"skillNo":135,"name":136,"nameZh":6,"description":137,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":138,"categories":139,"keywords":140,"publishedAt":44},"01M71AZ8NDDP5ZMGEE6FSC4FKR","worktrees","Use when starting feature work that needs isolation from current workspace or before executing implementation plans - creates isolated git worktrees with smart directory selection and safety verification","https:\u002F\u002Fgithub.com\u002Fariadoss\u002Fsuperskills\u002Fblob\u002Fmain\u002Fskills\u002Fworktrees\u002FSKILL.md",[],[136,141,142,143,39,144,145,146,147,148,149,120,150,29,151,152],"implementation","workspace","with","plans","feature","isolation","git","directory","work","git worktrees","selection","Safety",{"skillNo":154,"name":155,"nameZh":6,"description":156,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":157,"categories":158,"keywords":162,"publishedAt":44},"01M71AZ4ZQHTNWFRZVYHKQFP08","web-perf","Analyzes web performance using Chrome DevTools MCP. Measures Core Web Vitals (LCP, INP, CLS) and supplementary metrics (FCP, TBT, Speed Index), identifies render-blocking resources, network dependency chains, layout shifts, caching issues, and accessibility gaps. Use when asked to audit, profile, debug, or optimize page load performance, Lighthouse scores, or site speed. Biases towards retrieval from current documentation over pre-trained knowledge.","https:\u002F\u002Fgithub.com\u002Fariadoss\u002Fsuperskills\u002Fblob\u002Fmain\u002Fskills\u002Fweb-perf\u002FSKILL.md",[159],{"categoryNo":160,"categoryName":161,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发",[163,164,165,166,167,168,24,169,170,29,171,172,173,174,175,176,37,177,178,179],"web","perf","web perf","resources","MCP","layout","documentation","caching","qa","knowledge","devtools","issues","render","re","chrome devtools","vitals","never",{"skillNo":181,"name":182,"nameZh":6,"description":183,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":184,"categories":185,"keywords":186,"publishedAt":44},"01M71AZ2KZNWYEGKKRMJH8PYG2","verify","Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always","https:\u002F\u002Fgithub.com\u002Fariadoss\u002Fsuperskills\u002Fblob\u002Fmain\u002Fskills\u002Fverify\u002FSKILL.md",[],[182,128,187,188,149,120,189,190,29,191,39,192,193,194,195],"commands","about","claims","output","assertions","claim","prs","evidence","running",{"skillNo":197,"name":198,"nameZh":6,"description":199,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":200,"categories":201,"keywords":202,"publishedAt":44},"01M71AZ0ACCK7N1QMWQK1FV2HJ","validate-idea","Validate a business idea using the minimalist entrepreneur framework. Use when someone has a business idea and wants to test if it's worth pursuing before building anything.","https:\u002F\u002Fgithub.com\u002Fariadoss\u002Fsuperskills\u002Fblob\u002Fmain\u002Fskills\u002Fvalidate-idea\u002FSKILL.md",[],[203,204,205,206,207,208,209,29,210,39,211],"validate","idea","validate idea","framework","it","minimalist","test","business","before building"]