consolidate-conditional

consolidate-conditional is a skill for Claude Code from msbaek/msbaek-claude-plugins. It costs 144 tokens per session (1,544 once invoked), scanned A, original, MIT.

A conditional-consolidation refactoring aid combines several conditionals that produce the same result and extracts them into a meaningful method.

In plain words
What is it for?
Use it when multiple if statements or other conditions lead to the same outcome and should be expressed as one named rule.
Why use it?
Repeated conditions make business rules harder to read and maintain. Combining them gives the shared rule one clear definition.

Skill for Claude Code

Written for Claude Code: argument-hint in frontmatter.

Part of the msbaek-tdd plugin — 28 skills, 10 agents, 2 hooks shipped together

Good fit Use it when multiple if statements or other conditions lead to the same outcome and should be expressed as one named rule.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/msbaek/msbaek-claude-plugins/consolidate-conditional
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add msbaek/msbaek-claude-plugins --skill consolidate-conditional
Clone the repo
git clone --depth 1 https://github.com/msbaek/msbaek-claude-plugins

Made for: Claude Code.

Or install msbaek-tdd, the plugin that ships this one along with the rest of its 28 skills, 10 agents, 2 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for consolidate-conditional

README.md
[![agentmods](https://agentmods.dev/badge/skills/msbaek/msbaek-claude-plugins/consolidate-conditional/github.svg)](https://agentmods.dev/skills/msbaek/msbaek-claude-plugins/consolidate-conditional)
Your own site
<a href="https://agentmods.dev/skills/msbaek/msbaek-claude-plugins/consolidate-conditional"><img src="https://agentmods.dev/badge/skills/msbaek/msbaek-claude-plugins/consolidate-conditional/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for consolidate-conditional

Your own site · 80×15
<a href="https://agentmods.dev/skills/msbaek/msbaek-claude-plugins/consolidate-conditional"><img src="https://agentmods.dev/badge/skills/msbaek/msbaek-claude-plugins/consolidate-conditional.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 144 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,544 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00144 $0.01544
Opus 5.5 $0.00058 $0.00618
Sonnet 5.5 $0.00029 $0.00309
Haiku 4.5 $0.00014 $0.00154

Measured 2mo ago against content hash c163ae59df35, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

consolidate-conditional scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

msbaek-tdd/skills/consolidate-conditional/SKILL.md · 164 lines

How it starts

The opening of the file, as written. The whole thing — 164 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Consolidate Conditional Expression

GOAL

동일한 결과를 내는 여러 조건문을 하나로 통합하여:

  • 흩어진 조건들의 관계를 명확히 표현
  • 통합된 조건을 의미 있는 메서드로 추출
  • 코드 의도 파악 용이

decompose-conditional과 상호 보완:

  • Consolidate: 흩어진 조건을 통합하는 방향 (여러 if → 하나의 if)
  • Decompose: 복잡한 조건을 분해하는 방향 (하나의 복잡한 if → 여러 메서드)
  • 실전: Consolidate → Decompose 순서로 적용하는 경우가 많음

CONSTRAINTS

  • 계열: Tidy — 후보 보고 후 승인 없이 적용 (../../references/refactoring-procedure.md §0·§3-A)
  • 동작 변경 금지: 구조 개선만 수행 (기능 변경 없음)
  • 테스트 수정 금지: 구조 변경이 테스트를 실패시키면 되돌리기
  • 명시적 git add: git add -A 금지, 변경된 파일만 명시
  • Extract Method 포함: 단일 클래스 내 완결 시에만 적용

적용 패턴

Before: OR 패턴 — 동일 결과를 내는 조건들이 분산

if (employee.getSeniority() < 2) return 0;
if (employee.getMonthsDisabled() > 12) return 0;
if (employee.isPartTime()) return 0;

After: 조건 통합 + 메서드 추출

if (isNotEligibleForDisability(employee)) return 0;

private boolean isNotEligibleForDisability(Employee employee) {
    return employee.getSeniority() < 2
        || employee.getMonthsDisabled() > 12
        || employee.isPartTime();
}

추가 예시: AND 패턴 — 중첩 조건 통합

// Before
if (employee.onVacation()) {
    if (employee.getSeniority() > 10) {
        return 1;
    }
}

// After
if (employee.onVacation() && employee.getSeniority() > 10) {
    return 1;
}

추가 예시: 삼항 연산자 통합

// Before
if (isSpecialDeal()) {
    total = price * 0.95;
} else {
    total = price * 0.98;
}
if (isLoyalCustomer()) {
    total = price * 0.95;
}

// After (동일 결과를 내는 조건 통합)
if (isSpecialDeal() || isLoyalCustomer()) {
    total = price * 0.95;
} else {
    total = price * 0.98;
}

적용 기준

적용 대상

  • 2개 이상의 조건문이 동일한 결과(return/throw/assign)를 냄
  • 조건들이 논리적으로 OR 또는 AND로 결합 가능
  • 각 조건이 독립적 (부수효과 없음)
  • 통합 후 의미 있는 이름을 부여할 수 있음

적용 제외

  • 다른 결과: 조건들이 서로 다른 결과를 냄
  • 부수효과 사이: 조건 사이에 부수효과 코드가 있음
  • 의도적 분리: 각 조건이 서로 다른 비즈니스 규칙을 표현 (분리가 의도적)
  • 단일 조건: 통합할 조건이 1개뿐

OUTPUT FORMAT

실행 절차

공통 골격(대상 파일 수집 → 후보 제시(계열별 승인 규칙) → 적용 → 테스트 → 커밋/되돌리기, 브랜치·PR이 필요한 조건)은 이 스킬 디렉터리 기준 ../../references/refactoring-procedure.md가 정본이다. 아래는 이 기법에 고유한 부분만 규정한다.

Read the full file on GitHub · 164 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2mo ago Changed · -1 lines · +104 tokens per session c163ae59df35
  2. 2mo ago Changed 900a9c71bf4d
  3. 3mo ago First seen · 165 lines · 40 tokens per session scan A 8f606e30a83b

Subscribe to this mod's changes

consolidate-conditional is a skill published in the GitHub repository msbaek/msbaek-claude-plugins (8 stars, last pushed 1mo ago), licensed MIT. It adds 144 tokens to every session and 1,544 once invoked, about $0.0006 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

consolidate-conditional compared with skills from other repositories

consolidate-conditional next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
consolidate-conditionalmsbaek/msbaek-claude-pluginsSkill81mo agoMITA144Claude Code
local-ai-agentsmicrosoft/ai-agents-for-beginnersSkill82ktodayMITA200Claude Code, Codex
imagegenopenai/codexSkill137ktodayApache-2.0A113Codex
playwright-climicrosoft/playwrightSkill102ktodayApache-2.0A19Claude Code
browser-automationopenclaw/openclawSkill396ktodayMITA36Claude Code
free-llm-apismnfst/awesome-free-llm-apisSkill15ktodayCC0-1.0A113Claude Code, Codex
systematic-debuggingobra/superpowersSkill333k7d agoMITA21Claude Code