introduce-special-case

introduce-special-case is a skill for Claude Code from msbaek/msbaek-claude-plugins. It costs 103 tokens per session (1,710 once invoked), scanned A, original, MIT.

A code-refactoring method that replaces repeated null checks with a Special Case class, also called a Null Object, so the code can use a normal interface instead of branching for missing values.

In plain words
What is it for?
Use it when several parts of the code repeatedly test for null before performing related work.
Why use it?
It reduces repeated checks and keeps handling for the missing case in one place.

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 several parts of the code repeatedly test for null before performing related work.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/msbaek/msbaek-claude-plugins/introduce-special-case
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 introduce-special-case
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 introduce-special-case

README.md
[![agentmods](https://agentmods.dev/badge/skills/msbaek/msbaek-claude-plugins/introduce-special-case/github.svg)](https://agentmods.dev/skills/msbaek/msbaek-claude-plugins/introduce-special-case)
Your own site
<a href="https://agentmods.dev/skills/msbaek/msbaek-claude-plugins/introduce-special-case"><img src="https://agentmods.dev/badge/skills/msbaek/msbaek-claude-plugins/introduce-special-case/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 introduce-special-case

Your own site · 80×15
<a href="https://agentmods.dev/skills/msbaek/msbaek-claude-plugins/introduce-special-case"><img src="https://agentmods.dev/badge/skills/msbaek/msbaek-claude-plugins/introduce-special-case.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 103 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,710 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.00103 $0.01710
Opus 5.5 $0.00041 $0.00684
Sonnet 5.5 $0.00021 $0.00342
Haiku 4.5 $0.00010 $0.00171

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

Security

Grade A, and why

introduce-special-case 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/introduce-special-case/SKILL.md · 199 lines

How it starts

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

Introduce Special Case (Null Object)

GOAL

  • 성공 = 반복 null 검사가 Special Case 클래스로 대체되어 커밋 완료됨
  • 동일 타입에 대한 null 검사가 3곳 이상 반복됨
  • null일 때의 기본 동작이 Special Case 클래스에 캡슐화됨
  • 호출처의 null 검사가 제거됨
  • 모든 테스트 통과

CONSTRAINTS

  • 계열: System-wide — 후보 제시 후 승인 받고 적용 (../../references/refactoring-procedure.md §0·§3-B)

Hard Rules

  • 동작 변경 금지 — 구조 개선만 수행
  • 테스트 수정 금지 — 구조 변경이 테스트를 실패시키면 되돌리기
  • 사용자 확인 없이 리팩토링 금지 — 모든 후보는 사용자 승인 후 실행
  • 커밋 단위 — 단계별 커밋 (Special Case 생성 → 소스 수정 → 호출처 정리)
  • git add -A 금지 — 변경된 파일만 명시적으로 추가

적용 패턴

Before: null 검사가 여러 곳에 산재

public String getCustomerName(Site site) {
    Customer customer = site.getCustomer();
    if (customer == null) {
        return "occupant";
    }
    return customer.getName();
}

public BillingPlan getBillingPlan(Site site) {
    Customer customer = site.getCustomer();
    if (customer == null) {
        return BillingPlan.basic();
    }
    return customer.getBillingPlan();
}

public int getWeeksDelinquent(Site site) {
    Customer customer = site.getCustomer();
    if (customer == null) {
        return 0;
    }
    return customer.getPaymentHistory().getWeeksDelinquent();
}

After: Special Case 객체 도입

// Step 1: Special Case 클래스 생성
public class UnknownCustomer extends Customer {
    @Override
    public String getName() { return "occupant"; }

    @Override
    public BillingPlan getBillingPlan() { return BillingPlan.basic(); }

    @Override
    public PaymentHistory getPaymentHistory() {
        return PaymentHistory.empty();
    }

    @Override
    public boolean isUnknown() { return true; }
}

// Step 2: 소스에서 null 대신 Special Case 반환
public class Site {
    public Customer getCustomer() {
        return (customer == null) ? new UnknownCustomer() : customer;
    }
}

// Step 3: 호출처 — null 검사 제거
public String getCustomerName(Site site) {
    return site.getCustomer().getName();
}

public BillingPlan getBillingPlan(Site site) {
    return site.getCustomer().getBillingPlan();
}

public int getWeeksDelinquent(Site site) {
    return site.getCustomer().getPaymentHistory().getWeeksDelinquent();
}

Read the full file on GitHub · 199 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 · +67 tokens per session 4534ec8df493
  2. 2mo ago Changed 924c28300f3e
  3. 3mo ago First seen · 198 lines · 36 tokens per session scan A ba42bd9a37ba

Subscribe to this mod's changes

introduce-special-case is a skill published in the GitHub repository msbaek/msbaek-claude-plugins (8 stars, last pushed 1mo ago), licensed MIT. It adds 103 tokens to every session and 1,710 once invoked, about $0.0004 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

introduce-special-case compared with skills from other repositories

introduce-special-case next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
introduce-special-casemsbaek/msbaek-claude-pluginsSkill81mo agoMITA103Claude 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