Skip to content
Back to skills

Control Flow

ASecurity

Human-readable control flow patterns for refactoring complex conditionals. Use when refactoring nested conditionals, improving code readability, or restructuring decision logic.

  • 666 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added February 8, 2026
developmenttypescriptgorefactoring

Security analysis

A100/100

Scanned February 12, 2026

npx -y skills add majiayu000/claude-skill-registry --skill control-flow --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Control Flow?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Control Flow
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/majiayu000-control-flow/badge)](https://www.skillsdirectory.com/skills/majiayu000-control-flow)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: control-flow
description: Human-readable control flow patterns for refactoring complex conditionals. Use when refactoring nested conditionals, improving code readability, or restructuring decision logic.
---

# Human-Readable Control Flow

When refactoring complex control flow, mirror natural human reasoning patterns:

1. **Ask the human question first**: "Can I use what I already have?" -> early return for happy path
2. **Assess the situation**: "What's my current state and what do I need to do?" -> clear, mutually exclusive conditions
3. **Take action**: "Get what I need" -> consolidated logic at the end
4. **Use natural language variables**: `isUsingNavigator`, `isUsingLocalTranscription`, `needsOldFileCleanup`: names that read like thoughts
5. **Avoid artificial constructs**: No nested conditions that don't match how humans actually think through problems

Transform this: nested conditionals with duplicated logic
Into this: linear flow that mirrors human decision-making

## Example: Early Returns with Natural Language Variables

```typescript
// From apps/whispering/src/routes/(app)/_layout-utils/check-ffmpeg.ts

export async function checkFfmpegRecordingMethodCompatibility() {
  if (!window.__TAURI_INTERNALS__) return;

  // Only check if FFmpeg recording method is selected
  if (settings.value['recording.method'] !== 'ffmpeg') return;

  const { data: ffmpegInstalled } = await rpc.ffmpeg.checkFfmpegInstalled.ensure();
  if (ffmpegInstalled) return; // FFmpeg is installed, all good

  // FFmpeg recording method selected but not installed
  toast.warning('FFmpeg Required for FFmpeg Recording Method', {
    // ... toast content
  });
}
```

## Example: Natural Language Booleans

```typescript
// From apps/whispering/src/routes/(app)/_layout-utils/check-ffmpeg.ts

const isUsingNavigator = settings.value['recording.method'] === 'navigator';
const isUsingLocalTranscription =
  settings.value['transcription.selectedTranscriptionService'] === 'whispercpp' ||
  settings.value['transcription.selectedTranscriptionService'] === 'parakeet';

return isUsingNavigator && isUsingLocalTranscription && !isFFmpegInstalled;
```

## Example: Cleanup Check with Comment

```typescript
// From packages/epicenter/src/indexes/markdown/markdown-index.ts

/**
 * This is checking if there's an old filename AND if it's different
 * from the new one. It's essentially checking: "has the filename
 * changed?" and "do we need to clean up the old file?"
 */
const needsOldFileCleanup = oldFilename && oldFilename !== filename;
if (needsOldFileCleanup) {
  const oldFilePath = path.join(tableConfig.directory, oldFilename);
  await deleteMarkdownFile({ filePath: oldFilePath });
  tracking[table.name]!.deleteByFilename({ filename: oldFilename });
}
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.