[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7CWRVD1TQHSWQDHNJF0TC47":3,"skill-same:01M7CWRVD1TQHSWQDHNJF0TC47":46},{"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":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":25,"commitSha":26,"skillDirectory":27,"forksCount":14,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":6,"ownerDescription":30,"updatedAt":31,"install":32,"resources":45},"01M7CWRVD1TQHSWQDHNJF0TC47","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.","haidonglethqb\u002FBAHAU","haidonglethqb","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F115625430?v=4","01M7CW8M42R8EJ7G0P4XPYEE5D","HAI","01M7CW8M550DFW4TEHPTGEA1S8",0,"MIT","https:\u002F\u002Fgithub.com\u002Fhaidonglethqb\u002FBAHAU\u002Fblob\u002Fmain\u002F.cursor\u002Fskills\u002Fcode-refactoring\u002FSKILL.md",[],[],"2026-11-15 14:19:17",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":24,"license":15,"description":7},"wshobson\u002Fagents","main","82da5963278d597455c869ad91cfc05b2b607e75",".cursor\u002Fskills\u002Fcode-refactoring","https:\u002F\u002Fgithub.com\u002Fhaidonglethqb\u002FBAHAU","https:\u002F\u002Fgithub.com\u002Fhaidonglethqb","Study at University of information technology - Viet Nam National University","2026-11-12 17:30:31",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add haidonglethqb\u002FBAHAU --skill code-refactoring",{"tool":38,"command":39},"bunx","bunx skills add haidonglethqb\u002FBAHAU --skill code-refactoring",{"tool":41,"command":42},"pnpm","pnpm dlx skills add haidonglethqb\u002FBAHAU --skill code-refactoring","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fhaidonglethqb\u002FBAHAU\u002Fblob\u002Fmain\u002F.cursor\u002Fskills\u002Fcode-refactoring\u002FSKILL.md",true,[],[47,55,62,70,77,85],{"skillNo":48,"name":49,"nameZh":6,"description":50,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":51,"licenseFileUrl":6,"sourceHtmlUrl":52,"categories":53,"keywords":54,"publishedAt":19},"01M7CX33YDC6KGJ0E8BXAZPJ5F","ck:web-testing","Web testing with Playwright, Vitest, k6. E2E\u002Funit\u002Fintegration\u002Fload\u002Fsecurity\u002Fvisual\u002Fa11y testing. Use for test automation, flakiness, Core Web Vitals, mobile gestures, cross-browser.","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fhaidonglethqb\u002FBAHAU\u002Fblob\u002Fmain\u002F.qwen\u002Fskills\u002Fweb-testing\u002FSKILL.md",[],[],{"skillNo":56,"name":57,"nameZh":6,"description":58,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":59,"categories":60,"keywords":61,"publishedAt":19},"01M7CX2ZQD1ZYDCPDXV9RT172S","ck:web-frameworks","Build with Next.js (App Router, RSC, SSR, ISR), Turborepo monorepos. Use for React apps, server rendering, build optimization, caching strategies, shared dependencies.","https:\u002F\u002Fgithub.com\u002Fhaidonglethqb\u002FBAHAU\u002Fblob\u002Fmain\u002F.qwen\u002Fskills\u002Fweb-frameworks\u002FSKILL.md",[],[],{"skillNo":63,"name":64,"nameZh":6,"description":65,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":66,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":19},"01M7CX2AAFYCVRJVP668GQGWEG","ck:ui-styling","Style UIs with shadcn\u002Fui components (Radix UI + Tailwind CSS). Use for accessible components, themes, dark mode, responsive layouts, design systems, color customization.","https:\u002F\u002Fgithub.com\u002Fhaidonglethqb\u002FBAHAU\u002Fblob\u002Fmain\u002F.qwen\u002Fskills\u002Fui-styling\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fhaidonglethqb\u002FBAHAU\u002Fblob\u002Fmain\u002F.qwen\u002Fskills\u002Fui-styling\u002FSKILL.md",[],[],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":19},"01M7CX23C6RSSS5YQZTT9C86GC","ck:threejs","Build 3D web apps with Three.js (WebGL\u002FWebGPU). 556 searchable examples, 60 API classes, 20 use cases. Actions: create 3D scene, load model, add animation, implement physics, build VR\u002FXR. Topics: GLTF loader, PBR materials, particle effects, shadows, post-processing, compute shaders, TSL. Integrations: WebGPU, physics engines, spatial audio.","https:\u002F\u002Fgithub.com\u002Fhaidonglethqb\u002FBAHAU\u002Fblob\u002Fmain\u002F.qwen\u002Fskills\u002Fthreejs\u002FSKILL.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":51,"licenseFileUrl":81,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":19},"01M7CX1CJVKAQJHM6VSEFMNCHX","ck:skill-creator","Create or update Claude skills optimized for Skillmark benchmarks. Use for new skills, skill scripts, references, benchmark optimization, extending Claude's capabilities.","https:\u002F\u002Fgithub.com\u002Fhaidonglethqb\u002FBAHAU\u002Fblob\u002Fmain\u002F.qwen\u002Fskills\u002Fskill-creator\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fhaidonglethqb\u002FBAHAU\u002Fblob\u002Fmain\u002F.qwen\u002Fskills\u002Fskill-creator\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":19},"01M7CX115W0PP7J9CDDZZQGH0M","ck:sequential-thinking","Apply step-by-step analysis for complex problems with revision capability. Use for multi-step reasoning, hypothesis verification, adaptive planning, problem decomposition, course correction.","https:\u002F\u002Fgithub.com\u002Fhaidonglethqb\u002FBAHAU\u002Fblob\u002Fmain\u002F.qwen\u002Fskills\u002Fsequential-thinking\u002FSKILL.md",[],[]]