[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6CDXQ18T2DHHY30VYJWCT5Y":3,"skill-same:01M6CDXQ18T2DHHY30VYJWCT5Y":65},{"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":22,"publishedAt":33,"linkOnly":34,"markdownContent":35,"markdownBody":36,"frontMatter":37,"refName":39,"commitSha":40,"skillDirectory":41,"forksCount":13,"repositoryHtmlUrl":42,"repositoryHomepageUrl":6,"ownerHtmlUrl":43,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":44,"install":45,"resources":58},"01M6CDXQ18T2DHHY30VYJWCT5Y","code-refactoring",null,"Code refactoring patterns and techniques for improving code quality without changing behavior. Use for cleaning up legacy code, reducing complexity, or improving maintainability.","jijingkun-commits\u002Ffastapi","jijingkun-commits","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F240866387?v=4","01M6CDWBED8HV9VJWHVGFZR01X","01M6CDWBJMJ6C3CATJADQ7MNHS",0,"MIT","https:\u002F\u002Fgithub.com\u002Fjijingkun-commits\u002Ffastapi\u002Fblob\u002Fmaster\u002F.cursor\u002Fskills\u002Fcode-refactoring\u002FSKILL.md",[17],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[23,24,25,26,27,28,29,30,31,32],"code","refactoring","code refactoring","code quality","quality","behavior","use","up","complexity","Legacy","2026-11-10 10:12:30",false,"---\nname: code-refactoring\ndescription: Code refactoring patterns and techniques for improving code quality without changing behavior. Use for cleaning up legacy code, reducing complexity, or improving maintainability.\nsource: wshobson\u002Fagents\nlicense: MIT\n---\n\n# Code Refactoring\n\n## Refactoring Principles\n\n### When to Refactor\n- Before adding new features (make change easy, then make easy change)\n- After getting tests passing (red-green-refactor)\n- When you see code smells\n- During code review feedback\n\n### When NOT to Refactor\n- Without tests covering the code\n- Under tight deadlines with no safety net\n- Code that will be replaced soon\n- When you don't understand what the code does\n\n## Common Code Smells\n\n### Long Methods\n```typescript\n\u002F\u002F BEFORE: Method doing too much\nfunction processOrder(order: Order) {\n  \u002F\u002F 100 lines of validation, calculation, notification, logging...\n}\n\n\u002F\u002F AFTER: Extract into focused methods\nfunction processOrder(order: Order) {\n  validateOrder(order);\n  const total = calculateTotal(order);\n  saveOrder(order, total);\n  notifyCustomer(order);\n}\n```\n\n### Deeply Nested Conditionals\n```typescript\n\u002F\u002F BEFORE: Arrow code\nfunction getDiscount(user: User, order: Order) {\n  if (user) {\n    if (user.isPremium) {\n      if (order.total > 100) {\n        if (order.items.length > 5) {\n          return 0.2;\n        }\n      }\n    }\n  }\n  return 0;\n}\n\n\u002F\u002F AFTER: Early returns (guard clauses)\nfunction getDiscount(user: User, order: Order) {\n  if (!user) return 0;\n  if (!user.isPremium) return 0;\n  if (order.total \u003C= 100) return 0;\n  if (order.items.length \u003C= 5) return 0;\n  return 0.2;\n}\n```\n\n### Primitive Obsession\n```typescript\n\u002F\u002F BEFORE: Primitives everywhere\nfunction createUser(name: string, email: string, phone: string) {\n  if (!email.includes('@')) throw new Error('Invalid email');\n  \u002F\u002F more validation...\n}\n\n\u002F\u002F AFTER: Value objects\nclass Email {\n  constructor(private value: string) {\n    if (!value.includes('@')) throw new Error('Invalid email');\n  }\n  toString() { return this.value; }\n}\n\nfunction createUser(name: string, email: Email, phone: Phone) {\n  \u002F\u002F Email is already validated\n}\n```\n\n### Feature Envy\n```typescript\n\u002F\u002F BEFORE: Method uses another object's data extensively\nfunction calculateShipping(order: Order) {\n  const address = order.customer.address;\n  const weight = order.items.reduce((sum, i) => sum + i.weight, 0);\n  const distance = calculateDistance(address.zip);\n  return weight * distance * 0.01;\n}\n\n\u002F\u002F AFTER: Move method to where the data is\nclass Order {\n  calculateShipping() {\n    return this.totalWeight * this.customer.shippingDistance * 0.01;\n  }\n}\n```\n\n## Refactoring Techniques\n\n### Extract Method\n```typescript\n\u002F\u002F Identify a code block that does one thing\n\u002F\u002F Move it to a new method with a descriptive name\n\u002F\u002F Replace original code with method call\n\nfunction printReport(data: ReportData) {\n  \u002F\u002F Extract this block...\n  const header = `Report: ${data.title}\\nDate: ${data.date}\\n${'='.repeat(40)}`;\n  console.log(header);\n\n  \u002F\u002F ...into a method\n  printHeader(data);\n}\n```\n\n### Replace Conditional with Polymorphism\n```typescript\n\u002F\u002F BEFORE: Switch on type\nfunction getArea(shape: Shape) {\n  switch (shape.type) {\n    case 'circle': return Math.PI * shape.radius ** 2;\n    case 'rectangle': return shape.width * shape.height;\n    case 'triangle': return shape.base * shape.height \u002F 2;\n  }\n}\n\n\u002F\u002F AFTER: Polymorphic classes\ninterface Shape {\n  getArea(): number;\n}\n\nclass Circle implements Shape {\n  constructor(private radius: number) {}\n  getArea() { return Math.PI * this.radius ** 2; }\n}\n\nclass Rectangle implements Shape {\n  constructor(private width: number, private height: number) {}\n  getArea() { return this.width * this.height; }\n}\n```\n\n### Introduce Parameter Object\n```typescript\n\u002F\u002F BEFORE: Too many parameters\nfunction searchProducts(\n  query: string,\n  minPrice: number,\n  maxPrice: number,\n  category: string,\n  inStock: boolean,\n  sortBy: string,\n  sortOrder: string\n) { ... }\n\n\u002F\u002F AFTER: Parameter object\ninterface SearchParams {\n  query: string;\n  priceRange: { min: number; max: number };\n  category?: string;\n  inStock?: boolean;\n  sort?: { by: string; order: 'asc' | 'desc' };\n}\n\nfunction searchProducts(params: SearchParams) { ... }\n```\n\n### Replace Magic Numbers with Constants\n```typescript\n\u002F\u002F BEFORE\nif (user.age >= 18 && order.total >= 50) {\n  applyDiscount(order, 0.1);\n}\n\n\u002F\u002F AFTER\nconst MINIMUM_AGE = 18;\nconst DISCOUNT_THRESHOLD = 50;\nconst STANDARD_DISCOUNT = 0.1;\n\nif (user.age >= MINIMUM_AGE && order.total >= DISCOUNT_THRESHOLD) {\n  applyDiscount(order, STANDARD_DISCOUNT);\n}\n```\n\n## Safe Refactoring Process\n\n1. **Ensure tests exist** - Write tests if they don't\n2. **Make small changes** - One refactoring at a time\n3. **Run tests after each change** - Catch regressions immediately\n4. **Commit frequently** - Easy to revert if something breaks\n5. **Review the diff** - Make sure behavior hasn't changed\n\n## Refactoring Checklist\n\n- [ ] Tests pass before starting\n- [ ] Each change is small and focused\n- [ ] Tests pass after each change\n- [ ] No behavior changes (only structure)\n- [ ] Code is more readable than before\n- [ ] Commit message explains the refactoring\n","# Code Refactoring\n\n## Refactoring Principles\n\n### When to Refactor\n- Before adding new features (make change easy, then make easy change)\n- After getting tests passing (red-green-refactor)\n- When you see code smells\n- During code review feedback\n\n### When NOT to Refactor\n- Without tests covering the code\n- Under tight deadlines with no safety net\n- Code that will be replaced soon\n- When you don't understand what the code does\n\n## Common Code Smells\n\n### Long Methods\n```typescript\n\u002F\u002F BEFORE: Method doing too much\nfunction processOrder(order: Order) {\n  \u002F\u002F 100 lines of validation, calculation, notification, logging...\n}\n\n\u002F\u002F AFTER: Extract into focused methods\nfunction processOrder(order: Order) {\n  validateOrder(order);\n  const total = calculateTotal(order);\n  saveOrder(order, total);\n  notifyCustomer(order);\n}\n```\n\n### Deeply Nested Conditionals\n```typescript\n\u002F\u002F BEFORE: Arrow code\nfunction getDiscount(user: User, order: Order) {\n  if (user) {\n    if (user.isPremium) {\n      if (order.total > 100) {\n        if (order.items.length > 5) {\n          return 0.2;\n        }\n      }\n    }\n  }\n  return 0;\n}\n\n\u002F\u002F AFTER: Early returns (guard clauses)\nfunction getDiscount(user: User, order: Order) {\n  if (!user) return 0;\n  if (!user.isPremium) return 0;\n  if (order.total \u003C= 100) return 0;\n  if (order.items.length \u003C= 5) return 0;\n  return 0.2;\n}\n```\n\n### Primitive Obsession\n```typescript\n\u002F\u002F BEFORE: Primitives everywhere\nfunction createUser(name: string, email: string, phone: string) {\n  if (!email.includes('@')) throw new Error('Invalid email');\n  \u002F\u002F more validation...\n}\n\n\u002F\u002F AFTER: Value objects\nclass Email {\n  constructor(private value: string) {\n    if (!value.includes('@')) throw new Error('Invalid email');\n  }\n  toString() { return this.value; }\n}\n\nfunction createUser(name: string, email: Email, phone: Phone) {\n  \u002F\u002F Email is already validated\n}\n```\n\n### Feature Envy\n```typescript\n\u002F\u002F BEFORE: Method uses another object's data extensively\nfunction calculateShipping(order: Order) {\n  const address = order.customer.address;\n  const weight = order.items.reduce((sum, i) => sum + i.weight, 0);\n  const distance = calculateDistance(address.zip);\n  return weight * distance * 0.01;\n}\n\n\u002F\u002F AFTER: Move method to where the data is\nclass Order {\n  calculateShipping() {\n    return this.totalWeight * this.customer.shippingDistance * 0.01;\n  }\n}\n```\n\n## Refactoring Techniques\n\n### Extract Method\n```typescript\n\u002F\u002F Identify a code block that does one thing\n\u002F\u002F Move it to a new method with a descriptive name\n\u002F\u002F Replace original code with method call\n\nfunction printReport(data: ReportData) {\n  \u002F\u002F Extract this block...\n  const header = `Report: ${data.title}\\nDate: ${data.date}\\n${'='.repeat(40)}`;\n  console.log(header);\n\n  \u002F\u002F ...into a method\n  printHeader(data);\n}\n```\n\n### Replace Conditional with Polymorphism\n```typescript\n\u002F\u002F BEFORE: Switch on type\nfunction getArea(shape: Shape) {\n  switch (shape.type) {\n    case 'circle': return Math.PI * shape.radius ** 2;\n    case 'rectangle': return shape.width * shape.height;\n    case 'triangle': return shape.base * shape.height \u002F 2;\n  }\n}\n\n\u002F\u002F AFTER: Polymorphic classes\ninterface Shape {\n  getArea(): number;\n}\n\nclass Circle implements Shape {\n  constructor(private radius: number) {}\n  getArea() { return Math.PI * this.radius ** 2; }\n}\n\nclass Rectangle implements Shape {\n  constructor(private width: number, private height: number) {}\n  getArea() { return this.width * this.height; }\n}\n```\n\n### Introduce Parameter Object\n```typescript\n\u002F\u002F BEFORE: Too many parameters\nfunction searchProducts(\n  query: string,\n  minPrice: number,\n  maxPrice: number,\n  category: string,\n  inStock: boolean,\n  sortBy: string,\n  sortOrder: string\n) { ... }\n\n\u002F\u002F AFTER: Parameter object\ninterface SearchParams {\n  query: string;\n  priceRange: { min: number; max: number };\n  category?: string;\n  inStock?: boolean;\n  sort?: { by: string; order: 'asc' | 'desc' };\n}\n\nfunction searchProducts(params: SearchParams) { ... }\n```\n\n### Replace Magic Numbers with Constants\n```typescript\n\u002F\u002F BEFORE\nif (user.age >= 18 && order.total >= 50) {\n  applyDiscount(order, 0.1);\n}\n\n\u002F\u002F AFTER\nconst MINIMUM_AGE = 18;\nconst DISCOUNT_THRESHOLD = 50;\nconst STANDARD_DISCOUNT = 0.1;\n\nif (user.age >= MINIMUM_AGE && order.total >= DISCOUNT_THRESHOLD) {\n  applyDiscount(order, STANDARD_DISCOUNT);\n}\n```\n\n## Safe Refactoring Process\n\n1. **Ensure tests exist** - Write tests if they don't\n2. **Make small changes** - One refactoring at a time\n3. **Run tests after each change** - Catch regressions immediately\n4. **Commit frequently** - Easy to revert if something breaks\n5. **Review the diff** - Make sure behavior hasn't changed\n\n## Refactoring Checklist\n\n- [ ] Tests pass before starting\n- [ ] Each change is small and focused\n- [ ] Tests pass after each change\n- [ ] No behavior changes (only structure)\n- [ ] Code is more readable than before\n- [ ] Commit message explains the refactoring\n",{"name":5,"source":38,"license":14,"description":7},"wshobson\u002Fagents","master","21d03858f4c4be97b1feaa9e948ca3c5bf3e8357",".cursor\u002Fskills\u002Fcode-refactoring","https:\u002F\u002Fgithub.com\u002Fjijingkun-commits\u002Ffastapi","https:\u002F\u002Fgithub.com\u002Fjijingkun-commits","2026-03-14 11:41:49",{"source":8,"skillName":5,"commands":46,"prompt":56,"zipAvailable":57},[47,50,53],{"tool":48,"command":49},"npx","npx skills add jijingkun-commits\u002Ffastapi --skill code-refactoring",{"tool":51,"command":52},"bunx","bunx skills add jijingkun-commits\u002Ffastapi --skill code-refactoring",{"tool":54,"command":55},"pnpm","pnpm dlx skills add jijingkun-commits\u002Ffastapi --skill code-refactoring","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjijingkun-commits\u002Ffastapi\u002Fblob\u002Fmaster\u002F.cursor\u002Fskills\u002Fcode-refactoring\u002FSKILL.md",true,[59],{"path":60,"resourceType":61,"resourceTypeDesc":62,"sizeBytes":63,"sourceHtmlUrl":64},".skill-meta.json","REFERENCE","参考文档",144,"https:\u002F\u002Fgithub.com\u002Fjijingkun-commits\u002Ffastapi\u002Fblob\u002Fmaster\u002F.cursor\u002Fskills\u002Fcode-refactoring\u002F.skill-meta.json",[66,97,117,137,154,171],{"skillNo":67,"name":68,"nameZh":6,"description":69,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":70,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":81,"publishedAt":33},"01M6F3A92FXC8E0GZHN3HEZF9J","webapp-testing","Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fjijingkun-commits\u002Ffastapi\u002Fblob\u002Fmaster\u002F.cursor\u002Fskills\u002Fwebapp-testing\u002FSKILL.md",[73,78],{"categoryNo":74,"categoryName":75,"taxonomyType":76,"taxonomyTypeDesc":77},"01JBSEEDCAT000000000000008","测试与质量","SCENARIO","使用场景",{"categoryNo":79,"categoryName":80,"taxonomyType":76,"taxonomyTypeDesc":77},"01JBSEEDCAT000000000000009","前端开发",[82,83,84,85,28,86,87,88,89,90,91,92,93,94,95,96],"testing","webapp testing","webapp","applications","local","with","ui","web","playwright","screenshots","toolkit","frontend","browser","debugging","logs",{"skillNo":98,"name":99,"nameZh":6,"description":100,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":70,"licenseFileUrl":6,"sourceHtmlUrl":101,"categories":102,"keywords":106,"publishedAt":33},"01M6CDY9E8HXK9RZ2MHJEP26X5","skill-creator","Guide for creating effective skills. Use when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.","https:\u002F\u002Fgithub.com\u002Fjijingkun-commits\u002Ffastapi\u002Fblob\u002Fmaster\u002F.cursor\u002Fskills\u002Fskill-creator\u002FSKILL.md",[103],{"categoryNo":104,"categoryName":105,"taxonomyType":76,"taxonomyTypeDesc":77},"01JBSEEDCAT000000000000023","Skill与智能体开发",[107,108,29,109,110,111,112,113,114,115,116],"skill creator","workflows","guide","specialized","integrations","tool","knowledge","capabilities","update","create",{"skillNo":118,"name":119,"nameZh":6,"description":120,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":121,"categories":122,"keywords":123,"publishedAt":33},"01M6CDY73FB6SWVF6R7PVYBNGW","python-development","Modern Python development with Python 3.12+, Django, FastAPI, async patterns, and production best practices. Use for Python projects, APIs, data processing, or automation scripts.","https:\u002F\u002Fgithub.com\u002Fjijingkun-commits\u002Ffastapi\u002Fblob\u002Fmaster\u002F.cursor\u002Fskills\u002Fpython-development\u002FSKILL.md",[],[124,125,126,127,128,129,29,130,131,132,133,134,135,136],"python development","python","development","data processing","async","modern python","fastapi","django","projects","Production","data","best practices","automation",{"skillNo":138,"name":139,"nameZh":6,"description":140,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":141,"categories":142,"keywords":144,"publishedAt":33},"01M6CDY49757TMZDVGZN5VD14W","llm-application-dev","Building applications with Large Language Models - prompt engineering, RAG patterns, and LLM integration. Use for AI-powered features, chatbots, or LLM-based automation.","https:\u002F\u002Fgithub.com\u002Fjijingkun-commits\u002Ffastapi\u002Fblob\u002Fmaster\u002F.cursor\u002Fskills\u002Fllm-application-dev\u002FSKILL.md",[143],{"categoryNo":104,"categoryName":105,"taxonomyType":76,"taxonomyTypeDesc":77},[145,146,147,148,29,149,85,150,151,152,136,153],"llm application dev","dev","large language models","models","prompt","engineering","integration","rag","prompt engineering",{"skillNo":155,"name":156,"nameZh":6,"description":157,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":158,"categories":159,"keywords":161,"publishedAt":33},"01M6CDY1Y5CN4XWWTZQQ2K87TK","javascript-typescript","JavaScript and TypeScript development with ES6+, Node.js, React, and modern web frameworks. Use for frontend, backend, or full-stack JavaScript\u002FTypeScript projects.","https:\u002F\u002Fgithub.com\u002Fjijingkun-commits\u002Ffastapi\u002Fblob\u002Fmaster\u002F.cursor\u002Fskills\u002Fjavascript-typescript\u002FSKILL.md",[160],{"categoryNo":79,"categoryName":80,"taxonomyType":76,"taxonomyTypeDesc":77},[162,163,164,89,93,165,166,167,29,168,169,132,170,126],"javascript typescript","javascript","typescript","react","web frameworks","backend","node","stack","js",{"skillNo":172,"name":173,"nameZh":6,"description":174,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":70,"licenseFileUrl":6,"sourceHtmlUrl":175,"categories":176,"keywords":184,"publishedAt":33},"01M6CDXZ9582WWNZ2HZTNQDJ0T","frontend-design","Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, artifacts, posters, or applications (examples include websites, landing pages, dashboards, React components, HTML\u002FCSS layouts, or when styling\u002Fbeautifying any web UI). Generates creative, polished code and UI design that avoids generic AI aesthetics.","https:\u002F\u002Fgithub.com\u002Fjijingkun-commits\u002Ffastapi\u002Fblob\u002Fmaster\u002F.cursor\u002Fskills\u002Ffrontend-design\u002FSKILL.md",[177,178,181],{"categoryNo":79,"categoryName":80,"taxonomyType":76,"taxonomyTypeDesc":77},{"categoryNo":179,"categoryName":180,"taxonomyType":76,"taxonomyTypeDesc":77},"01JBSEEDCAT000000000000015","视觉设计",{"categoryNo":182,"categoryName":183,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000032","设计师",[185,186,93,187,188,189,190,29,191,27,85,192,23,116,193,194,165,195,89,196],"design","frontend design","examples","build","ui design","creative","landing","artifacts","web components","react components","components","css"]