introduce-assertion

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

A code-refactoring method that turns assumptions in the code into explicit assertions or validation checks, so a violated assumption is found immediately.

In plain words
What is it for?
Use it to check required inputs, states, or conditions at the point where the code relies on them.
Why use it?
It prevents incorrect assumptions from remaining hidden until they cause a later, harder-to-trace failure.

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 to check required inputs, states, or conditions at the point where the code relies on them.

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

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/msbaek/msbaek-claude-plugins/introduce-assertion"><img src="https://agentmods.dev/badge/skills/msbaek/msbaek-claude-plugins/introduce-assertion.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 102 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,762 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.00102 $0.01762
Opus 5.5 $0.00041 $0.00705
Sonnet 5.5 $0.00020 $0.00352
Haiku 4.5 $0.00010 $0.00176

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

Security

Grade A, and why

introduce-assertion 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-assertion/SKILL.md · 179 lines

How it starts

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

Introduce Assertion

GOAL

코드가 암묵적으로 가정하는 조건을 assertion으로 명시하여:

  • 가정 위반 시 즉시 발견 (원인과 증상의 거리 단축)
  • 주석보다 강력한 실행 가능한 문서
  • 계약 기반 프로그래밍의 경량 버전

CONSTRAINTS

  • 계열: Tidy — 후보 보고 후 승인 없이 적용 (../../references/refactoring-procedure.md §0·§3-A)
  • 동작 변경 금지: assertion 추가만 수행 (기존 로직 변경 없음)
  • 테스트 수정 금지: assertion 추가가 테스트를 실패시키면 되돌리기
  • 명시적 git add: git add -A 금지, 변경된 파일만 명시

Assertion 도구 선택 (프로젝트 의존성 자동 감지)

프로젝트의 빌드 파일(build.gradle 또는 pom.xml)을 확인하여 자동 선택:

  1. Spring 의존성 있음 → org.springframework.util.Assert
  2. Apache Commons 있음 → org.apache.commons.lang3.Validate
  3. 둘 다 없음 → java.util.Objects.requireNonNull + IllegalArgumentException

Java assert 키워드는 -ea 플래그가 필요하여 프로덕션에서 비활성화될 수 있으므로 사용하지 않음

적용 패턴

Before: 암묵적 가정 (Spring Assert)

public double calculateDiscount(double price, double rate) {
    // price는 양수, rate는 0~1 사이여야 함 (주석 또는 아무것도 없음)
    return price * rate;
}

After: assertion으로 가정 명시

import org.springframework.util.Assert;

public double calculateDiscount(double price, double rate) {
    Assert.isTrue(price > 0, "price must be positive: " + price);
    Assert.isTrue(rate >= 0 && rate <= 1, "rate must be between 0 and 1: " + rate);
    return price * rate;
}

추가 예시: Apache Commons Validate

import org.apache.commons.lang3.Validate;

public String formatName(Customer customer) {
    Validate.notNull(customer, "customer must not be null");
    Validate.notBlank(customer.getFirstName(), "firstName must not be blank");
    return customer.getFirstName() + " " + customer.getLastName();
}

추가 예시: 사후 조건 (결과 검증)

public int allocateSlots(int requested, int available) {
    int allocated = Math.min(requested, available);
    Assert.isTrue(allocated >= 0, "allocated slots must not be negative: " + allocated);
    Assert.isTrue(allocated <= available, "allocated exceeds available: " + allocated + " > " + available);
    return allocated;
}

적용 기준

적용 대상

  • 메서드가 특정 조건을 가정하지만 명시하지 않은 경우
  • 내부 메서드(private/package-private)의 전제 조건
  • 계산 결과의 사후 조건 (결과값 범위 검증)
  • 알고리즘의 불변식 (invariant)
  • null이 아닌 것을 암묵적으로 가정하는 경우

Read the full file on GitHub · 179 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 · +65 tokens per session 3b57836d3d3a
  2. 2mo ago Changed ca4ef85fa048
  3. 3mo ago First seen · 180 lines · 37 tokens per session scan A 01664b7d8ff3

Subscribe to this mod's changes

introduce-assertion is a skill published in the GitHub repository msbaek/msbaek-claude-plugins (8 stars, last pushed 1mo ago), licensed MIT. It adds 102 tokens to every session and 1,762 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-assertion compared with skills from other repositories

introduce-assertion next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
introduce-assertionmsbaek/msbaek-claude-pluginsSkill81mo agoMITA102Claude 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