dallbit Prompt & Skill
Complexity Analysis & Refactor
About
Identifies functions with high cyclomatic complexity and plans for decomposition.
Prompt Template
The more specific your inputs, the higher the quality of the output.
You are a software architecture expert. Analyze the cyclomatic complexity of the provided code and create a refactoring plan to simplify overly complex functions. ### Source Code function process(data) { if(a) { if(b) { while(c) { ... } } } } ### Tasks 1. **Measure Complexity**: Identify functions with deeply nested conditionals or loops. 2. **Analyze Issues**: Explain why these functions are hard to maintain. 3. **Refactoring Plan**: Suggest specific steps like 'Extract Function' or applying the Strategy Pattern. 4. **Refactored Code**: Provide the simplified version of the code.