skills/early-return-from-functions/SKILL.md
Use early returns to reduce nesting and clarify control flow. Use when simplifying conditionals or guard clauses.
npx skillsauth add ihj04982/my-cursor-settings early-return-from-functionsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Return early when result is determined to skip unnecessary processing.
Incorrect (processes all items even after finding answer):
function validateUsers(users: User[]) {
let hasError = false;
let errorMessage = '';
for (const user of users) {
if (!user.email) {
hasError = true;
errorMessage = 'Email required';
}
if (!user.name) {
hasError = true;
errorMessage = 'Name required';
}
// Continues checking all users even after error found
}
return hasError ? { valid: false, error: errorMessage } : { valid: true };
}
Correct (returns immediately on first error):
function validateUsers(users: User[]) {
for (const user of users) {
if (!user.email) {
return { valid: false, error: 'Email required' };
}
if (!user.name) {
return { valid: false, error: 'Name required' };
}
}
return { valid: true };
}
development
Conduct WCAG 2.2 accessibility audits with automated testing, manual verification, and remediation guidance. Use when auditing websites for accessibility, fixing WCAG violations, or implementing accessible design patterns.
research
Generate high-entropy research (자료조사) and ideas (아이디어) using Verbalized Sampling to avoid mode collapse and maximize creativity and novelty.
development
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.
documentation
Sync documentation from source-of-truth (package.json, .env.example). Generates CONTRIB.md, RUNBOOK.md. Use when updating project docs or after adding scripts/env vars.