ced3-han/harness-settings/test-driven-development
Claude Code and agent skill by ced3-han/harness-settings
- community
Checking that the SKILL.md file is still in the repository.
Use before important behavior changes, especially ML model architecture, data loading, preprocessing, losses, samplers, checkpointing, training loops, evaluation metrics, or shared infrastructure. Prefer targeted research tests and smoke checks over blanket coverage targets.
Install
npx vskill@latest install ced3-han/harness-settings/test-driven-developmentSKILL.md
The same SKILL.md was published earlier as ced3-han/harness-settings/test-driven-development.
Research Test-Driven Development
Use TDD as a precision tool for ML/research code: define the contract, guard the failure mode, make the smallest change, then run the test or smoke check that would catch the bug again.
When To Use
Use this skill before important behavior changes, especially:
- Model architecture, tensor shapes, attention masks, positional encodings, and
tokenization.
- Data loading, preprocessing, collation, batching, sampling, and sequence
alignment.
- Losses, metrics, benchmark aggregation, evaluation scripts, and leaderboard
formatting.
- Checkpoints, config parsing, training loops, optimizer/scheduler setup, mixed
precision, distributed training, and resume logic.
- Shared utilities or infrastructure used by more than one experiment.
Tiny docs, formatting, comment-only edits, one-line config changes, and throwaway exploration do not need full TDD ceremony. If exploratory code becomes part of an experiment result or reusable path, add guards before relying on it.
Core Loop
- Define the expected contract first.
State input shape, dtype, device, seed assumptions, config fields, expected output shape/value range, side effects, and failure behavior.
- Write a minimal failing or guarding test when feasible.
Prefer a small unit or regression test that fails on the current bug. For existing code, do not delete working code just to satisfy ceremony; add a contract/regression test around the behavior before changing it.
- Implement the smallest change.
Touch only the files needed for the requested behavior. Avoid broad refactors, speculative abstractions, and unrelated style cleanup.
- Run targeted tests and realistic smoke checks.
The test should exercise real code and data structures when practical. Use mocks only for slow external services or unavailable hardware, and preserve the side effects the behavior depends on.
- Self-review the ML failure modes.
Check shape/dtype/device, sequence alignment, masks, leakage, gradients, checkpoint compatibility, stale configs, and metric aggregation drift.
Test Shapes
Good research tests are small but semantically meaningful:
Smoke Checks
For research code, a focused smoke check can be enough when exhaustive tests would slow iteration without reducing risk. Cover the relevant subset:
- Data loading: one batch, correct shape, dtype, device, and deterministic order
when required.
- Forward pass: no shape/broadcast errors; outputs have expected keys and ranges.
- Loss: finite, not NaN/Inf, and reasonable initial magnitude.
- Backward: one optimizer step runs and at least one expected parameter changes.
- Checkpoint: save then load; critical weights/config fields match.
- Determinism: same seed -> same sampled indices/output when determinism matters.
Document smoke command, expected signal, and actual result in the task progress file when planning-with-files is active.
Silent ML Bugs To Target
- Off-by-one frame/action/token alignment.
- Mask direction flipped or broadcast along the wrong dimension.
- Padding included in loss or metrics.
- CPU-only tensor accidentally mixed into CUDA path.
- Float64/float16/bfloat16 mismatch changing memory or numerics.
- Train/val leakage through dataset splits, cached preprocessing, or samplers.
- Metrics averaged per batch instead of per example/token.
- Checkpoint loads weights but silently drops config, tokenizer, EMA, optimizer,
scheduler, scaler, or RNG state.
- Distributed code works on one rank but not with multiple ranks or uneven data.
Practical Exceptions
- If no test harness exists, write the smallest executable repro or smoke script.
- If GPU is unavailable, test CPU shape/contract behavior and state the missing
GPU verification.
- If a bug only appears in a long run, create a reduced fixed-seed repro first;
then run the shortest realistic job that can expose it.
- If the user explicitly asks for a quick prototype, keep tests light, but do not
present unguarded exploratory code as validated.
Completion Checklist
- Contract or expected behavior is stated.
- New or changed behavior has a targeted test, regression test, or justified
smoke check.
- The verification command was run and its result is recorded.
- Remaining untested risk is named explicitly.
- No unrelated refactors or generated artifacts were included.
When adding mocks, fixtures, or test utilities, read testing-anti-patterns.md.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/test-driven-development/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/ced3-han/harness-settings/test-driven-development)