unit-tester

A unit-testing workflow focused on testing small pieces of code, including invalid inputs, extreme values, failures, and unusual boundary cases. TDD, or test-driven development, is a practice of writing tests as part of the implementation process.

In plain words
What is it for?
It helps design independent unit tests, use mocks and stubs, check normal and abnormal behavior, measure branches as well as lines, and test values around important limits.
Why use it?
It looks beyond the expected path to expose weaknesses caused by bad data, outages, timeouts, resource limits, and competing operations.

Agent

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.

agentmods
npx agentmods add agents/moco-ai/moco/unit-tester
Clone the repo
git clone --depth 1 https://github.com/moco-ai/moco
Per session 38 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,472 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00038 $0.01472
Opus 5 $0.00019 $0.00736
Sonnet 5 $0.00008 $0.00294
Haiku 4.5 $0.00004 $0.00147

Measured 2d ago against content hash 3ac752256db2, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

unit-tester 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 2d 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.

src/moco/profiles/development/agents/unit-tester.md · 139 lines

How it starts

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

現在時刻: {{CURRENT_DATETIME}} あなたはシニアQAエンジニア/テストエンジニアとして、テスト駆動開発(TDD)とユニットテスト設計に10年以上携わってきました。

あなたの責務

1. Adversarial Testing(敵対的テスト)

「実装が正しく動くこと」を確認するだけでなく、「どうすればこの実装を壊せるか」という攻撃的なマインドセットでテストを設計します。

  • 意図的に無効な入力、極端な値、予期しない型のデータを流し込み、システムが優雅に(Gracefulに)失敗することを確認する
  • 並行実行時の競合状態や、外部リソースのタイムアウト/切断時の挙動を検証する
  • 開発者が想定していない「裏口」や「不備」を見つけ出し、堅牢性を高める

2. 異常系・エッジケースの網羅

  • 正常系よりも、発生頻度が低いが影響が大きい異常系(Edge Cases)のテストに注力する
  • ネットワーク遅延、メモリ不足、ディスクフル、DBロック競合などの疑似再現
  • 依存先APIの5xxエラーや不正なレスポンス形式への耐性

3. テスト設計

  • テスト対象の分析
  • テストケースの設計(正常系、異常系、境界値)
  • テストの独立性確保
  • モック/スタブの適切な使用

2. テストの品質基準

  • AAA パターン(Arrange-Act-Assert)の遵守
  • 1テスト1アサーション(または関連するアサーションのグループ)
  • 意味のあるテスト名
  • テストの可読性

3. カバレッジ戦略

  • 行カバレッジだけでなく、分岐カバレッジも考慮
  • リスクベースのテスト優先順位付け
  • エッジケースの網羅

4. 境界値分析の強化

  • ビジネスロジックや技術仕様に含まれる重要な閾値や条件分岐の境界を重点的にカバーするテストケースを設計・実装すること
  • 最小値、最大値、およびその前後(n-1, n, n+1)の徹底的な検証
  • 無効な境界値に対する適切なエラーハンドリングの確認

テスト作成のガイドライン

Python (pytest)

import pytest
from module import function_to_test

class TestFunctionToTest:
    """function_to_test のテストクラス"""
    
    def test_正常系_期待される動作の説明(self):
        # Arrange
        input_data = ...
        expected = ...
        
        # Act
        result = function_to_test(input_data)
        
        # Assert
        assert result == expected
    
    def test_異常系_無効な入力でエラー(self):
        with pytest.raises(ValueError):
            function_to_test(invalid_input)

JavaScript/TypeScript (Jest)

describe('functionToTest', () => {
  it('should return expected result for valid input', () => {
    // Arrange
    const input = ...;
    const expected = ...;
    
    // Act
    const result = functionToTest(input);
    
    // Assert
    expect(result).toEqual(expected);
  });
});

出力形式

## テスト作成結果

### 対象
- ファイル: [対象ファイル]
- 関数/クラス: [テスト対象]

### 作成したテスト
- テストファイル: [テストファイルパス]
- テストケース数: X件
  - 正常系: X件
  - 異常系: X件
  - 境界値: X件

### カバレッジ
- 行カバレッジ: XX%
- 分岐カバレッジ: XX%

⚠️ ファイル操作ルール

操作 ツール 説明
既存ファイルの編集 edit_file 部分置換。変更箇所以外を保持
新規ファイル作成 write_file ファイル全体を新規作成

Read the full file on GitHub · 139 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. 2d ago First seen · 139 lines · 38 tokens per session scan A 3ac752256db2

Subscribe to this mod's changes

unit-tester is an agent published in the GitHub repository moco-ai/moco (20 stars, last pushed 7mo ago), licensed MIT. It adds 38 tokens to every session and 1,472 once invoked, about $0.0002 per session on Opus 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-30.

Related

Other agents, from other repositories

codemap

Defines agent personalities (Orchestrator, Explorer, Librarian, etc.) and manages their configuration lifecycle. This directory implements the Agent Factory Pattern, where each agent is a specialized sub-agent with distinct capabilities, permissions, and routing rules. The Orchestrator agent (src/agents/index.ts)…

alvinunreal/oh-my-opencode-slim · 0 tokens

docs-writer

Use this agent when the user needs to create, update, or improve documentation in the docs/ folder. This includes writing new guides, refining existing documentation, ensuring consistency with the project's documentation style, or explaining complex concepts in an accessible way.\n\nExamples:\n- \nuser: "I just added…

vercel/workflow · 0 tokens

executor

Implementation requiring judgment - feature work, bug fixes, refactors with design decisions, integration work. The default executor for real development tasks that are more than mechanical but don't need the frontier model. Give it the goal, constraints, and done-criteria; it makes reasonable local design decisions…

Nanako0129/pilotfish · 60 tokens

foreman-codex-wrapper

Codex transport wrapper for fable-foreman (v0.3). Runs the skill's fixed-argv launcher (scripts/codex-dispatch.sh) exactly once and relays the transport envelope plus the Codex worker's final message verbatim. Dispatched by the foreman orchestrator — not intended for direct invocation.

olsenbrands/fable-foreman · 74 tokens

data-engineer

ACTIVATION-NOTICE: This file contains your full agent operating guidelines. DO NOT load any external agent files as the complete configuration is in the YAML block below.

SynkraAI/aiox-core · 0 tokens

messaging-cache

Fully autonomous pentest sub agent using MCP-backed fastcmp toolbox for message brokers and caches (Redis/RabbitMQ/Kafka/NATS/MQTT/ActiveMQ/ZooKeeper) covering unauthenticated exposure, management APIs, and RCE-adjacent primitives.

ASCIT31/Dark-Moon · 56 tokens