From superpowers-plus
Refactors functions with Biome noExcessiveCognitiveComplexity errors, 3+ nesting levels, or >30 lines by extracting logic, early returns, and simplifying control flow. Bans biome-ignore comments.
npx claudepluginhub bordenet/superpowers-plus --plugin superpowers-plusThis skill uses the workspace's default tool permissions.
Invoke this skill when:
Mandates invoking relevant skills via tools before any response in coding sessions. Covers access, priorities, and adaptations for Claude Code, Copilot CLI, Gemini CLI.
Share bugs, ideas, or general feedback.
Invoke this skill when:
noExcessiveCognitiveComplexitybiome-ignore comments are BANNED in new code.
When Biome reports an error:
// biome-ignore to suppress the warning// ❌ NEVER DO THIS
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: complex
function handleMessage(data: Buffer): void {
// 25 lines of nested if/else statements
}
// ✅ ALWAYS DO THIS - Extract to smaller functions
function handleMessage(data: Buffer): void {
const message = parseMessage(data)
if (message.type === 'partial') {
handlePartialResult(message)
} else if (message.type === 'final') {
handleFinalResult(message)
}
}
function handlePartialResult(message: Message): void {
if (!message.text) return
const event = createResultEvent(message, false)
emitResult(event)
}
Measures how hard a function is to understand.
Calculates based on:
Threshold: Maximum 15 (configured in biome.json)
// ✅ Complexity reduced by extraction
function processCoordinates() {
for (let x = 0; x < 10; x++) {
for (let y = 0; y < 10; y++) {
processPoint(x, y)
}
}
}
function processPoint(x: number, y: number) {
if (x % 2 !== 0) return
if (y % 2 !== 0) return
const max = x > y ? x : y
console.log(max)
}
// ✅ Complexity: 3
function validate(data: Data | null): boolean {
if (!data) return false
if (!data.isValid) return false
if (!data.hasRequiredFields()) return false
return true
}
// vs ❌ Complexity: 6
function validate(data: Data | null): boolean {
if (data) {
if (data.isValid) {
if (data.hasRequiredFields()) {
return true
}
}
}
return false
}
// ✅ Reduce nesting
const canProcess = isActive && hasPermission && !isBlocked
if (!canProcess) return
processItem()
// vs ❌ Nested ifs
if (isActive) {
if (hasPermission) {
if (!isBlocked) {
processItem()
}
}
}
Standard: <300 lines per file Exception: Cohesive state machines (~350 lines acceptable)
If file >300 lines: Refactor into smaller focused files.
pnpm lint # No Biome complexity warnings
A task is NOT complete until this passes.
| Mode | Symptom | Recovery |
|---|---|---|
| Over-refactor | New bugs introduced | Run tests after each extraction |
| Wrong extraction boundary | Makes code harder to follow | Keep related logic together |
| Extracting too aggressively | Many tiny functions obscure flow | Balance complexity score with readability |