[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7BZP1VV1PCM30N5C63BWCED":3,"skill-same:01M7BZP1VV1PCM30N5C63BWCED":66},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":23,"commitSha":24,"skillDirectory":25,"forksCount":26,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":29,"install":30,"resources":43},"01M7BZP1VV1PCM30N5C63BWCED","find-duplicates",null,"Use when auditing a codebase for semantic duplication - functions that do the same thing but have different names or implementations. Especially useful for LLM-generated codebases where new functions are often created rather than reusing existing ones.","zak-keown\u002Fmoe","zak-keown","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F320717241?v=4","01M7BZFXME0NW6TQX0H7AZM2KS","01M7BZFXN32VR0JN5AATRD53H4",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fzak-keown\u002Fmoe\u002Fblob\u002Fmain\u002Fpackages\u002Fcore\u002Fskills\u002Ffind-duplicates\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: find-duplicates\ndescription: Use when auditing a codebase for semantic duplication - functions that do the same thing but have different names or implementations. Especially useful for LLM-generated codebases where new functions are often created rather than reusing existing ones.\n---\n\n# Finding Duplicate-Intent Functions\n\n## Overview\n\nLLM-generated codebases accumulate semantic duplicates: functions that serve the same purpose but were implemented independently. Classical copy-paste detectors (jscpd) find syntactic duplicates but miss \"same intent, different implementation.\"\n\nThis skill uses a two-phase approach: classical extraction followed by LLM-powered intent clustering.\n\n## When to Use\n\n- Codebase has grown organically with multiple contributors (human or LLM)\n- You suspect utility functions have been reimplemented multiple times\n- Before major refactoring to identify consolidation opportunities\n- After jscpd has been run and syntactic duplicates are already handled\n\n## Quick Reference\n\n| Phase | Tool | Model | Output |\n|-------|------|-------|--------|\n| 1. Extract | `scripts\u002Fextract-functions.mjs` | - | `catalog.json` |\n| 2. Categorize | `scripts\u002Fcategorize-prompt.md` | {model-fast} | `categorized.json` |\n| 3. Split | `scripts\u002Fprepare-category-analysis.mjs` | - | `categories\u002F*.json` |\n| 4. Detect | `scripts\u002Ffind-duplicates-prompt.md` | {model-deep} | `duplicates\u002F*.json` |\n| 5. Report | `scripts\u002Fgenerate-report.mjs` | - | `report.md` |\n\n## Process\n\n```dot\ndigraph duplicate_detection {\n  rankdir=TB;\n  node [shape=box];\n\n  extract [label=\"1. Extract function catalog\\nscripts\u002Fextract-functions.mjs\"];\n  categorize [label=\"2. Categorize by domain\\n(fast-model subagent)\"];\n  split [label=\"3. Split into categories\\nscripts\u002Fprepare-category-analysis.mjs\"];\n  detect [label=\"4. Find duplicates per category\\n(deep-model subagent per category)\"];\n  report [label=\"5. Generate report\\nscripts\u002Fgenerate-report.mjs\"];\n  review [label=\"6. Human review & consolidate\"];\n\n  extract -> categorize -> split -> detect -> report -> review;\n}\n```\n\n### Phase 1: Extract Function Catalog\n\nResolve {resource:skills\u002Ffind-duplicates\u002Fscripts\u002Fextract-functions.mjs} relative to this loaded document, then invoke it as:\n\n```bash\nnode \"\u003Cresolved-extract-functions.mjs>\" src\u002F -o catalog.json\n```\n\nOptions:\n- `-o FILE`: Output file (default: stdout)\n- `-c N`: Lines of context to capture (default: 15)\n- `-t GLOB`: File types (default: `*.ts,*.tsx,*.js,*.jsx`)\n- `--include-tests`: Include test files (excluded by default)\n\nTest files (`*.test.*`, `*.spec.*`, `__tests__\u002F**`) are excluded by default since test utilities are less likely to be consolidation candidates.\n\n### Phase 2: Categorize by Domain\n\nDispatch a **{model-fast}** subagent using {resource:skills\u002Ffind-duplicates\u002Fscripts\u002Fcategorize-prompt.md}, resolved relative to this loaded document.\n\nInsert the contents of `catalog.json` where indicated in the prompt template. Save output as `categorized.json`.\n\n### Phase 3: Split into Categories\n\nResolve {resource:skills\u002Ffind-duplicates\u002Fscripts\u002Fprepare-category-analysis.mjs} relative to this loaded document, then invoke it as:\n\n```bash\nnode \"\u003Cresolved-prepare-category-analysis.mjs>\" categorized.json .\u002Fcategories\n```\n\nCreates one JSON file per category. Only categories with 3+ functions are worth analyzing.\n\n### Phase 4: Find Duplicates (Per Category)\n\nFor each category file in `.\u002Fcategories\u002F`, dispatch a **{model-deep}** subagent using {resource:skills\u002Ffind-duplicates\u002Fscripts\u002Ffind-duplicates-prompt.md}, resolved relative to this loaded document.\n\nSave each output as `.\u002Fduplicates\u002F\u003Ccategory-name>.json`.\n\n### Phase 5: Generate Report\n\nResolve {resource:skills\u002Ffind-duplicates\u002Fscripts\u002Fgenerate-report.mjs} relative to this loaded document, then invoke it as:\n\n```bash\nnode \"\u003Cresolved-generate-report.mjs>\" .\u002Fduplicates .\u002Fduplicates-report.md\n```\n\nProduces a prioritized markdown report grouped by confidence level. This is rung 4 (markdown) of the shared native-rendering ladder in {resource:skills\u002F_shared\u002Fnative-rendering.md}, resolved relative to this loaded document. The file on disk is what Phase 6 review consumes and is the source of truth. If your human partner wants a scannable version alongside it (a sortable table, colour-coded confidence bands), walk the ladder from the top:\n\n{render-ladder}\n\nThe markdown report always ships regardless.\n\n### Phase 6: Human Review\n\nReview the report. For HIGH confidence duplicates:\n1. Verify the recommended survivor has tests\n2. Update callers to use the survivor\n3. Delete the duplicates\n4. Run tests\n\n## High-Risk Duplicate Zones\n\nFocus extraction on these areas first - they accumulate duplicates fastest:\n\n| Zone | Common Duplicates |\n|------|-------------------|\n| `utils\u002F`, `helpers\u002F`, `lib\u002F` | General utilities reimplemented |\n| Validation code | Same checks written multiple ways |\n| Error formatting | Error-to-string conversions |\n| Path manipulation | Joining, resolving, normalizing paths |\n| String formatting | Case conversion, truncation, escaping |\n| Date formatting | Same formats implemented repeatedly |\n| API response shaping | Similar transformations for different endpoints |\n\n## Common Mistakes\n\n**Extracting too much**: Focus on exported functions and public methods. Internal helpers are less likely to be duplicated across files.\n\n**Skipping the categorization step**: Going straight to duplicate detection on the full catalog produces noise. Categories focus the comparison.\n\n**Using {model-fast} for duplicate detection**: the fast role is cost-effective for categorization but misses subtle semantic duplicates. Use {model-deep} for the actual duplicate analysis.\n\n**Consolidating without tests**: Before deleting duplicates, ensure the survivor has tests covering all use cases of the deleted functions.\n","# Finding Duplicate-Intent Functions\n\n## Overview\n\nLLM-generated codebases accumulate semantic duplicates: functions that serve the same purpose but were implemented independently. Classical copy-paste detectors (jscpd) find syntactic duplicates but miss \"same intent, different implementation.\"\n\nThis skill uses a two-phase approach: classical extraction followed by LLM-powered intent clustering.\n\n## When to Use\n\n- Codebase has grown organically with multiple contributors (human or LLM)\n- You suspect utility functions have been reimplemented multiple times\n- Before major refactoring to identify consolidation opportunities\n- After jscpd has been run and syntactic duplicates are already handled\n\n## Quick Reference\n\n| Phase | Tool | Model | Output |\n|-------|------|-------|--------|\n| 1. Extract | `scripts\u002Fextract-functions.mjs` | - | `catalog.json` |\n| 2. Categorize | `scripts\u002Fcategorize-prompt.md` | {model-fast} | `categorized.json` |\n| 3. Split | `scripts\u002Fprepare-category-analysis.mjs` | - | `categories\u002F*.json` |\n| 4. Detect | `scripts\u002Ffind-duplicates-prompt.md` | {model-deep} | `duplicates\u002F*.json` |\n| 5. Report | `scripts\u002Fgenerate-report.mjs` | - | `report.md` |\n\n## Process\n\n```dot\ndigraph duplicate_detection {\n  rankdir=TB;\n  node [shape=box];\n\n  extract [label=\"1. Extract function catalog\\nscripts\u002Fextract-functions.mjs\"];\n  categorize [label=\"2. Categorize by domain\\n(fast-model subagent)\"];\n  split [label=\"3. Split into categories\\nscripts\u002Fprepare-category-analysis.mjs\"];\n  detect [label=\"4. Find duplicates per category\\n(deep-model subagent per category)\"];\n  report [label=\"5. Generate report\\nscripts\u002Fgenerate-report.mjs\"];\n  review [label=\"6. Human review & consolidate\"];\n\n  extract -> categorize -> split -> detect -> report -> review;\n}\n```\n\n### Phase 1: Extract Function Catalog\n\nResolve {resource:skills\u002Ffind-duplicates\u002Fscripts\u002Fextract-functions.mjs} relative to this loaded document, then invoke it as:\n\n```bash\nnode \"\u003Cresolved-extract-functions.mjs>\" src\u002F -o catalog.json\n```\n\nOptions:\n- `-o FILE`: Output file (default: stdout)\n- `-c N`: Lines of context to capture (default: 15)\n- `-t GLOB`: File types (default: `*.ts,*.tsx,*.js,*.jsx`)\n- `--include-tests`: Include test files (excluded by default)\n\nTest files (`*.test.*`, `*.spec.*`, `__tests__\u002F**`) are excluded by default since test utilities are less likely to be consolidation candidates.\n\n### Phase 2: Categorize by Domain\n\nDispatch a **{model-fast}** subagent using {resource:skills\u002Ffind-duplicates\u002Fscripts\u002Fcategorize-prompt.md}, resolved relative to this loaded document.\n\nInsert the contents of `catalog.json` where indicated in the prompt template. Save output as `categorized.json`.\n\n### Phase 3: Split into Categories\n\nResolve {resource:skills\u002Ffind-duplicates\u002Fscripts\u002Fprepare-category-analysis.mjs} relative to this loaded document, then invoke it as:\n\n```bash\nnode \"\u003Cresolved-prepare-category-analysis.mjs>\" categorized.json .\u002Fcategories\n```\n\nCreates one JSON file per category. Only categories with 3+ functions are worth analyzing.\n\n### Phase 4: Find Duplicates (Per Category)\n\nFor each category file in `.\u002Fcategories\u002F`, dispatch a **{model-deep}** subagent using {resource:skills\u002Ffind-duplicates\u002Fscripts\u002Ffind-duplicates-prompt.md}, resolved relative to this loaded document.\n\nSave each output as `.\u002Fduplicates\u002F\u003Ccategory-name>.json`.\n\n### Phase 5: Generate Report\n\nResolve {resource:skills\u002Ffind-duplicates\u002Fscripts\u002Fgenerate-report.mjs} relative to this loaded document, then invoke it as:\n\n```bash\nnode \"\u003Cresolved-generate-report.mjs>\" .\u002Fduplicates .\u002Fduplicates-report.md\n```\n\nProduces a prioritized markdown report grouped by confidence level. This is rung 4 (markdown) of the shared native-rendering ladder in {resource:skills\u002F_shared\u002Fnative-rendering.md}, resolved relative to this loaded document. The file on disk is what Phase 6 review consumes and is the source of truth. If your human partner wants a scannable version alongside it (a sortable table, colour-coded confidence bands), walk the ladder from the top:\n\n{render-ladder}\n\nThe markdown report always ships regardless.\n\n### Phase 6: Human Review\n\nReview the report. For HIGH confidence duplicates:\n1. Verify the recommended survivor has tests\n2. Update callers to use the survivor\n3. Delete the duplicates\n4. Run tests\n\n## High-Risk Duplicate Zones\n\nFocus extraction on these areas first - they accumulate duplicates fastest:\n\n| Zone | Common Duplicates |\n|------|-------------------|\n| `utils\u002F`, `helpers\u002F`, `lib\u002F` | General utilities reimplemented |\n| Validation code | Same checks written multiple ways |\n| Error formatting | Error-to-string conversions |\n| Path manipulation | Joining, resolving, normalizing paths |\n| String formatting | Case conversion, truncation, escaping |\n| Date formatting | Same formats implemented repeatedly |\n| API response shaping | Similar transformations for different endpoints |\n\n## Common Mistakes\n\n**Extracting too much**: Focus on exported functions and public methods. Internal helpers are less likely to be duplicated across files.\n\n**Skipping the categorization step**: Going straight to duplicate detection on the full catalog produces noise. Categories focus the comparison.\n\n**Using {model-fast} for duplicate detection**: the fast role is cost-effective for categorization but misses subtle semantic duplicates. Use {model-deep} for the actual duplicate analysis.\n\n**Consolidating without tests**: Before deleting duplicates, ensure the survivor has tests covering all use cases of the deleted functions.\n",{"name":5,"description":7},"main","728894f3f85fbd4e788f015ddfd72bb6155d5dd5","packages\u002Fcore\u002Fskills\u002Ffind-duplicates",1,"https:\u002F\u002Fgithub.com\u002Fzak-keown\u002Fmoe","https:\u002F\u002Fgithub.com\u002Fzak-keown","2026-09-05 06:29:06",{"source":8,"skillName":5,"commands":31,"prompt":41,"zipAvailable":42},[32,35,38],{"tool":33,"command":34},"npx","npx skills add zak-keown\u002Fmoe --skill find-duplicates",{"tool":36,"command":37},"bunx","bunx skills add zak-keown\u002Fmoe --skill find-duplicates",{"tool":39,"command":40},"pnpm","pnpm dlx skills add zak-keown\u002Fmoe --skill find-duplicates","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fzak-keown\u002Fmoe\u002Fblob\u002Fmain\u002Fpackages\u002Fcore\u002Fskills\u002Ffind-duplicates\u002FSKILL.md",true,[44,50,54,58,62],{"path":45,"resourceType":46,"resourceTypeDesc":47,"sizeBytes":48,"sourceHtmlUrl":49},"scripts\u002Fcategorize-prompt.md","SCRIPT","脚本",2905,"https:\u002F\u002Fgithub.com\u002Fzak-keown\u002Fmoe\u002Fblob\u002Fmain\u002Fpackages\u002Fcore\u002Fskills\u002Ffind-duplicates\u002Fscripts\u002Fcategorize-prompt.md",{"path":51,"resourceType":46,"resourceTypeDesc":47,"sizeBytes":52,"sourceHtmlUrl":53},"scripts\u002Fextract-functions.mjs",5757,"https:\u002F\u002Fgithub.com\u002Fzak-keown\u002Fmoe\u002Fblob\u002Fmain\u002Fpackages\u002Fcore\u002Fskills\u002Ffind-duplicates\u002Fscripts\u002Fextract-functions.mjs",{"path":55,"resourceType":46,"resourceTypeDesc":47,"sizeBytes":56,"sourceHtmlUrl":57},"scripts\u002Ffind-duplicates-prompt.md",2970,"https:\u002F\u002Fgithub.com\u002Fzak-keown\u002Fmoe\u002Fblob\u002Fmain\u002Fpackages\u002Fcore\u002Fskills\u002Ffind-duplicates\u002Fscripts\u002Ffind-duplicates-prompt.md",{"path":59,"resourceType":46,"resourceTypeDesc":47,"sizeBytes":60,"sourceHtmlUrl":61},"scripts\u002Fgenerate-report.mjs",5690,"https:\u002F\u002Fgithub.com\u002Fzak-keown\u002Fmoe\u002Fblob\u002Fmain\u002Fpackages\u002Fcore\u002Fskills\u002Ffind-duplicates\u002Fscripts\u002Fgenerate-report.mjs",{"path":63,"resourceType":46,"resourceTypeDesc":47,"sizeBytes":64,"sourceHtmlUrl":65},"scripts\u002Fprepare-category-analysis.mjs",3358,"https:\u002F\u002Fgithub.com\u002Fzak-keown\u002Fmoe\u002Fblob\u002Fmain\u002Fpackages\u002Fcore\u002Fskills\u002Ffind-duplicates\u002Fscripts\u002Fprepare-category-analysis.mjs",[67,74,81,88,95,102],{"skillNo":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":18},"01M7C1Z5362Y8NVRZ69HWP0ZD0","write-skill","Use when creating new skills, editing existing skills, or verifying skills work before deployment","https:\u002F\u002Fgithub.com\u002Fzak-keown\u002Fmoe\u002Fblob\u002Fmain\u002Fplugins\u002Fmoe\u002Fskills\u002Fwrite-skill\u002FSKILL.md",[],[],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":18},"01M7C1YZ9966WK9R6ZRPCGWF3G","write-plan","Use when you have a spec or requirements for a multi-step task, before touching code","https:\u002F\u002Fgithub.com\u002Fzak-keown\u002Fmoe\u002Fblob\u002Fmain\u002Fplugins\u002Fmoe\u002Fskills\u002Fwrite-plan\u002FSKILL.md",[],[],{"skillNo":82,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":18},"01M7C1YMR4SJD7BPBBPXZCVGVH","write-clearly","Apply Strunk's timeless writing rules to ANY prose humans will read—documentation, commit messages, error messages, explanations, reports, or UI text. Makes your writing clearer, stronger, and more professional.","https:\u002F\u002Fgithub.com\u002Fzak-keown\u002Fmoe\u002Fblob\u002Fmain\u002Fplugins\u002Fmoe\u002Fskills\u002Fwrite-clearly\u002FSKILL.md",[],[],{"skillNo":89,"name":90,"nameZh":6,"description":91,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":92,"categories":93,"keywords":94,"publishedAt":18},"01M7C1YH9805YSM0N20VQAVSXF","windows-vm","Create, manage, or connect to a headless Windows 11 VM running in Docker with SSH access. Use when the user wants to spin up, stop, restart, or SSH into a Windows VM.","https:\u002F\u002Fgithub.com\u002Fzak-keown\u002Fmoe\u002Fblob\u002Fmain\u002Fplugins\u002Fmoe\u002Fskills\u002Fwindows-vm\u002FSKILL.md",[],[],{"skillNo":96,"name":97,"nameZh":6,"description":98,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":18},"01M7C1YD87SCNEJ2C9B8HFR2NQ","verify-completion","Use when about to claim work is complete, fixed, or passing, before committing or creating MRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always","https:\u002F\u002Fgithub.com\u002Fzak-keown\u002Fmoe\u002Fblob\u002Fmain\u002Fplugins\u002Fmoe\u002Fskills\u002Fverify-completion\u002FSKILL.md",[],[],{"skillNo":103,"name":104,"nameZh":6,"description":105,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":106,"categories":107,"keywords":108,"publishedAt":18},"01M7C1YARDEHT0TJ9BRG30ZCF4","using-moe","Use when starting any conversation - establishes how to find and use skills, requiring skill invocation before ANY response including clarifying questions","https:\u002F\u002Fgithub.com\u002Fzak-keown\u002Fmoe\u002Fblob\u002Fmain\u002Fplugins\u002Fmoe\u002Fskills\u002Fusing-moe\u002FSKILL.md",[],[]]