[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6AE4MS1PCVB8QBPDB63TFD2":3,"skill-same:01M6AE4MS1PCVB8QBPDB63TFD2":61},{"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":23,"publishedAt":32,"linkOnly":33,"markdownContent":34,"markdownBody":35,"frontMatter":36,"refName":37,"commitSha":38,"skillDirectory":39,"forksCount":40,"repositoryHtmlUrl":41,"repositoryHomepageUrl":42,"ownerHtmlUrl":43,"ownerBlogUrl":44,"ownerDescription":45,"updatedAt":46,"install":47,"resources":60},"01M6AE4MS1PCVB8QBPDB63TFD2","refactor-method-complexity-reduce",null,"Refactor given method `${input:methodName}` to reduce its cognitive complexity to `${input:complexityThreshold}` or below, by extracting helper methods.","github\u002Fawesome-copilot","github","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F9919?v=4","01M6AC83DS133TPXFSP1DHNCC6","GitHub","01M6AD3PBDYPK7NVFJNJ66Y8RS",41046,"MIT","https:\u002F\u002Fgithub.com\u002Fgithub\u002Fawesome-copilot\u002Fblob\u002Fmain\u002Fskills\u002Frefactor-method-complexity-reduce\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000007","代码审查","SCENARIO","使用场景",[24,25,26,27,28,29,30,31],"refactor method complexity reduce","refactor","complexity","reduce","methods","input","helper","extracting","2026-11-10 10:12:30",false,"---\nname: refactor-method-complexity-reduce\ndescription: 'Refactor given method `${input:methodName}` to reduce its cognitive complexity to `${input:complexityThreshold}` or below, by extracting helper methods.'\n---\n\n# Refactor Method to Reduce Cognitive Complexity\n\n## Objective\nRefactor the method `${input:methodName}`, to reduce its cognitive complexity to `${input:complexityThreshold}` or below, by extracting logic into focused helper methods.\n\n## Instructions\n\n1. **Analyze the current method** to identify sources of cognitive complexity:\n   - Nested conditional statements\n   - Multiple if-else or switch chains\n   - Repeated code blocks\n   - Multiple loops with conditions\n   - Complex boolean expressions\n\n2. **Identify extraction opportunities**:\n   - Validation logic that can be extracted into a separate method\n   - Type-specific or case-specific processing that repeats\n   - Complex transformations or calculations\n   - Common patterns that appear multiple times\n\n3. **Extract focused helper methods**:\n   - Each helper should have a single, clear responsibility\n   - Extract validation into separate `Validate*` methods\n   - Extract type-specific logic into handler methods\n   - Create utility methods for common operations\n   - Use appropriate access levels (static, private, async)\n\n4. **Simplify the main method**:\n   - Reduce nesting depth\n   - Replace massive if-else chains with smaller orchestrated calls\n   - Use switch statements where appropriate for cleaner dispatch\n   - Ensure the main method reads as a high-level flow\n\n5. **Preserve functionality**:\n   - Maintain the same input\u002Foutput behavior\n   - Keep all validation and error handling\n   - Preserve exception types and error messages\n   - Ensure all parameters are properly passed to helpers\n\n6. **Best practices**:\n   - Make helper methods static when they don't need instance state\n   - Use null checks and guard clauses early\n   - Avoid creating unnecessary local variables\n   - Consider using tuples for multiple return values\n   - Group related helper methods together\n\n## Implementation Approach\n\n- Extract helper methods before refactoring the main flow\n- Test incrementally to ensure no regressions\n- Use meaningful names that describe the extracted responsibility\n- Keep extracted methods close to where they're used\n- Consider making repeated code patterns into generic methods\n\n## Result\n\nThe refactored method should:\n- Have cognitive complexity reduced to the target threshold of `${input:complexityThreshold}` or below\n- Be more readable and maintainable\n- Have clear separation of concerns\n- Be easier to test and debug\n- Retain all original functionality\n\n## Testing and Validation\n\n**CRITICAL: After completing the refactoring, you MUST:**\n\n1. **Run all existing tests** related to the refactored method and its surrounding functionality\n2. **MANDATORY: Explicitly verify test results show \"failed=0\"**\n   - **NEVER assume tests passed** - always examine the actual test output\n   - Search for the summary line containing pass\u002Ffail counts (e.g., \"passed=X failed=Y\")\n   - **If the summary shows any number other than \"failed=0\", tests have FAILED**\n   - If test output is in a file, read the entire file to locate and verify the failure count\n   - Running tests is NOT the same as verifying tests passed\n   - **Do not proceed** until you have explicitly confirmed zero failures\n3. **If any tests fail (failed > 0):**\n   - State clearly how many tests failed\n   - Analyze each failure to understand what functionality was broken\n   - Common causes: null handling, empty collection checks, condition logic errors\n   - Identify the root cause in the refactored code\n   - Correct the refactored code to restore the original behavior\n   - Re-run tests and verify \"failed=0\" in the output\n   - Repeat until all tests pass (failed=0)\n4. **Verify compilation** - Ensure there are no compilation errors\n5. **Check cognitive complexity** - Confirm the metric is at or below the target threshold of `${input:complexityThreshold}`\n\n## Confirmation Checklist\n- [ ] Code compiles without errors\n- [ ] **Test results explicitly state \"failed=0\"** (verified by reading the output)\n- [ ] All test failures analyzed and corrected (if any occurred)\n- [ ] Cognitive complexity is at or below the target threshold of `${input:complexityThreshold}`\n- [ ] All original functionality is preserved\n- [ ] Code follows project conventions and standards\n","# Refactor Method to Reduce Cognitive Complexity\n\n## Objective\nRefactor the method `${input:methodName}`, to reduce its cognitive complexity to `${input:complexityThreshold}` or below, by extracting logic into focused helper methods.\n\n## Instructions\n\n1. **Analyze the current method** to identify sources of cognitive complexity:\n   - Nested conditional statements\n   - Multiple if-else or switch chains\n   - Repeated code blocks\n   - Multiple loops with conditions\n   - Complex boolean expressions\n\n2. **Identify extraction opportunities**:\n   - Validation logic that can be extracted into a separate method\n   - Type-specific or case-specific processing that repeats\n   - Complex transformations or calculations\n   - Common patterns that appear multiple times\n\n3. **Extract focused helper methods**:\n   - Each helper should have a single, clear responsibility\n   - Extract validation into separate `Validate*` methods\n   - Extract type-specific logic into handler methods\n   - Create utility methods for common operations\n   - Use appropriate access levels (static, private, async)\n\n4. **Simplify the main method**:\n   - Reduce nesting depth\n   - Replace massive if-else chains with smaller orchestrated calls\n   - Use switch statements where appropriate for cleaner dispatch\n   - Ensure the main method reads as a high-level flow\n\n5. **Preserve functionality**:\n   - Maintain the same input\u002Foutput behavior\n   - Keep all validation and error handling\n   - Preserve exception types and error messages\n   - Ensure all parameters are properly passed to helpers\n\n6. **Best practices**:\n   - Make helper methods static when they don't need instance state\n   - Use null checks and guard clauses early\n   - Avoid creating unnecessary local variables\n   - Consider using tuples for multiple return values\n   - Group related helper methods together\n\n## Implementation Approach\n\n- Extract helper methods before refactoring the main flow\n- Test incrementally to ensure no regressions\n- Use meaningful names that describe the extracted responsibility\n- Keep extracted methods close to where they're used\n- Consider making repeated code patterns into generic methods\n\n## Result\n\nThe refactored method should:\n- Have cognitive complexity reduced to the target threshold of `${input:complexityThreshold}` or below\n- Be more readable and maintainable\n- Have clear separation of concerns\n- Be easier to test and debug\n- Retain all original functionality\n\n## Testing and Validation\n\n**CRITICAL: After completing the refactoring, you MUST:**\n\n1. **Run all existing tests** related to the refactored method and its surrounding functionality\n2. **MANDATORY: Explicitly verify test results show \"failed=0\"**\n   - **NEVER assume tests passed** - always examine the actual test output\n   - Search for the summary line containing pass\u002Ffail counts (e.g., \"passed=X failed=Y\")\n   - **If the summary shows any number other than \"failed=0\", tests have FAILED**\n   - If test output is in a file, read the entire file to locate and verify the failure count\n   - Running tests is NOT the same as verifying tests passed\n   - **Do not proceed** until you have explicitly confirmed zero failures\n3. **If any tests fail (failed > 0):**\n   - State clearly how many tests failed\n   - Analyze each failure to understand what functionality was broken\n   - Common causes: null handling, empty collection checks, condition logic errors\n   - Identify the root cause in the refactored code\n   - Correct the refactored code to restore the original behavior\n   - Re-run tests and verify \"failed=0\" in the output\n   - Repeat until all tests pass (failed=0)\n4. **Verify compilation** - Ensure there are no compilation errors\n5. **Check cognitive complexity** - Confirm the metric is at or below the target threshold of `${input:complexityThreshold}`\n\n## Confirmation Checklist\n- [ ] Code compiles without errors\n- [ ] **Test results explicitly state \"failed=0\"** (verified by reading the output)\n- [ ] All test failures analyzed and corrected (if any occurred)\n- [ ] Cognitive complexity is at or below the target threshold of `${input:complexityThreshold}`\n- [ ] All original functionality is preserved\n- [ ] Code follows project conventions and standards\n",{"name":5,"description":7},"main","5269f7ea2d6c3a9bfda5ed878b6726cf509121fd","skills\u002Frefactor-method-complexity-reduce",5340,"https:\u002F\u002Fgithub.com\u002Fgithub\u002Fawesome-copilot","https:\u002F\u002Fawesome-copilot.github.com\u002F","https:\u002F\u002Fgithub.com\u002Fgithub","https:\u002F\u002Fgithub.com\u002Fabout","How people build software.","2026-11-11 13:41:32",{"source":8,"skillName":5,"commands":48,"prompt":58,"zipAvailable":59},[49,52,55],{"tool":50,"command":51},"npx","npx skills add github\u002Fawesome-copilot --skill refactor-method-complexity-reduce",{"tool":53,"command":54},"bunx","bunx skills add github\u002Fawesome-copilot --skill refactor-method-complexity-reduce",{"tool":56,"command":57},"pnpm","pnpm dlx skills add github\u002Fawesome-copilot --skill refactor-method-complexity-reduce","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fgithub\u002Fawesome-copilot\u002Fblob\u002Fmain\u002Fskills\u002Frefactor-method-complexity-reduce\u002FSKILL.md",true,[],[62,95,122,152,185,202],{"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":6,"sourceHtmlUrl":66,"categories":67,"keywords":74,"publishedAt":32},"01M70KXZNX9ES38N2A8M58ZZMZ","supabase-rls-policies","Write, review, and test Supabase Row Level Security (RLS) policies so that one user cannot read or change another user's rows. Use when creating or changing tables, policies, views, or security definer functions in a Supabase project, when reviewing a migration that touches RLS, or when asked to prove user isolation with pgTAP tests that sign in as two users.","https:\u002F\u002Fgithub.com\u002Fgithub\u002Fawesome-copilot\u002Fblob\u002Fmain\u002Fskills\u002Fsupabase-rls-policies\u002FSKILL.md",[68,71],{"categoryNo":69,"categoryName":70,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000008","测试与质量",{"categoryNo":72,"categoryName":73,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发",[75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94],"supabase","rls","supabase rls","supabase rls policies","project","when","review","change","read","write","security","isolation","tables","as","tests","prove","use","users","functions","with",{"skillNo":96,"name":97,"nameZh":6,"description":98,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":99,"categories":100,"keywords":102,"publishedAt":32},"01M70KWA5YWXDV6V8DZ19E3T2Y","skill-distribution-audit","Audit a skill collection before release or investigate installer omissions, archived\u002Ftemplate leakage, duplicate identities, and manifest drift. Reconcile the intended public source set, distribution manifest, and actual discovery output for a specified consumer version. Includes a deterministic set-comparison helper.","https:\u002F\u002Fgithub.com\u002Fgithub\u002Fawesome-copilot\u002Fblob\u002Fmain\u002Fskills\u002Fskill-distribution-audit\u002FSKILL.md",[101],{"categoryNo":72,"categoryName":73,"taxonomyType":21,"taxonomyTypeDesc":22},[103,104,105,106,107,108,109,110,111,30,112,113,114,115,116,117,118,119,120,121],"distribution","skill distribution audit","audit","SET","deterministic","installer","for","discovery","comparison","manifest","version","collection","drift","output","investigate","duplicate","template","release","reconcile",{"skillNo":123,"name":124,"nameZh":6,"description":125,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":126,"sourceHtmlUrl":127,"categories":128,"keywords":134,"publishedAt":32},"01M70KCJPFVW7PPQ49CC5R8JGK","logicapps-custom-code-net10-migration","Migrate Azure Logic Apps Standard local-function custom-code projects from .NET 8 to .NET 10. Use for legacy Logic Apps custom-code workspace upgrades, project\u002Fpackage configuration, custom-worker settings, publication, and integrated VS Code debugging. Not for ordinary .NET applications, standalone Azure Functions, Consumption workflows, or cloud deployment.","https:\u002F\u002Fgithub.com\u002Fgithub\u002Fawesome-copilot\u002Fblob\u002Fmain\u002Fskills\u002Flogicapps-custom-code-net10-migration\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fgithub\u002Fawesome-copilot\u002Fblob\u002Fmain\u002Fskills\u002Flogicapps-custom-code-net10-migration\u002FSKILL.md",[129],{"categoryNo":130,"categoryName":131,"taxonomyType":132,"taxonomyTypeDesc":133},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[135,136,137,138,139,140,109,79,141,142,143,144,145,146,147,91,148,149,150,151],"custom","code","logicapps custom code net10 migration","migration","projects","standalone","deployment","applications","local","azure","worker","upgrades","package","apps","Legacy","debugging","workflows",{"skillNo":153,"name":154,"nameZh":6,"description":155,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":156,"sourceHtmlUrl":157,"categories":158,"keywords":163,"publishedAt":32},"01M6AEBN37RQMXJ3298PEY7PG1","winmd-api-search","Find and explore Windows desktop APIs. Use when building features that need platform capabilities — camera, file access, notifications, UI controls, AI\u002FML, sensors, networking, etc. Discovers the right API for a task and retrieves full type details (methods, properties, events, enumeration values).","https:\u002F\u002Fgithub.com\u002Fgithub\u002Fawesome-copilot\u002Fblob\u002Fmain\u002Fskills\u002Fwinmd-api-search\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fgithub\u002Fawesome-copilot\u002Fblob\u002Fmain\u002Fskills\u002Fwinmd-api-search\u002FSKILL.md",[159,162],{"categoryNo":160,"categoryName":161,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000010","后端与接口",{"categoryNo":130,"categoryName":131,"taxonomyType":132,"taxonomyTypeDesc":133},[164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,80,179,180,181,182,183,109,28,184],"winmd api search","search","api","windows","desktop","file access","enumeration","ui","ml","file","networking","capabilities","notifications","explore","access","features","full","camera","events","platform","controls",{"skillNo":186,"name":187,"nameZh":6,"description":188,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":189,"licenseFileUrl":190,"sourceHtmlUrl":191,"categories":192,"keywords":198,"publishedAt":32},"01M6AE571R3SC1ZGE202B3NB5S","resemble-detect","Deepfake detection and media safety — detect AI-generated audio, images, video, and text, trace synthesis sources, apply watermarks, verify speaker identity, and analyze media intelligence using Resemble AI","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fgithub\u002Fawesome-copilot\u002Fblob\u002Fmain\u002Fskills\u002Fresemble-detect\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fgithub\u002Fawesome-copilot\u002Fblob\u002Fmain\u002Fskills\u002Fresemble-detect\u002FSKILL.md",[193,194,197],{"categoryNo":160,"categoryName":161,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":195,"categoryName":196,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000016","图像与多媒体",{"categoryNo":72,"categoryName":73,"taxonomyType":21,"taxonomyTypeDesc":22},[199,106,173,200,201],"resemble detect","https","identity",{"skillNo":203,"name":204,"nameZh":6,"description":205,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":189,"licenseFileUrl":206,"sourceHtmlUrl":207,"categories":208,"keywords":211,"publishedAt":32},"01M6AE30BSK2HCY4TQQ22Z8JRD","quality-playbook","Run a complete quality engineering audit on any codebase. Derives behavioral requirements from the code, generates spec-traced functional tests, runs a three-pass code review with regression tests, executes a multi-model spec audit (Council of Three), and produces a consolidated bug report with TDD-verified patches. Finds the 35% of real defects that structural code review alone cannot catch. Works with any language. Trigger on 'quality playbook', 'spec audit', 'Council of Three', 'fitness-to-purpose', or 'coverage theater'.","https:\u002F\u002Fgithub.com\u002Fgithub\u002Fawesome-copilot\u002Fblob\u002Fmain\u002Fskills\u002Fquality-playbook\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fgithub\u002Fawesome-copilot\u002Fblob\u002Fmain\u002Fskills\u002Fquality-playbook\u002FSKILL.md",[209,210],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":72,"categoryName":73,"taxonomyType":21,"taxonomyTypeDesc":22},[212,213,214,215,136,81,9,105,216,217,200,218,219,220,221,222,223,224,225,226,227,228,89,229,230,231,232],"playbook","quality playbook","quality","code review","tdd","run","report","spec","bug report","council","engineering","functional","spec audit","bug","verified","multi-model","three","coverage","model","regression","structural"]