[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6C4Y0W01TCYVVFE4ZSQ8K02":3,"skill-same:01M6C4Y0W01TCYVVFE4ZSQ8K02":68},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":22,"publishedAt":26,"linkOnly":27,"markdownContent":28,"markdownBody":28,"frontMatter":29,"refName":30,"commitSha":31,"skillDirectory":32,"forksCount":13,"repositoryHtmlUrl":33,"repositoryHomepageUrl":34,"ownerHtmlUrl":35,"ownerBlogUrl":36,"ownerDescription":6,"updatedAt":37,"install":38,"resources":51},"01M6C4Y0W01TCYVVFE4ZSQ8K02","code-cleanup",null,"joshribakoff\u002Ffightingwithai.com","joshribakoff","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F4021306?v=4","01M6C4XRSWK3RV2R7FF1CH2FGA","Josh Ribakoff","01M6C4XRYAPRF3PM6E2VY4MNXM",0,"MIT","https:\u002F\u002Fgithub.com\u002Fjoshribakoff\u002Ffightingwithai.com\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fcode-cleanup\u002FSKILL.md",[17],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[23,24,25],"cleanup","code","code cleanup","2026-11-10 10:12:30",false,"# Code Cleanup Skill\n\n## When to Use\n\nAfter iterating on code with multiple changes, reversals, or simplifications - technical debt accumulates. Use this skill to systematically identify and clean it up.\n\n**Triggers:**\n- \"clean up the code\"\n- \"look for technical debt\"\n- \"we iterated a lot, what can we simplify\"\n- After any feature that went through multiple revisions\n\n## Process\n\n### Phase 1: Audit (Don't Change Code Yet)\n\n1. **Identify files touched** - What files were modified during iteration?\n\n2. **Look for these patterns:**\n\n   | Pattern | Description | Example |\n   |---------|-------------|---------|\n   | **Duplicated code** | Same logic\u002Fstyles in multiple files | CSS copied across 3 pages |\n   | **Dead code** | Unused functions, props, variables | `prev` prop passed but never used |\n   | **Vestigial code** | Leftovers from removed features | `extractDescription()` for deleted UI |\n   | **Inconsistent patterns** | Same thing done different ways | `flex` vs `text-align` for alignment |\n   | **Over-abstraction** | Complexity added then never used | Interface with 5 fields, 2 used |\n   | **Under-abstraction** | Copy-paste that should be shared | 3 nearly-identical page templates |\n   | **Nested ternaries** | Complex conditional rendering inline | 20-line ternary in layout template |\n   | **Hardcoded variants** | Multiple files differing only in config values | 3 index pages with different titles |\n   | **Repeated inline logic** | Same operation duplicated across files | `.sort((a, b) => ...)` in 5 places |\n\n3. **Prioritize by impact:**\n   - **High**: Dead code, unused props (easy wins, remove confusion)\n   - **Medium**: Duplicated code (DRY violations, maintenance burden)\n   - **Low**: Inconsistencies (style issues, not bugs)\n\n4. **Create a summary** - List issues with line counts and fix complexity before touching code.\n\n### Phase 2: Checkpoint\n\nBefore making cleanup changes:\n1. Commit current working state\n2. Use a clear message like \"checkpoint before cleanup\" or \"feature complete, cleanup pending\"\n\nThis ensures you can always get back to working code if cleanup introduces issues.\n\n### Phase 3: Fix (In Order)\n\n1. **Quick wins first** - Delete dead code, remove unused props\n2. **Then consolidation** - Extract shared components\u002Fstyles\n3. **Finally polish** - Fix inconsistencies\n\nAfter each logical chunk, verify the app still works.\n\n## Common Cleanup Patterns\n\n### Extracting Nested Ternaries\n\nNested ternaries in Astro\u002FJSX are hard to read and modify. Extract to components when you see:\n- Multiple conditions determining what to render\n- Same HTML structure repeated with slight variations\n- Logic mixing with markup in confusing ways\n\n```astro\n\u003C!-- Before: nested ternary spanning 20+ lines -->\n{conditionA && conditionB ? (\n  \u003Cnav>\n    {subCondition ? \u003Ca href=\"\u002F\">{x}\u003C\u002Fa> : \u003Cspan>{x}\u003C\u002Fspan>}\n    \u003Cspan>{y}\u003C\u002Fspan>\n  \u003C\u002Fnav>\n) : conditionA ? (\n  \u003Cnav>\n    \u003Cspan>{x}\u003C\u002Fspan>\n  \u003C\u002Fnav>\n) : (\n  \u003Cspan>Fallback\u003C\u002Fspan>\n)}\n\n\u003C!-- After: clean component usage -->\n\u003CMyBreadcrumbs\n  sectionName={sectionName}\n  sectionSlug={sectionSlug}\n  pageTitle={pageTitle}\n\u002F>\n```\n\nThe component encapsulates the logic with clear variable names at the top:\n```astro\n---\nconst hasFullPath = currentSection && pageTitle;\nconst hasSectionOnly = currentSection && !pageTitle;\n---\n{hasFullPath ? (...) : hasSectionOnly ? (...) : (...)}\n```\n\nThis moves complexity to one place and makes the parent template scannable.\n\n### Consolidating Hardcoded Variants\n\nWhen you see multiple files that are nearly identical with only small differences (title, description, sort method), consolidate into a single dynamic file with configuration.\n\n**Signs of this problem:**\n- 3+ files with same structure, different hardcoded values\n- Copy-paste when adding new variants\n- Changes need to be made in multiple places\n\n```astro\n\u003C!-- Before: 3 separate files (concepts\u002Findex, patterns\u002Findex, failure-modes\u002Findex) -->\n\u003C!-- Each 30+ lines, differing only in: collection name, title, description, sort method -->\n\n\u003C!-- After: ONE dynamic [collection]\u002Findex.astro + config -->\n```\n\n**The fix pattern:**\n1. Create a config object with all variant-specific values\n2. Create one dynamic page that reads from config\n3. Delete the hardcoded files\n\n```typescript\n\u002F\u002F src\u002Futils\u002Fcollections-config.ts\nexport const COLLECTION_CONFIG = {\n  \"concepts\": { displayName: \"Concepts\", sortMethod: \"dependency\", description: \"...\" },\n  \"failure-modes\": { displayName: \"Failure Modes\", sortMethod: \"alphabetical\", description: \"...\" },\n  \u002F\u002F ...\n};\n\n\u002F\u002F src\u002Fpages\u002F[collection]\u002Findex.astro\nconst config = COLLECTION_CONFIG[collection];\n```\n\n### Separating Pure Functions from Framework Code\n\nWhen testing fails because of framework imports (`astro:content`, `next\u002Frouter`, etc.), split into two files:\n\n```\ncollections-config.ts  ← Pure TypeScript, testable\ncollections.ts         ← Re-exports config + adds framework-specific functions\n```\n\nThe test imports from the `-config` file, production code imports from the main file.\n\n### Removing Dead Props\n\n```typescript\n\u002F\u002F Before: prop accepted but never used\ninterface Props {\n  prev: Item | null;  \u002F\u002F ← dead\n  next: Item | null;\n}\nconst { prev, next } = Astro.props;\n\u002F\u002F prev never referenced...\n\n\u002F\u002F After: remove from interface and callers\ninterface Props {\n  next: Item | null;\n}\n```\n\n### Extracting Shared Styles\n\n```astro\n\u003C!-- Before: duplicated in 3 files -->\n\u003Cstyle>\n  .nav { text-align: right; padding-top: var(--space-4); ... }\n\u003C\u002Fstyle>\n\n\u003C!-- After: shared component or global styles -->\n\u003CNavFooter href=\"\u002Fnext\u002F\" label=\"Next Item\" \u002F>\n```\n\n### Removing Vestigial Functions\n\nLook for functions that:\n- Are defined but never called\n- Return values that are stored but never used\n- Compute things for UI elements that were removed\n\n## Checklist\n\n- [ ] Read all modified files\n- [ ] List dead code (unused functions, props, variables)\n- [ ] List duplicated code (same logic in multiple places)\n- [ ] List inconsistencies (different approaches to same problem)\n- [ ] Prioritize fixes\n- [ ] Commit checkpoint before changes\n- [ ] Make changes in priority order\n- [ ] Verify app works after each chunk\n- [ ] Final commit with cleanup summary\n\n## Anti-Patterns to Avoid\n\n- **Don't refactor while cleaning** - Cleanup removes debt, refactoring changes structure. Do one at a time.\n- **Don't add features during cleanup** - Keep the diff focused on removal\u002Fconsolidation.\n- **Don't skip the checkpoint** - You'll regret it when cleanup breaks something subtle.\n",{},"main","456b6e5999d9613b2065544f7789689d31742769",".claude\u002Fskills\u002Fcode-cleanup","https:\u002F\u002Fgithub.com\u002Fjoshribakoff\u002Ffightingwithai.com","https:\u002F\u002Ffightingwithai.vercel.app","https:\u002F\u002Fgithub.com\u002Fjoshribakoff","joshribakoff.com","2026-01-22 14:44:35",{"source":7,"skillName":5,"commands":39,"prompt":49,"zipAvailable":50},[40,43,46],{"tool":41,"command":42},"npx","npx skills add joshribakoff\u002Ffightingwithai.com --skill code-cleanup",{"tool":44,"command":45},"bunx","bunx skills add joshribakoff\u002Ffightingwithai.com --skill code-cleanup",{"tool":47,"command":48},"pnpm","pnpm dlx skills add joshribakoff\u002Ffightingwithai.com --skill code-cleanup","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjoshribakoff\u002Ffightingwithai.com\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fcode-cleanup\u002FSKILL.md",true,[52,58,62],{"path":53,"resourceType":54,"resourceTypeDesc":55,"sizeBytes":56,"sourceHtmlUrl":57},"manifest.json","REFERENCE","参考文档",182,"https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fcatalog\u002FTools\u002FOfficial-DotNet-Diagnostics\u002Fskills\u002Fapple-crash-symbolication\u002Fmanifest.json",{"path":59,"resourceType":54,"resourceTypeDesc":55,"sizeBytes":60,"sourceHtmlUrl":61},"references\u002Fips-crash-format.md",1704,"https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fcatalog\u002FTools\u002FOfficial-DotNet-Diagnostics\u002Fskills\u002Fapple-crash-symbolication\u002Freferences\u002Fips-crash-format.md",{"path":63,"resourceType":64,"resourceTypeDesc":65,"sizeBytes":66,"sourceHtmlUrl":67},"scripts\u002FSymbolicate-Crash.ps1","SCRIPT","脚本",40545,"https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fcatalog\u002FTools\u002FOfficial-DotNet-Diagnostics\u002Fskills\u002Fapple-crash-symbolication\u002Fscripts\u002FSymbolicate-Crash.ps1",[69,76,84,91,102,113],{"skillNo":70,"name":71,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":72,"categories":73,"keywords":74,"publishedAt":26},"01M6C4Y9B23N3BZYDHRRVW13PF","simple-commands","https:\u002F\u002Fgithub.com\u002Fjoshribakoff\u002Ffightingwithai.com\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fsimple-commands\u002FSKILL.md",[],[75],"simple commands",{"skillNo":77,"name":78,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":26},"01M6C4Y7XQM8QNRMDDFXTDMW7P","meta-skill","https:\u002F\u002Fgithub.com\u002Fjoshribakoff\u002Ffightingwithai.com\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fmeta-skill\u002FSKILL.md",[],[82,83],"Meta","meta skill",{"skillNo":85,"name":86,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":26},"01M6C4Y65GQJC86RRJN64NZ4R5","magic-links","https:\u002F\u002Fgithub.com\u002Fjoshribakoff\u002Ffightingwithai.com\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fmagic-links\u002FSKILL.md",[],[90],"magic links",{"skillNo":92,"name":93,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":94,"categories":95,"keywords":101,"publishedAt":26},"01M6C4Y508MC06FWACP82JNYMN","copywriting","https:\u002F\u002Fgithub.com\u002Fjoshribakoff\u002Ffightingwithai.com\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fcopywriting\u002FSKILL.md",[96],{"categoryNo":97,"categoryName":98,"taxonomyType":99,"taxonomyTypeDesc":100},"01JBSEEDCAT000000000000018","写作与文案","SCENARIO","使用场景",[93],{"skillNo":103,"name":104,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":105,"categories":106,"keywords":110,"publishedAt":26},"01M6C4Y2QWSAXM4QMZT7B148R7","content-ordering","https:\u002F\u002Fgithub.com\u002Fjoshribakoff\u002Ffightingwithai.com\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fcontent-ordering\u002FSKILL.md",[107],{"categoryNo":108,"categoryName":109,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000036","内容创作者",[111,112],"content","content ordering",{"skillNo":114,"name":115,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":116,"categories":117,"keywords":118,"publishedAt":26},"01M6C4XYDC6W16Y6KTY347S6ZC","astro-islands","https:\u002F\u002Fgithub.com\u002Fjoshribakoff\u002Ffightingwithai.com\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fastro-islands\u002FSKILL.md",[],[119,120],"astro","astro islands"]