Skip to content
Back to skills

Quality Sonarqube Sonarqube Cognitive Complexity Reduction

ASecurity

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.

  • 4 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 2, 2026
developmentjavascripttypescriptgojavanode

Security analysis

A100/100

Scanned October 2, 2026

npx -y skills add janpereira-dev/ngAutoPilot --skill quality--sonarqube--sonarqube-cognitive-complexity-reduction --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Quality Sonarqube Sonarqube Cognitive Complexity Reduction?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Quality  Sonarqube  Sonarqube Cognitive Complexity Reduction
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/janpereira-dev-quality-sonarqube-sonarqube-cognitive-complexity-r/badge)](https://www.skillsdirectory.com/skills/janpereira-dev-quality-sonarqube-sonarqube-cognitive-complexity-r)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: quality.sonarqube.sonarqube-cognitive-complexity-reduction
name: SonarQube Cognitive Complexity Reduction
description: >
  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.
stack:
  - JavaScript
  - TypeScript
category: sonarqube
status: stable
version: 0.10.0
owner: NgAutoPilot
triggers:
  - cognitive complexity
  - sonar complexity
  - branch simplification
  - complex function
  - nested conditionals
compatibility:
  runtime:
    browser: true
    node: true
---

# 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:

```txt
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

1. Identify the complexity drivers.
2. Simplify the branches safely.
3. Keep behavior covered.
4. Avoid ornamental abstraction.
5. Produce a readable refactor.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…