원클릭으로
control-flow
Flatten nested conditionals and make the happy path readable
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Flatten nested conditionals and make the happy path readable
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
| name | control-flow |
| description | Flatten nested conditionals and make the happy path readable |
Use this skill when a change touches branching logic, validation, installation flow, filesystem routing, renderer event handlers, or any function with nested conditionals.
This skill targets dangerous pattern #4 from AI_DANGER_PATTERNS.md: deep if/else nesting.
The happy path should not be buried.
Invalid, unsupported, or exceptional cases should exit early.
Look for:
if/else blockselse after return, throw, continue, or breakTry these in order:
else after terminal statementsswitch for many exclusive domain casesBad:
if (game.isInstalled) {
if (game.supportsMods) {
if (!game.isRunning) {
installMod(mod)
}
}
}
Good:
if (!game.isInstalled) return
if (!game.supportsMods) return
if (game.isRunning) return
installMod(mod)
Bad:
if (!gamePath) {
return null
} else {
return scanGame(gamePath)
}
Good:
if (!gamePath) return null
return scanGame(gamePath)
Do not change behavior while flattening code.
Before editing, identify which branches return early, throw, mutate state, write files, call APIs, or show UI feedback. After editing, ensure those effects still happen under the same conditions.
Do not fix nesting by creating a fake abstraction.
Bad:
function validateGameState(game: Game) {
return game.isInstalled && game.supportsMods && !game.isRunning
}
Only good if validateGameState is a real reused domain rule. Otherwise use a named boolean inline.
After editing, report:
Add user-facing entries to CHANGELOG.md's Unreleased section for recent changes
Remove AI-generated code slop from a diff, path, branch, or repository
Review a diff for AI-shaped code before a PR, commit, or final summary
Remove useless comments and keep only human-useful context
Audit a diff for the five dangerous AI patterns
Propose a conventional commit message for the current diff