SonarQube Cognitive Complexity Reduction
Reduces cognitive complexity in JavaScript and TypeScript code by simplifying branching, splitting responsibilities, and extracting pure helpers only when the refactor preserves readability and tests.
How do I install this agent skill?
npx skills add https://github.com/janpereira-dev/ngautopilot --skill sonarqube-cognitive-complexity-reductionIs this agent skill safe to install?
- Gen Agent Trust Hubpass
This skill provides safe guidelines for reducing cognitive complexity in JavaScript and TypeScript code. It does not contain any code, network operations, or malicious patterns.
- Socketpass
No alerts
- Snykpass
Risk: LOW · No issues
What does this agent skill do?
SonarQube Cognitive Complexity Reduction
Purpose
Use this skill to reduce cognitive complexity without ornamental refactors.
The goal is to simplify control flow while preserving behavior and readability.
The core rule is simple:
Simplify the logic without hiding the intent.
When to Use
Use this skill when:
- Sonar marks cognitive complexity
- a function is hard to maintain
- branching is deeply nested
- responsibilities are mixed
Do
Use:
- early returns
- extracted pure helpers
- separated responsibilities
- tests before and after
Do Not
Avoid extra abstraction that makes the code harder to follow.
Avoid refactors without tests.
Review Checklist
- Complexity was reduced meaningfully.
- Behavior is covered by tests.
- The refactor improved readability.
Expected Output
When this skill is used, the agent should:
- Identify the complexity drivers.
- Simplify the branches safely.
- Keep behavior covered.
- Avoid ornamental abstraction.
- Produce a readable refactor.
How can the creator link this skill?
Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.
<a href="https://skillzs.dev/skills/janpereira-dev/ngautopilot/sonarqube-cognitive-complexity-reduction">View SonarQube Cognitive Complexity Reduction on skillZs</a>