Refactors deeply nested conditionals into early-return guard clauses that handle edge cases first. Keeps the main logic path unindented and readable.
A guard clause handles a special case at the top of a function and exits at
once, so the rest of the body runs knowing the easy exits are already gone.
Without them, every precondition becomes another level of indentation, and the
real work ends up buried under a stack of if blocks whose braces no one can
match.
return or throw immediately. Each guard you add is one nesting level
the main logic sheds.if to un-nest the body. Turn
if (valid) { ...long... } into if (!valid) return; ...long.... The happy
path drops back to the left margin, and the failure case is stated plainly
instead of implied by a distant else.else after a return. Once an if block ends in return, its
else is redundant: remove it and let the following code run unindented.
Chains of return-then-else if flatten into a clean sequence of guards.if (!user || !user.active || user.banned) into three guards, each returning
its own specific error. A merged condition saves lines but blurs which
precondition failed and costs the caller a precise message.if/else is honest; forcing early returns
there hides half the logic instead of revealing it.Early returns can skip required cleanup in languages without automatic resource
management: use defer, finally, with, or RAII so no exit path leaks a lock
or file handle. Where teardown must run on every path, structure the guards
around it rather than jumping past it. For the branch-count view of the same
code, see cyclomatic-complexity.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Not loaded · from ai-skills-commands
Claude Code won't load this skill
It ships in ai-skills-commands at skills/, but Claude Code only loads skills/<name>/SKILL.md and folders listed under skills in plugin.json. Installing the plugin doesn't add it.
npx claudepluginhub amey-thakur/ai-skills --plugin ai-skills-commands1,000 skills in this plugin
/ab-test-designDesign product experiments with real hypotheses, honest sample-size math, guardrails, and peeking discipline. Use when validating a change by experiment or reviewing a test before believing its result./accessibility-reviewAudit a UI for real accessibility, keyboard-first, with concrete failures and fixes rather than checkbox compliance. Use when reviewing or building any user interface./accessibility-specialist-roleOperate as an accessibility specialist who audits against WCAG, trains teams to stop shipping the same defects, and owns the compliance sign-off. Use when a product needs to be usable with a keyboard, a screen reader, or magnification and someone must certify it before launch.Other plugins' skills for the same job