Agent skill

Mocking Strategy

by revfactory in revfactory/harness-100

테스트 더블(Mock, Stub, Spy, Fake) 선택과 효과적인 모킹 전략 가이드. An agent skill from revfactory/harness-100.

Apache-2.0Auto-check passedTesting & QA

Install Mocking Strategy

skills CLI
$ npx skills add revfactory/harness-100 --skill mocking-strategy -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install revfactory/harness-100 mocking-strategy --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/revfactory/harness-100.git skills-src && mkdir -p .claude/skills && cp -r skills-src/ko/24-test-automation/.claude/skills/mocking-strategy .claude/skills/mocking-strategy && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
mocking-strategy
GitHub stars
1.3k
Token cost
~1k tokens
SKILL.md length
183 words
Files
1
Skills in repo
464
Repo updated
First seen
Licence
Apache-2.0

At a glance

테스트 더블(Mock, Stub, Spy, Fake) 선택과 효과적인 모킹 전략 가이드. An agent skill from revfactory/harness-100.

  • Testing & QA work in your project
  • SKILL.md covers 테스트 더블 유형 비교, 선택 의사결정 트리, 계층별 모킹 전략 and 모킹 안티패턴과 해결, plus 3 more sections
  • Reaches api.pg.com

What it does

Mocking Strategy is an agent skill from revfactory/harness-100. 테스트 더블(Mock, Stub, Spy, Fake) 선택과 효과적인 모킹 전략 가이드. '모킹', 'Mock', 'Stub', 'Spy', 'Fake', '테스트 더블', '의존성 격리', '외부 서비스 모킹', 'DB 모킹' 등 테스트 격리 전략 수립 시 이 스킬을 사용한다. unit-tester와 integration-tester의 모킹 설계 역량을 강화한다. 단, 테스트 전략 전체 수립이나 CI 연동은 이 스킬의 범위가 아니다.

Its SKILL.md is about 1k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Testing & QA. The licence is Apache-2.0.

When your agent uses it

  • Testing & QA work in your project

Example prompts

  • “/mocking-strategy”

Requirements

  • Python 3

What it can do on your machine

Read from SKILL.md and the folder at commit 8e8d35c. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are python, typescript and java).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • api.pg.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Mocking Strategy loads about 1k tokens when it runs. Until then it costs about 66 tokens; SKILL.md has 183 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~66
When it runs · the whole SKILL.md, loaded when a task matches
~1k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from revfactory/harness-100 at commit 8e8d35c, republished under its Apache-2.0 licence (© revfactory). 183 words, ~1,044 tokens.

Download SKILL.mdSave it as .claude/skills/mocking-strategy/SKILL.md (or your agent's skills folder).
name
mocking-strategy
description
테스트 더블(Mock, Stub, Spy, Fake) 선택과 효과적인 모킹 전략 가이드. '모킹', 'Mock', 'Stub', 'Spy', 'Fake', '테스트 더블', '의존성 격리', '외부 서비스 모킹', 'DB 모킹' 등 테스트 격리 전략 수립 시 이 스킬을 사용한다. unit-tester와 integration-tester의 모킹 설계 역량을 강화한다. 단, 테스트 전략 전체 수립이나 CI 연동은 이 스킬의 범위가 아니다.

Mocking Strategy — 테스트 더블 선택 및 모킹 전략 가이드

의존성을 효과적으로 격리하여 안정적인 테스트를 만드는 방법론.

테스트 더블 유형 비교

유형목적동작검증 대상
Dummy파라미터 채움아무것도 안 함사용되지 않음
Stub고정 응답 제공미리 정의된 값 반환상태(결과값)
Spy호출 기록실제 동작 + 기록상호작용(호출 횟수/인자)
Mock기대 동작 정의기대에 맞으면 통과상호작용(호출 순서/인자)
Fake경량 구현동작하는 간소화 구현상태(통합 수준)

선택 의사결정 트리

외부 의존성을 격리해야 한다
├── 응답값만 필요 → Stub
├── 호출 여부/횟수 확인 필요 → Mock 또는 Spy
│   ├── 실제 동작도 필요 → Spy
│   └── 실제 동작 불필요 → Mock
├── 동작하는 경량 구현 필요 → Fake
│   └── 예: InMemoryRepository, FakeEmailSender
└── 그냥 타입만 맞추면 됨 → Dummy

계층별 모킹 전략

Repository/DB 계층
python
# Stub: 고정 데이터 반환
stub_repo = Mock(spec=UserRepository)
stub_repo.find_by_id.return_value = User(id=1, name="테스트")

# Fake: 인메모리 구현
class FakeUserRepository(UserRepository):
    def __init__(self):
        self._store = {}
    def save(self, user):
        self._store[user.id] = user
    def find_by_id(self, id):
        return self._store.get(id)
외부 API 계층
python
# HTTP 모킹 (responses / httpx_mock)
@responses.activate
def test_payment_api():
    responses.add(
        responses.POST, "https://api.pg.com/charge",
        json={"status": "success", "tx_id": "TX123"},
        status=200
    )
    result = payment_service.charge(10000)
    assert result.tx_id == "TX123"

# 타임아웃 / 에러 시뮬레이션
responses.add(
    responses.POST, "https://api.pg.com/charge",
    body=ConnectionError("timeout")
)
메시지 큐 계층
python
class FakeMessageBroker(MessageBroker):
    def __init__(self):
        self.published = []
    def publish(self, topic, message):
        self.published.append((topic, message))
    def assert_published(self, topic, expected_count=1):
        actual = [m for t, m in self.published if t == topic]
        assert len(actual) == expected_count
시간/날짜 계층
python
# 시간 의존성 주입
class OrderService:
    def __init__(self, clock=datetime.now):
        self.clock = clock

# 테스트에서 고정 시간
fixed_time = lambda: datetime(2024, 1, 1, 12, 0, 0)
service = OrderService(clock=fixed_time)

모킹 안티패턴과 해결

안티패턴문제해결
과도한 모킹구현 상세에 테스트가 결합동작 기반 테스트로 전환
모킹 사슬mock.a.b.c.d() 깊은 모킹디미터 법칙 위반 — 코드 리팩토링
모킹 지옥모든 것을 MockFake로 대체, 통합 테스트 추가
반복 설정모든 테스트에서 같은 Mock 설정Fixture/Builder 패턴 도입
Mock 검증 과다verify(mock, times(1)).method() 남용필수 상호작용만 검증

프레임워크별 모킹 도구

Python
python
# unittest.mock
from unittest.mock import Mock, patch, MagicMock
# pytest-mock
def test_something(mocker):
    mocker.patch('module.Class.method', return_value=42)
# responses (HTTP)
# freezegun (시간)
JavaScript/TypeScript
typescript
// Jest
jest.mock('./userService');
jest.spyOn(service, 'findUser').mockResolvedValue(mockUser);
// MSW (HTTP — 서비스 워커)
server.use(rest.get('/api/users', (req, res, ctx) => res(ctx.json([]))));
// Sinon (범용)
sinon.stub(db, 'query').resolves([]);
Java/Kotlin
java
// Mockito
@Mock UserRepository repo;
when(repo.findById(1L)).thenReturn(Optional.of(user));
verify(repo, times(1)).save(any(User.class));
// WireMock (HTTP)
// Testcontainers (실제 DB/Redis)

Testcontainers 활용 (Fake 대안)

python
# 실제 DB를 도커로 격리 — Fake보다 현실적
@pytest.fixture
def postgres():
    with PostgresContainer("postgres:16") as pg:
        engine = create_engine(pg.get_connection_url())
        yield engine

def test_user_crud(postgres):
    # 실제 PostgreSQL에서 테스트
    repo = UserRepository(postgres)
    repo.save(User(name="test"))
    assert repo.find_by_name("test") is not None

모킹 수준 결정 매트릭스

테스트 유형DB외부 API메시지 큐파일 시스템
단위 테스트Stub/MockStubMockStub
통합 테스트Fake/ContainerWireMockFaketmpdir
E2E 테스트실제 DBSandbox API실제 큐실제 FS

© revfactory, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in ko/24-test-automation/.claude/skills/mocking-strategy of revfactory/harness-100.

Open the folder on GitHubat commit 8e8d35c

Compare with similar skills

Mocking Strategy next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Mocking Strategy compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Mocking Strategy this skillrevfactory/harness-1001.3k—~1kAutomated safety check: PassApache-2.0
Web Application Testinganthropics/skills180k51 repos~966Automated safety check: PassApache-2.0
Diagnosing Bugsfossasia/eventyay-interpretation1.6k31 repos~2.1kAutomated safety check: PassApache-2.0
TDDfossasia/eventyay-interpretation1.6k28 repos~1.1kAutomated safety check: PassApache-2.0
TDD WorkflowhellangleZ/burn-in-cceverywhere-ralph11211 repos~2.4kAutomated safety check: PassNone
TDDsanity-io/sanity6.4k20 repos~1kAutomated safety check: PassMIT

Similar skills

  • Web Application Testing

    anthropics/skills

    Official

    Tests local web applications with Python Playwright scripts, checking frontend behavior, capturing screenshots and reading browser console logs.

    180k GitHub starsUsed in 51 repos~966 tokens
    Testing & QAAuto-check passed
  • Diagnosing Bugs

    fossasia/eventyay-interpretation

    Diagnosis loop for hard bugs and performance regressions. An agent skill from fossasia/eventyay-interpretation.

    1.6k GitHub starsUsed in 31 repos~2.1k tokens
    Testing & QAAuto-check passed
  • TDD

    fossasia/eventyay-interpretation

    Test-driven development. An agent skill from fossasia/eventyay-interpretation.

    1.6k GitHub starsUsed in 28 repos~1.1k tokens
    Testing & QAAuto-check passed
  • TDD Workflow

    hellangleZ/burn-in-cceverywhere-ralph

    A skill your agent uses when writing new features, fixing bugs, or refactoring code.

    112 GitHub starsUsed in 11 repos~2.4k tokens
    Testing & QAAuto-check passed
  • TDD

    sanity-io/sanity

    Official

    Test-driven development with red-green-refactor loop. An agent skill from sanity-io/sanity.

    6.4k GitHub starsUsed in 20 repos~1k tokens
    Testing & QAAuto-check passed
  • Context Driven Development

    Ibrahim-3d/orchestrator-supaconductor

    A skill your agent uses when working with Conductor's context-driven development methodology, managing project context artifacts, or understanding the relationship between product.md, tech-stack.md…

    380 GitHub starsUsed in 8 repos~2.9k tokens
    Testing & QAAuto-check passed

More from revfactory/harness-100

All 464 skills in this repo
  • Anti Bot Analyzer

    revfactory/harness-100

    A skill for analyzing website anti-bot defense mechanisms and developing legitimate evasion strategies.

    1.3k GitHub stars~1.1k tokensUpdated 6 mo ago
    Auto-check passed
  • API Error Design Patterns

    revfactory/harness-100

    Reference for designing how an API reports failures: structured error codes, response shapes, client-friendly messages, an error catalog and retry or fallback advice.

    1.3k GitHub stars~1.6k tokensUpdated 6 mo ago
    Auto-check passed
  • API Security Checklist

    revfactory/harness-100

    Walks a backend-dev agent through OWASP API Top 10 checks, authentication and authorization patterns, and defense code during API design.

    1.3k GitHub stars~1.7k tokensUpdated 6 mo ago
    Auto-check passed
  • Arg Parser Generator

    revfactory/harness-100

    Methodology for systematically designing and generating CLI tool argument parser structures.

    1.3k GitHub stars~1.2k tokensUpdated 6 mo ago
    Auto-check passed
  • Audience Segmentation

    revfactory/harness-100

    Audience segmentation skill used by the analyst and curator agents.

    1.3k GitHub stars~1.3k tokensUpdated 6 mo ago
    Auto-check passed
  • Audio Storytelling

    revfactory/harness-100

    Audio storytelling skill used by the podcast scriptwriter and show note editor.

    1.3k GitHub stars~1.6k tokensUpdated 6 mo ago
    Auto-check passed

Categories

Questions about Mocking Strategy

What does Mocking Strategy do?

테스트 더블(Mock, Stub, Spy, Fake) 선택과 효과적인 모킹 전략 가이드. An agent skill from revfactory/harness-100. Mocking Strategy is an agent skill from revfactory/harness-100. 테스트 더블(Mock, Stub, Spy, Fake) 선택과 효과적인 모킹 전략 가이드.

When should I use Mocking Strategy?

Mocking Strategy fits situations like: testing & QA work in your project.

How do I install Mocking Strategy in Claude Code?

Run `npx skills add revfactory/harness-100 --skill mocking-strategy -a claude-code`. Or copy the skill folder (ko/24-test-automation/.claude/skills/mocking-strategy in revfactory/harness-100) into .claude/skills/mocking-strategy in your project. Claude Code loads it when a task matches its description.

How do I install Mocking Strategy in Codex?

Run `npx skills add revfactory/harness-100 --skill mocking-strategy -a codex`. Or copy the skill folder (ko/24-test-automation/.claude/skills/mocking-strategy in revfactory/harness-100) into .agents/skills/mocking-strategy in your project. Codex loads it when a task matches its description.

Can I use Mocking Strategy in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add revfactory/harness-100 --skill mocking-strategy -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/mocking-strategy, .gemini/skills/mocking-strategy, .github/skills/mocking-strategy and .opencode/skills/mocking-strategy in your project.

What does Mocking Strategy need to run?

SKILL.md names no scripts, command-line tools or credentials: Mocking Strategy is instructions for the agent only. Our summary lists: Python 3.

Does Mocking Strategy access the network?

SKILL.md names 1 domain. In commands or code: api.pg.com; the agent is likely to contact it when it follows the instructions. This is read from the text; nothing was executed.

Is Mocking Strategy safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Mocking Strategy use?

Mocking Strategy is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Mocking Strategy use?

About 1k tokens (SKILL.md is roughly 4.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Mocking Strategy?

Skills that share tags, products or a category with Mocking Strategy: Web Application Testing (anthropics/skills, 180k stars), Diagnosing Bugs (fossasia/eventyay-interpretation, 1.6k stars), TDD (fossasia/eventyay-interpretation, 1.6k stars) and TDD Workflow (hellangleZ/burn-in-cceverywhere-ralph, 112 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Mocking Strategy?

revfactory (a GitHub user) maintains it in revfactory/harness-100, which has 1,290 GitHub stars. The repository holds 464 skills in this directory. The repository was last updated on March 22, 2026.

Source: revfactory/harness-100 on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.