[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6EGPA079Q8M2QZQ4B7TS5TF":3,"skill-same:01M6EGPA079Q8M2QZQ4B7TS5TF":53},{"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":25,"linkOnly":26,"markdownContent":27,"markdownBody":28,"frontMatter":29,"refName":30,"commitSha":31,"skillDirectory":32,"forksCount":33,"repositoryHtmlUrl":34,"repositoryHomepageUrl":6,"ownerHtmlUrl":35,"ownerBlogUrl":36,"ownerDescription":37,"updatedAt":38,"install":39,"resources":52},"01M6EGPA079Q8M2QZQ4B7TS5TF","ln-812-query-optimizer",null,"Fixes N+1 queries, redundant fetches, over-fetching with keep\u002Fdiscard verification","levalencia\u002Fagent-god-mode","levalencia","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F6962857?v=4","01M6EB0FZZ4BPQPC4HET4QY6NM","Luis Valencia ","01M6EB0G4HWHPWW0H9X7QKSAHP",3,"MIT","https:\u002F\u002Fgithub.com\u002Flevalencia\u002Fagent-god-mode\u002Fblob\u002Fmain\u002Forganized-skills\u002Fln-812-query-optimizer\u002FSKILL.md",[],[19,20,21,22,23,24],"query","optimizer","ln 812 query optimizer","verification","queries","keep","2026-11-10 10:12:30",false,"---\nname: ln-812-query-optimizer\ndescription: \"Fixes N+1 queries, redundant fetches, over-fetching with keep\u002Fdiscard verification\"\nlicense: MIT\n---\n\n> **Paths:** File paths (`shared\u002F`, `references\u002F`, `..\u002Fln-*`) are relative to skills repo root. If not found at CWD, locate this SKILL.md directory and go up one level for repo root.\n\n# ln-812-query-optimizer\n\n**Type:** L3 Worker\n**Category:** 8XX Optimization\n**Parent:** ln-810-performance-optimization-coordinator\n\nFixes query efficiency issues found by ln-651-query-efficiency-auditor. Each fix verified via tests with keep\u002Fdiscard pattern. Metric: query count reduction (not runtime benchmark).\n\n---\n\n## Overview\n\n| Aspect | Details |\n|--------|---------|\n| **Input** | Audit findings from `docs\u002Fproject\u002Fpersistence_audit.md` (ln-651 section) OR target file |\n| **Output** | Optimized queries, verification report |\n| **Companion** | ln-651-query-efficiency-auditor (finds issues) → ln-812 (fixes them) |\n\n---\n\n## Workflow\n\n**Phases:** Pre-flight → Load Findings → Prioritize → Fix Loop → Report\n\n---\n\n## Phase 0: Pre-flight Checks\n\n| Check | Required | Action if Missing |\n|-------|----------|-------------------|\n| Audit findings OR target file | Yes | Block optimization |\n| Test infrastructure | Yes | Block (need tests for verification) |\n| Git clean state | Yes | Block (need clean baseline for revert) |\n\n**MANDATORY READ:** Load `shared\u002Freferences\u002Fci_tool_detection.md` — use Test Frameworks section for test detection.\n\n### Worktree & Branch Isolation\n\n**MANDATORY READ:** Load `shared\u002Freferences\u002Fgit_worktree_fallback.md` — use ln-812 row.\n\n---\n\n## Phase 1: Load Findings\n\n### From Audit Report\n\nRead `docs\u002Fproject\u002Fpersistence_audit.md`, extract ln-651 findings:\n\n| Finding Type | Optimization |\n|--------------|-------------|\n| N+1 query | Batch loading \u002F eager loading \u002F `.Include()` \u002F `prefetch_related` |\n| Redundant fetch | Pass object instead of ID, cache result |\n| Over-fetching | Select specific fields \u002F projection \u002F `.Select()` |\n| Missing index hint | Add index annotation \u002F migration |\n| Unbounded query | Add `.Take()` \u002F `LIMIT` \u002F pagination |\n\n### From Target File\n\nIf no audit report: scan target file for query patterns matching the table above.\n\n---\n\n## Phase 2: Prioritize Fixes\n\n| Priority | Criteria |\n|----------|----------|\n| 1 (highest) | N+1 in hot path (called per request) |\n| 2 | Redundant fetches (same entity loaded multiple times) |\n| 3 | Over-fetching (SELECT * where few columns needed) |\n| 4 | Missing pagination on user-facing endpoints |\n\n---\n\n## Phase 3: Fix Loop (Keep\u002FDiscard)\n\n### Per-Fix Cycle\n\n```\nFOR each finding (F1..FN):\n  1. APPLY: Edit query code (surgical change)\n  2. VERIFY: Run tests\n     IF tests FAIL → DISCARD (revert) → next finding\n  3. VERIFY: Tests PASS → KEEP\n  4. LOG: Record fix for report\n```\n\n### Keep\u002FDiscard Decision\n\n| Condition | Decision |\n|-----------|----------|\n| No tests cover affected file\u002Ffunction | SKIP finding — log as \"uncovered, skipped\" |\n| Tests pass | KEEP |\n| Tests fail | DISCARD + log failure reason |\n| Fix introduces new N+1 | DISCARD |\n\n**Note:** No benchmark needed — query optimization metric is correctness (tests pass) + structural improvement (fewer queries). The audit already identified the inefficiency.\n\n---\n\n## Phase 4: Report Results\n\n### Report Schema\n\n| Field | Description |\n|-------|-------------|\n| source | Audit report path or target file |\n| findings_total | Total findings from audit |\n| fixes_applied | Successfully kept fixes |\n| fixes_discarded | Failed fixes with reasons |\n| fix_details[] | Per-fix: finding type, file, before\u002Fafter description |\n\n---\n\n## Configuration\n\n```yaml\nOptions:\n  # Source\n  audit_report: \"docs\u002Fproject\u002Fpersistence_audit.md\"\n  target_file: \"\"               # Alternative to audit report\n\n  # Verification\n  run_tests: true\n\n  # Scope\n  fix_types:                    # Filter which types to fix\n    - n_plus_one\n    - redundant_fetch\n    - over_fetching\n    - unbounded_query\n```\n\n---\n\n## Error Handling\n\n| Error | Cause | Solution |\n|-------|-------|----------|\n| No audit findings | ln-651 not run or no issues | Report \"no findings to optimize\" |\n| ORM-specific syntax | Unknown ORM | Query Context7\u002FRef for ORM docs |\n| Migration needed | Index addition requires migration | Log as manual step, skip |\n\n---\n\n## References\n\n- `..\u002Fln-651-query-efficiency-auditor\u002FSKILL.md` (companion: finds issues)\n- `shared\u002Freferences\u002Fci_tool_detection.md` (test detection)\n\n---\n\n## Definition of Done\n\n- Findings loaded from audit report or target file scan\n- Fixes prioritized (N+1 first, then redundant, over-fetch, unbounded)\n- Each fix applied with keep\u002Fdiscard: tests pass → keep, tests fail → discard\n- No new query inefficiencies introduced by fixes\n- Report returned with findings total, fixes applied, fixes discarded\n\n---\n\n**Version:** 1.0.0\n**Last Updated:** 2026-03-08\n","> **Paths:** File paths (`shared\u002F`, `references\u002F`, `..\u002Fln-*`) are relative to skills repo root. If not found at CWD, locate this SKILL.md directory and go up one level for repo root.\n\n# ln-812-query-optimizer\n\n**Type:** L3 Worker\n**Category:** 8XX Optimization\n**Parent:** ln-810-performance-optimization-coordinator\n\nFixes query efficiency issues found by ln-651-query-efficiency-auditor. Each fix verified via tests with keep\u002Fdiscard pattern. Metric: query count reduction (not runtime benchmark).\n\n---\n\n## Overview\n\n| Aspect | Details |\n|--------|---------|\n| **Input** | Audit findings from `docs\u002Fproject\u002Fpersistence_audit.md` (ln-651 section) OR target file |\n| **Output** | Optimized queries, verification report |\n| **Companion** | ln-651-query-efficiency-auditor (finds issues) → ln-812 (fixes them) |\n\n---\n\n## Workflow\n\n**Phases:** Pre-flight → Load Findings → Prioritize → Fix Loop → Report\n\n---\n\n## Phase 0: Pre-flight Checks\n\n| Check | Required | Action if Missing |\n|-------|----------|-------------------|\n| Audit findings OR target file | Yes | Block optimization |\n| Test infrastructure | Yes | Block (need tests for verification) |\n| Git clean state | Yes | Block (need clean baseline for revert) |\n\n**MANDATORY READ:** Load `shared\u002Freferences\u002Fci_tool_detection.md` — use Test Frameworks section for test detection.\n\n### Worktree & Branch Isolation\n\n**MANDATORY READ:** Load `shared\u002Freferences\u002Fgit_worktree_fallback.md` — use ln-812 row.\n\n---\n\n## Phase 1: Load Findings\n\n### From Audit Report\n\nRead `docs\u002Fproject\u002Fpersistence_audit.md`, extract ln-651 findings:\n\n| Finding Type | Optimization |\n|--------------|-------------|\n| N+1 query | Batch loading \u002F eager loading \u002F `.Include()` \u002F `prefetch_related` |\n| Redundant fetch | Pass object instead of ID, cache result |\n| Over-fetching | Select specific fields \u002F projection \u002F `.Select()` |\n| Missing index hint | Add index annotation \u002F migration |\n| Unbounded query | Add `.Take()` \u002F `LIMIT` \u002F pagination |\n\n### From Target File\n\nIf no audit report: scan target file for query patterns matching the table above.\n\n---\n\n## Phase 2: Prioritize Fixes\n\n| Priority | Criteria |\n|----------|----------|\n| 1 (highest) | N+1 in hot path (called per request) |\n| 2 | Redundant fetches (same entity loaded multiple times) |\n| 3 | Over-fetching (SELECT * where few columns needed) |\n| 4 | Missing pagination on user-facing endpoints |\n\n---\n\n## Phase 3: Fix Loop (Keep\u002FDiscard)\n\n### Per-Fix Cycle\n\n```\nFOR each finding (F1..FN):\n  1. APPLY: Edit query code (surgical change)\n  2. VERIFY: Run tests\n     IF tests FAIL → DISCARD (revert) → next finding\n  3. VERIFY: Tests PASS → KEEP\n  4. LOG: Record fix for report\n```\n\n### Keep\u002FDiscard Decision\n\n| Condition | Decision |\n|-----------|----------|\n| No tests cover affected file\u002Ffunction | SKIP finding — log as \"uncovered, skipped\" |\n| Tests pass | KEEP |\n| Tests fail | DISCARD + log failure reason |\n| Fix introduces new N+1 | DISCARD |\n\n**Note:** No benchmark needed — query optimization metric is correctness (tests pass) + structural improvement (fewer queries). The audit already identified the inefficiency.\n\n---\n\n## Phase 4: Report Results\n\n### Report Schema\n\n| Field | Description |\n|-------|-------------|\n| source | Audit report path or target file |\n| findings_total | Total findings from audit |\n| fixes_applied | Successfully kept fixes |\n| fixes_discarded | Failed fixes with reasons |\n| fix_details[] | Per-fix: finding type, file, before\u002Fafter description |\n\n---\n\n## Configuration\n\n```yaml\nOptions:\n  # Source\n  audit_report: \"docs\u002Fproject\u002Fpersistence_audit.md\"\n  target_file: \"\"               # Alternative to audit report\n\n  # Verification\n  run_tests: true\n\n  # Scope\n  fix_types:                    # Filter which types to fix\n    - n_plus_one\n    - redundant_fetch\n    - over_fetching\n    - unbounded_query\n```\n\n---\n\n## Error Handling\n\n| Error | Cause | Solution |\n|-------|-------|----------|\n| No audit findings | ln-651 not run or no issues | Report \"no findings to optimize\" |\n| ORM-specific syntax | Unknown ORM | Query Context7\u002FRef for ORM docs |\n| Migration needed | Index addition requires migration | Log as manual step, skip |\n\n---\n\n## References\n\n- `..\u002Fln-651-query-efficiency-auditor\u002FSKILL.md` (companion: finds issues)\n- `shared\u002Freferences\u002Fci_tool_detection.md` (test detection)\n\n---\n\n## Definition of Done\n\n- Findings loaded from audit report or target file scan\n- Fixes prioritized (N+1 first, then redundant, over-fetch, unbounded)\n- Each fix applied with keep\u002Fdiscard: tests pass → keep, tests fail → discard\n- No new query inefficiencies introduced by fixes\n- Report returned with findings total, fixes applied, fixes discarded\n\n---\n\n**Version:** 1.0.0\n**Last Updated:** 2026-03-08\n",{"name":5,"license":15,"description":7},"main","fa638b97a18ff6d9f26cf0eaf3dfa123531bcc87","organized-skills\u002Fln-812-query-optimizer",1,"https:\u002F\u002Fgithub.com\u002Flevalencia\u002Fagent-god-mode","https:\u002F\u002Fgithub.com\u002Flevalencia","https:\u002F\u002Fmedium.com\u002F@luisevalencia","Microsoft MVP - Artificial Intelligence\r\nMachine Learning Enthusiast\r\n","2026-05-02 06:55:36",{"source":8,"skillName":5,"commands":40,"prompt":50,"zipAvailable":51},[41,44,47],{"tool":42,"command":43},"npx","npx skills add levalencia\u002Fagent-god-mode --skill ln-812-query-optimizer",{"tool":45,"command":46},"bunx","bunx skills add levalencia\u002Fagent-god-mode --skill ln-812-query-optimizer",{"tool":48,"command":49},"pnpm","pnpm dlx skills add levalencia\u002Fagent-god-mode --skill ln-812-query-optimizer","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Flevalencia\u002Fagent-god-mode\u002Fblob\u002Fmain\u002Forganized-skills\u002Fln-812-query-optimizer\u002FSKILL.md",true,[],[54,76,114,141,167,195],{"skillNo":55,"name":56,"nameZh":6,"description":57,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":58,"categories":59,"keywords":60,"publishedAt":25},"01M6EM8ES5M9J4S8N78NJST0YC","zarr-python","Chunked N-D arrays for cloud storage. Compressed arrays, parallel I\u002FO, S3\u002FGCS integration, NumPy\u002FDask\u002FXarray compatible, for large-scale scientific computing pipelines.","https:\u002F\u002Fgithub.com\u002Flevalencia\u002Fagent-god-mode\u002Fblob\u002Fmain\u002Forganized-skills\u002Fzarr-python\u002FSKILL.md",[],[61,62,63,64,65,66,67,68,69,70,71,72,73,74,75],"python","zarr python","storage","integration","s3","gcs","cloud","dask","parallel","pipelines","arrays","numpy","scientific computing","scale","scientific",{"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":15,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":95,"publishedAt":25},"01M6EM8AR6ZFKZ9YVW8TTG850Z","zabbix","Zabbix monitoring system automation via API and Python. Use when: (1) Managing hosts, templates, items, triggers, or host groups, (2) Automating monitoring configuration, (3) Sending data via Zabbix trapper\u002Fsender, (4) Querying historical data or events, (5) Bulk operations on Zabbix objects, (6) Maintenance window management, (7) User\u002Fpermission management","https:\u002F\u002Fgithub.com\u002Flevalencia\u002Fagent-god-mode\u002Fblob\u002Fmain\u002Forganized-skills\u002Fzabbix-api-skill\u002FSKILL.md",[82,87,90],{"categoryNo":83,"categoryName":84,"taxonomyType":85,"taxonomyTypeDesc":86},"01JBSEEDCAT000000000000010","后端与接口","SCENARIO","使用场景",{"categoryNo":88,"categoryName":89,"taxonomyType":85,"taxonomyTypeDesc":86},"01JBSEEDCAT000000000000023","Skill与智能体开发",{"categoryNo":91,"categoryName":92,"taxonomyType":93,"taxonomyTypeDesc":94},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[78,61,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113],"automation","window management","monitoring","data","templates","api","system","operations","use","maintenance","objects","permission","bulk operations","triggers","host","events","via","bulk",{"skillNo":115,"name":116,"nameZh":6,"description":117,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":118,"categories":119,"keywords":120,"publishedAt":25},"01M6EM6Q9JG846ECQY9A210A26","x-twitter-growth","X\u002FTwitter growth engine for building audience, crafting viral content, and analyzing engagement. Use when the user wants to grow on X\u002FTwitter, write tweets or threads, analyze their X profile, research competitors on X, plan a posting strategy, or optimize engagement. Complements social-content (generic multi-platform) with X-specific depth: algorithm mechanics, thread engineering, reply strategy, profile optimization, and competitive intelligence via web search.","https:\u002F\u002Fgithub.com\u002Flevalencia\u002Fagent-god-mode\u002Fblob\u002Fmain\u002Forganized-skills\u002Fx-twitter-growth\u002FSKILL.md",[],[121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140],"twitter","x twitter growth","growth","competitive intelligence","search","analyzing","plan","marketing","web search","competitors","analyze","write","optimize","social","intelligence","viral","growth engine","mechanics","grow","competitive",{"skillNo":142,"name":143,"nameZh":6,"description":144,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":145,"categories":146,"keywords":147,"publishedAt":25},"01M6EM3FQNPYNKPC4CV9TCVNGD","what-if-oracle","Run structured What-If scenario analysis with multi-branch possibility exploration. Use this skill when the user asks speculative questions like \"what if...\", \"what would happen if...\", \"what are the possibilities\", \"explore scenarios\", \"scenario analysis\", \"possibility space\", \"what could go wrong\", \"best case \u002F worst case\", \"risk analysis\", \"contingency planning\", \"strategic options\", or any question about uncertain futures. Also trigger when the user faces a fork-in-the-road decision, wants to stress-test an idea, or needs to think through consequences before committing.","https:\u002F\u002Fgithub.com\u002Flevalencia\u002Fagent-god-mode\u002Fblob\u002Fmain\u002Forganized-skills\u002Fwhat-if-oracle\u002FSKILL.md",[],[148,149,150,151,152,153,154,155,156,157,158,159,104,160,161,162,163,164,165,166],"oracle","what if oracle","test","planning","ux","futures","risk","analysis","explore","decision","branch","question","exploration","options","stress-test","strategies","trigger","case","multi",{"skillNo":168,"name":169,"nameZh":6,"description":170,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":171,"categories":172,"keywords":176,"publishedAt":25},"01M6EM08C06RGDYCJ86HAPK0FF","vercel-react-best-practices","React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React\u002FNext.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.","https:\u002F\u002Fgithub.com\u002Flevalencia\u002Fagent-god-mode\u002Fblob\u002Fmain\u002Forganized-skills\u002Fvercel-react-best-practices\u002FSKILL.md",[173],{"categoryNo":174,"categoryName":175,"taxonomyType":85,"taxonomyTypeDesc":86},"01JBSEEDCAT000000000000009","前端开发",[177,178,179,180,181,182,183,184,185,186,187,188,189,99,190,191,192,193,194,109],"react","vercel react best practices","best practices","react best practices","vercel","writing","performance","components","react components","guidelines","tasks","code","Optimization","Next.js","refactoring","performance optimization","next","pages",{"skillNo":196,"name":197,"nameZh":6,"description":198,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":199,"categories":200,"keywords":211,"publishedAt":25},"01M6EM00S13326QM08DTM94J6Z","venue-templates","Access comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.","https:\u002F\u002Fgithub.com\u002Flevalencia\u002Fagent-god-mode\u002Fblob\u002Fmain\u002Forganized-skills\u002Fvenue-templates\u002FSKILL.md",[201,204,207,208],{"categoryNo":202,"categoryName":203,"taxonomyType":85,"taxonomyTypeDesc":86},"01JBSEEDCAT000000000000018","写作与文案",{"categoryNo":205,"categoryName":206,"taxonomyType":85,"taxonomyTypeDesc":86},"01JBSEEDCAT000000000000021","资料检索与研究",{"categoryNo":88,"categoryName":89,"taxonomyType":85,"taxonomyTypeDesc":86},{"categoryNo":209,"categoryName":210,"taxonomyType":93,"taxonomyTypeDesc":94},"01JBSEEDCAT000000000000036","内容创作者",[100,212,213,186,214,215,216,217,218,219,220,132,221,222,223,224,225,226,75,227],"venue templates","research","NeurIPS","ICML","LaTeX","science","Bash","access","read","edit","proposals","Academic","requirements","formatting","journal","chi"]