rtk: Skill for Claude Code

.claude/skills/rtk-tdd/SKILL.md

rtk-tdd is a skill for Claude Code from rtk-ai/rtk. It costs 61 tokens per session (783 once invoked), scanned A, original, Apache-2.0.

Instructions for applying TDD, or test-driven development, to Rust code through a repeated failing-test, implementation, and cleanup cycle.

In plain words
What is it for?
They are for implementing, testing, refactoring, and fixing Rust code using the Red-Green-Refactor process, formatting, linting, and full test runs.
Why use it?
They require behavior to be demonstrated by tests before production code is written and provide Rust-specific testing patterns and final checks.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

This is rtk-ai/rtk's own configuration. It tells Claude Code how to work on rtk 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 rtk configures →

About the project

rtk is a command-line proxy that filters and compresses output from development commands before it reaches an LLM's context. It is used with coding agents to reduce the tokens consumed by commands such as Git operations. The catalogue includes skills, commands, agents, and instructions for using rtk in agent workflows.

rtk-ai/rtk · 84,655 stars · on GitHub · rtk-ai.app

Reuse

Borrowing it

Nothing to install: this file belongs to rtk-ai/rtk. 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/rtk-ai/rtk/develop/.claude/skills/rtk-tdd/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/rtk-ai/rtk

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 rtk-tdd

README.md
[![agentmods](https://agentmods.dev/badge/skills/rtk-ai/rtk/rtk-tdd/github.svg)](https://agentmods.dev/skills/rtk-ai/rtk/rtk-tdd)
Your own site
<a href="https://agentmods.dev/skills/rtk-ai/rtk/rtk-tdd"><img src="https://agentmods.dev/badge/skills/rtk-ai/rtk/rtk-tdd/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 rtk-tdd

Your own site · 80×15
<a href="https://agentmods.dev/skills/rtk-ai/rtk/rtk-tdd"><img src="https://agentmods.dev/badge/skills/rtk-ai/rtk/rtk-tdd.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 61 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 783 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. Third-party audits
  • Socket pass 26 Sept 2026
  • Snyk pass 26 Sept 2026
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 1 finding, up to high

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • high Privilege Escalation · line 57
    Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
    Fix: Remove references to credential paths. Use environment variables or secrets managers. For docs, use placeholder paths (e.g., /path/to/config). Never load .env or token files in production code paths.
How audits are shown
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.00061 $0.00783
Opus 5.5 $0.00024 $0.00313
Sonnet 5.5 $0.00012 $0.00157
Haiku 4.5 $0.00006 $0.00078

Measured 1mo ago against content hash 82b156358322, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

rtk-tdd 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 1mo 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/skills/rtk-tdd/SKILL.md · 86 lines

How it starts

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

Rust TDD Workflow

Three Laws of TDD

  1. Do NOT write production code without a failing test
  2. Write only enough test to fail (including compilation failure)
  3. Write only enough production code to pass the failing test

Cycle: RED (test fails) -> GREEN (minimum to pass) -> REFACTOR (cleanup, cargo test)

Red-Green-Refactor Steps

1. Write test in #[cfg(test)] mod tests of the SAME file
2. cargo test MODULE::tests::test_name  -- must FAIL (red)
3. Implement the minimum in the function
4. cargo test MODULE::tests::test_name  -- must PASS (green)
5. Refactor if needed, re-run cargo test (still green)
6. cargo fmt && cargo clippy --all-targets && cargo test  (final gate)

Never skip step 2. If the test passes immediately, it tests nothing.

Idiomatic Rust Test Patterns

Pattern Usage When
Arrange-Act-Assert Base structure for every test Always
assert_eq! / assert! Direct comparison / booleans Deterministic values
assert!(result.is_err()) Error path testing Invalid inputs
Result<()> return type Tests with ? operator Fallible functions
#[should_panic] Expected panic Invariants, preconditions
tempfile::NamedTempFile File/I/O tests Filesystem-dependent code

Patterns by Code Type

Code Type Test Pattern Example
Pure function (str -> str) Input literal -> assert output assert_eq!(truncate("hello", 3), "...")
Parsing/filtering Raw string -> filter -> contains/not-contains assert!(filter(raw).contains("expected"))
Validation/security Boundary inputs -> assert bool assert!(!is_valid("../etc/passwd"))
Error handling Bad input -> is_err() assert!(parse("garbage").is_err())
Struct/enum roundtrip Construct -> serialize -> deserialize -> eq assert_eq!(from_str(to_str(x)), x)

Naming Convention

test_{function}_{scenario}
test_{function}_{input_type}

Read the full file on GitHub · 86 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 1mo ago First seen · 86 lines · 61 tokens per session scan A 82b156358322

Subscribe to this mod's changes

rtk-tdd is a skill published in the GitHub repository rtk-ai/rtk (84,655 stars, last pushed yesterday), licensed Apache-2.0. It adds 61 tokens to every session and 783 once invoked, about $0.0002 per session on Opus 5.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.