Skip to main content

reduce-nesting

Flatten deeply nested conditionals into readable, early-return code. Use on any function with 3+ levels of indentation.

소스 정보

저장소
Archive228/loopkit
최근 소스 활동
2026년 6월 29일 22:25
감지된 SKILL.md 언어
영어
스타
757
포크
124

설치 방법

기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.

소스 파일 검토

설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.

SKILL.md 표시 중

SKILL.md
소스 지침 · 읽기 전용 미리보기
name
reduce-nesting
description
Flatten deeply nested conditionals into readable, early-return code. Use on any function with 3+ levels of indentation.
when_to_use
arrow-shaped code, 3+ nested ifs, a function that's hard to follow
# Reduce Nesting Deep nesting hides bugs in the branches you didn't read. - **Guard clauses** — handle the invalid/edge cases first and return early. The happy path drops to the left margin. - **Invert conditions** — `if (!valid) return;` instead of wrapping the whole body in `if (valid) {...}`. - **Extract** — a nested block doing one thing becomes a named function. - **Replace flag-then-branch** — return the result directly instead of setting a variable to return later. Target: no function deeper than 2-3 levels. If you still need more, the function is doing too much — split it.
GitHub에서 보기