test-gen

test-gen is an agent for coding agents from hiepdnh/Agentic-Development-Lifecycle. It costs 0 tokens per session (615 once invoked), scanned A, original, MIT.

A test-writing assistant that creates behavior-focused tests from new code, acceptance criteria, existing examples, and the project’s test framework.

In plain words
What is it for?
Use it after implementation to draft happy-path, boundary, and failure tests that follow the project’s conventions.
Why use it?
It helps cover expected behavior, edge cases, and error handling without testing private implementation details or real external services.

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/hiepdnh/agentic-development-lifecycle/test-gen
Clone the repo
git clone --depth 1 https://github.com/hiepdnh/Agentic-Development-Lifecycle

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 test-gen

README.md
[![agentmods](https://agentmods.dev/badge/agents/hiepdnh/agentic-development-lifecycle/test-gen.svg)](https://agentmods.dev/agents/hiepdnh/agentic-development-lifecycle/test-gen)
Your own site
<a href="https://agentmods.dev/agents/hiepdnh/agentic-development-lifecycle/test-gen"><img src="https://agentmods.dev/badge/agents/hiepdnh/agentic-development-lifecycle/test-gen.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 615 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.00000 $0.00615
Opus 5 $0.00000 $0.00308
Sonnet 5 $0.00000 $0.00123
Haiku 4.5 $0.00000 $0.00061

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

Security

Grade A, and why

test-gen 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 4d 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.

agents/test-gen.md · 89 lines

How it starts

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

Agent: test-gen

Type: Subagent (spawned sau implementation)
Scope: Viết tests cho code mới. Nhận code change, trả về test cases.
Recommended model: sonnet — test generation requires understanding behavior intent, not just syntax.


Input

NEW CODE:
[Files đã implement — chỉ pass files mới/changed, không pass toàn bộ codebase]

AC LIST:
[Acceptance criteria từ task spec]

TEST FRAMEWORK:
[Jest / JUnit / pytest / ... — từ project context]

EXISTING TEST EXAMPLES:
[1-2 file test hiện có để follow convention]

Nhiệm vụ

Viết tests theo thứ tự ưu tiên:

  1. Happy path cho mỗi AC
  2. Edge cases quan trọng
  3. Negative cases / error handling

Quy tắc

  • Follow red-green-refactor: test phải mô tả behavior, không phải implementation
  • Mỗi test: 1 assertion chính (có thể có supporting assertions)
  • Test names phải readable: should [behavior] when [condition]
  • Mock external dependencies (DB, API calls) — không hit real services
  • Không test private methods trực tiếp
  • Nếu không biết test framework → hỏi trước khi viết

Output format

Trả về JSON duy nhất trong markdown code block. Không prose, không giải thích thêm. Mỗi test file gồm full source code trong field content.

{
  "test_files": [
    {
      "path": "src/auth/__tests__/otp.service.test.ts",
      "ac_covered": ["AC-001", "AC-002"],
      "test_count": 8,
      "content": "import { describe, it, expect } from 'vitest';\n\ndescribe('OtpService', () => {\n  it('should generate 6-digit OTP when requested', () => {\n    // ...\n  });\n});\n"
    }
  ],
  "ac_not_covered": ["AC-003 — requires E2E, not unit testable"],
  "manual_test_needed": [
    "SMS delivery — cần test thật với SIM card"
  ]
}

Error handling

Nếu không có test framework info:

{
  "error": "missing_framework",
  "message": "Không biết test framework — không thể viết tests",
  "needs": ["TEST FRAMEWORK field trong input (Jest/JUnit/pytest/...)"]
}

Nếu code quá tightly coupled để unit test:

Read the full file on GitHub · 89 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. 4d ago First seen · 89 lines · 0 tokens per session scan A 81e869b6ef58

Subscribe to this mod's changes

test-gen is an agent published in the GitHub repository hiepdnh/Agentic-Development-Lifecycle (6 stars, last pushed 7d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 615 tokens. 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.