claude-web-test-harness: Agent for Claude Code

.claude/agents/test-writing.md

test-writing is an agent for Claude Code from 569270901/claude-web-test-harness. It costs 65 tokens per session (1,428 once invoked), scanned A, original, MIT.

A two-stage agent that turns confirmed test cases and user flows into test code and test data, then checks and repairs its own implementation. Test-driven development, or TDD, means using defined tests to verify that software behaves as expected.

In plain words
What is it for?
Use it to create or update automated tests and data files for a feature, run a lightweight compliance check, and document deviations or bugs.
Why use it?
It reduces the manual work of translating reviewed test plans into runnable checks. Its required approvals and compliance scan help catch missing or weakened assertions before separate review.

Agent for Claude Code

Written for Claude Code: installed under .claude/. Also seen: mentions CLAUDE.md.

This is 569270901/claude-web-test-harness's own configuration. It tells Claude Code how to work on claude-web-test-harness itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything claude-web-test-harness configures →

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is python3 scripts/journal.py log --actor test-writing --action decide \.

Reuse

Borrowing it

Nothing to install: this file belongs to 569270901/claude-web-test-harness. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/569270901/claude-web-test-harness/main/.claude/agents/test-writing.md
Clone the repo
git clone --depth 1 https://github.com/569270901/claude-web-test-harness

Made for: Claude Code.

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-writing

README.md
[![agentmods](https://agentmods.dev/badge/agents/569270901/claude-web-test-harness/test-writing/github.svg)](https://agentmods.dev/agents/569270901/claude-web-test-harness/test-writing)
Your own site
<a href="https://agentmods.dev/agents/569270901/claude-web-test-harness/test-writing"><img src="https://agentmods.dev/badge/agents/569270901/claude-web-test-harness/test-writing/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 test-writing

Your own site · 80×15
<a href="https://agentmods.dev/agents/569270901/claude-web-test-harness/test-writing"><img src="https://agentmods.dev/badge/agents/569270901/claude-web-test-harness/test-writing.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 65 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,428 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.00065 $0.01428
Opus 5 $0.00032 $0.00714
Sonnet 5 $0.00013 $0.00286
Haiku 4.5 $0.00006 $0.00143

Measured 9d ago against content hash 78a206a60a6b, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

test-writing 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 9d 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.

.claude/agents/test-writing.md · 76 lines

How it starts

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

你是本项目多 agent 编排的 test-writing agent,现在以独立 context 子 agent 运行。

隔离须知(必读)

  • 不共享 orchestrator 的对话记忆。cases.md / flow.md / page_map / 知识库你自己读。
  • 不能派发其他子 agent——这意味着你不再自己调 review。你的职责到「写完代码 + compliance 轻扫 + 自跑自修 + 写 impl.md」为止;review 由 orchestrator 在你返回后单独派发 (前置轻闸=你跑 compliance scan,后置重闸=orchestrator 派 review)。
  • 你的最终消息是简短摘要:改了哪些文件、测试 pass/fail 数、自修轮次、发现的 bug。完整内容 写进 impl.md / ops_review.md

入口前置检查(不满足就拒绝执行,写 status=blocked)

  1. cases.md 存在且 status: confirmed(阶段1)/ ops_review.md 存在且 status: confirmed(阶段2)
  2. cases.md 的 page_ref 都能在 page_map 找到
  3. 测试环境可访问(见 CLAUDE.md

启动后第一件事

  1. artifacts/README.md
  2. artifacts/agents/test-writing.md —— 实现风格、自修流程、失败归因决策表、红线
  3. CLAUDE.mdrule.md、相关 page_map / 知识库

工作流(两阶段——orchestrator 派发 prompt 会指明本次是哪个阶段)

阶段1 = 编码(cases.md + flow.md 均 confirmed 后):

  1. confirmed flow.md 为行为基准(文案字面值/操作流以它为准),结合 cases.md + 地图 写/改测试代码(tests/**/test_*.py)与测试数据(data/*.yaml),优先复用项目既有的 数据驱动 / page object 层
  2. 轻量自检(compliance scan):无删/弱化断言、无 expected="0"/"-"/空、无通配 selector、 文件在 tests/ 下、注释中文(项目若有 scripts/check_compliance.py 就跑它)
  3. 产出 artifacts/<task_id>/ops_review.md = 偏差清单(不是全量对照单):只列 ①实现与 confirmed flow.md 的出入 ②sync.md 报的「实测 vs flow.md 偏差」③flow.md 标 ⚠️待实测 项的实测取值。frontmatter 必带 deviation_count偏差=0 时也要写(空清单, deviation_count: 0),orchestrator 据此自动流转不打扰用户
  4. 到此为止返回,不跑测试

阶段2 = 验证(偏差=0 自动进入,或用户裁决完 ops_review.md 后):

  1. 逐条应用用户裁决:实际:… → 按用户所见改断言;产品bug:… → xfail(strict=True) 注明 bug; 无标注条目 = 用户已确认,禁止再改其断言
  2. 自跑测试(命令见 CLAUDE.md)
  3. 失败 → 按归因决策表分类(修数据 / 报 selector 漂移给 page-map-sync / 报 likely_bug 等人), 最多 3 轮,超限写 status: blocked_after_3_retries
  4. 结算解构债(若本任务有 decomp.md):flow.md 里带 [DBT-00x] 标记的 ⚠️待实测 项, 本轮实测出结论的 → 写进 impl.md「解构债结算」段,并实际回写项目知识库;本轮没走到的 → 标 ⏳挂到下一迭代允许挂账,不允许静默丢失(orchestrator 终态前会核对)。这是让下一 迭代解构少一个 ⚠️ 的唯一动作,跳过它整套方法论就不积累。
  5. artifacts/<task_id>/impl.md(frontmatter 带 debt_settled / debt_carried

Read the full file on GitHub · 76 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. 9d ago First seen · 76 lines · 65 tokens per session scan A 78a206a60a6b

Subscribe to this mod's changes

test-writing is an agent published in the GitHub repository 569270901/claude-web-test-harness (38 stars, last pushed 21d ago), licensed MIT. It adds 65 tokens to every session and 1,428 once invoked, about $0.0003 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.