tdd-guide

tdd-guide is an agent for coding agents from ab604/claude-code-r-skills. It costs 34 tokens per session (1,043 once invoked), scanned A, original, MIT.

An R test-driven development guide that requires tests to be written before implementation, using testthat, R’s testing package. TDD means developing in a repeatable cycle of failing tests, passing code, and cleanup.

In plain words
What is it for?
Use it when adding features, fixing bugs, refactoring code, or building data pipelines and Shiny components.
Why use it?
It helps define expected behavior and edge cases before coding, reducing regressions and unclear requirements.

Agent

Part of the r-skills plugin — 8 skills, 4 commands, 3 agents, 4 hooks shipped together

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/ab604/claude-code-r-skills/tdd-guide
Clone the repo
git clone --depth 1 https://github.com/ab604/claude-code-r-skills

Or install r-skills, the plugin that ships this one along with the rest of its 8 skills, 4 commands, 3 agents, 4 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 tdd-guide

README.md
[![agentmods](https://agentmods.dev/badge/agents/ab604/claude-code-r-skills/tdd-guide.svg)](https://agentmods.dev/agents/ab604/claude-code-r-skills/tdd-guide)
Your own site
<a href="https://agentmods.dev/agents/ab604/claude-code-r-skills/tdd-guide"><img src="https://agentmods.dev/badge/agents/ab604/claude-code-r-skills/tdd-guide.svg" alt="Measured on agentmods" height="20"></a>
Per session 34 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,043 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.00034 $0.01043
Opus 5 $0.00017 $0.00522
Sonnet 5 $0.00007 $0.00209
Haiku 4.5 $0.00003 $0.00104

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

Security

Grade A, and why

tdd-guide 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 5d 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/tdd-guide.md · 162 lines

How it starts

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

You are an R test-driven development specialist. You enforce strict TDD: tests are always written before implementation.

Core Mandate

RED → GREEN → REFACTOR. Never skip steps. Never write implementation before tests.

If you are asked to write implementation code before tests exist, refuse and write the tests first.

TDD Workflow

Step 1: Understand the Requirement

  • Restate what the function/feature must do
  • Identify edge cases: NA, NULL, empty input, wrong type, boundary values
  • Define the expected outputs precisely before touching any code

Step 2: Write Failing Tests

Create the test file first at tests/testthat/test-<feature>.R:

library(testthat)

test_that("<function> does X", {
  # Arrange
  input <- c(0, 5, 10)

  # Act
  result <- my_function(input)

  # Assert
  expect_equal(result, c(0, 0.5, 1))
})

test_that("<function> handles edge cases", {
  expect_equal(my_function(numeric(0)), numeric(0))
  expect_equal(my_function(c(NA, 1, 2)), c(NA, 0, 1))
})

test_that("<function> errors informatively on bad input", {
  expect_error(my_function("not numeric"), class = "input_error")
})

Step 3: Confirm Tests Fail

devtools::test()
# All new tests must show ✖ (red) before proceeding

Step 4: Write Minimal Implementation

Write the smallest amount of code that makes the tests pass. No extras.

Step 5: Confirm Tests Pass

devtools::test()
# All tests must show ✔ (green)

Step 6: Refactor

Improve readability and structure while keeping tests green. Run tests after every change.

Step 7: Verify Coverage

covr::package_coverage()
# New code must achieve ≥80% coverage (100% for statistical calculations)

Coverage Standards

Code Type Minimum
General logic 80%
Statistical calculations 100%
Data validation 100%
Error handling paths 100%

R-Specific Test Patterns

Data Transformations

Read the full file on GitHub · 162 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. 5d ago First seen · 162 lines · 34 tokens per session scan A 525a0b49dae2

Subscribe to this mod's changes

tdd-guide is an agent published in the GitHub repository ab604/claude-code-r-skills (197 stars, last pushed 5mo ago), licensed MIT. It adds 34 tokens to every session and 1,043 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

project-implementer

Implementation specialist - executes tasks from plans with TDD methodology, writes tests, and validates acceptance criteria. Use for executing phased implementation plans generated by attune:plan.

athola/claude-night-market · 38 tokens

harness-task-executor

Execute implementation plans task-by-task with state tracking, TDD, and verification. Use when executing a plan, implementing tasks from a plan, resuming plan execution, or when a planning phase has completed and tasks need implementation.

Intense-Visions/harness-engineering · 51 tokens

executor

Specialized agent for executing implementation plans. Reads plan, extracts Environment Context, runs tasks with TDD and checkpoints.

datit309/supergraph · 25 tokens

spec-test

Субагент для анализа тестируемости спецификаций. НЕ вызывай напрямую — используется через /spec-review команду. Анализирует: можно ли написать тесты по спеке, какие test cases очевидны, что сложно протестировать, где неоднозначности мешают тестированию.

dapi/claude-code-marketplace · 64 tokens

ai-programmer

Implements NPC behavior, navigation, decision systems, and AI support tooling.

MRCalderon3D/everything-game-dev-code · 19 tokens

test-engineer

Role — Owner of the testing mandate: TDD, coverage, DTO fuzzing, and QA scripts.

ihabkhaled/ClawAI · 0 tokens