What problem does it solve?
This Skill helps you write idiomatic Go control flow without nested conditionals, shadowing bugs, or incorrect loop and switch behavior. It keeps logic flat, scopes variables correctly, and prevents subtle mistakes that are easy to miss in review.
Core Features & Use Cases
- If-init and guard clauses: Use short-lived variables for checks, then return early instead of nesting
else blocks.
- Loop mastery: Choose between condition-only, three-clause, and infinite loops, and use
range correctly across slices, maps, strings, and channels.
- Switch and flow control: Apply comma cases, type switches, explicit fallthrough, and labeled break/continue when switching inside loops.
- Blank identifier patterns: Discard unwanted values safely, document intentional side-effect imports, and assert interface compliance at compile time.
- Use case: Refactor a Go function that has shadowed variables, unclear loop intent, and brittle switch logic into a concise, idiomatic implementation.
Quick Start
Use the go-control-flow skill to review this Go function for shadowing, guard-clause opportunities, loop idioms, switch behavior, and safe uses of the blank identifier.