low-complexity
Enforces low Cognitive and Cyclomatic complexity in all code. Automatically maintains readability, modularity, and maintainability by preventing complex functions during development.
Introduction
The low-complexity skill is a specialized development tool designed to automate the enforcement of code quality metrics directly within the IDE or coding agent workflow. It focuses on the SonarSource Cognitive Complexity metric and standard Cyclomatic Complexity, ensuring that every function, method, class, or module remains within manageable limits. This skill is targeted at software engineers, technical leads, and teams practicing clean code methodologies who want to prevent technical debt and 'spaghetti code' before it is even committed to the repository.
-
Automatically monitors every code modification, writing, and refactoring task without requiring explicit triggers.
-
Enforces strict complexity thresholds: keeps Cognitive Complexity and Cyclomatic Complexity strictly under 5, with absolute caps at 15 for complex logic.
-
Provides immediate guidance on industry-standard reduction techniques including method extraction, early return, guard clauses, and the replacement of nested loops with declarative pipelines or functional programming patterns.
-
Supports all programming languages and frameworks, making it a universal constraint for any modern stack.
-
Includes a quick-reference guide for logic assessment, helping developers mentally calculate complexity during the coding process.
-
To use this skill, simply install it into your agent CLI environment. It will activate whenever you request code generation, feature implementation, bug fixing, or refactoring.
-
When complexity exceeds the recommended limits, the agent will suggest specific, actionable refactoring steps to simplify the logic.
-
Preferred reduction order: prioritize method extraction, then guard clauses, followed by flattening nested conditionals and utilizing modern language features like optional chaining, null-coalescing, and pattern matching.
-
Use this for any task involving high-logic components, complex API handlers, or critical business service layers where readability and testability are paramount.
-
Note that while lambdas are often allowed, they increment nesting depth, so the skill encourages keeping nested closures shallow to avoid structural complexity penalties.
Repository Stats
- Stars
- 1
- Forks
- 0
- Open Issues
- 0
- Language
- Not provided
- Default Branch
- main
- Sync Status
- Idle
- Last Synced
- May 3, 2026, 09:51 PM