tdd-rust
From rtk-ai
TDD workflow for RTK filter development. Red-Green-Refactor with Rust idioms. Real fixtures, token savings assertions, snapshot tests with insta. Auto-triggers on new filter implementation.
Facts
- Repository
- rtk-ai/rtk
- Status
- Actively maintained
- Last commit
- Declared tools
- Source file
- .claude/skills/tdd-rust/SKILL.md
Source preview
The instructions Claude Code reads when this skill runs.
# RTK TDD Workflow
Enforce Red-Green-Refactor for all RTK filter development.
## The Loop
```
1. RED — Write failing test with real fixture
2. GREEN — Implement minimum code to pass
3. REFACTOR — Clean up, verify still passing
4. SAVINGS — Verify ≥60% token reduction
5. SNAPSHOT — Lock output format with insta
```
## Step 1: Real Fixture First
Never write synthetic test data. Capture real command output:
```bash
# Capture real output from the actual command
git log -20 > tests/fixtures/git_log_raw.txt
cargo test 2>&1 > tests/fixtures/cargo_test_raw.txt
cargo clippy 2>&1 > tests/fixtures/cargo_clippy_raw.txt
gh pr view 42 > tests/fixtures/gh_pr_view_raw.txt
# For commands with ANSI codes — capture as-is
script -q /dev/null cargo test 2>&1 > tests/fixtures/cargo_test_ansi_raw.txt
```
Fixture naming: `tests/fixtures/<command>_raw.txt`
## Step 2: Write the Test (Red)
```rust
#[cfg(test)]
mod tests {
use super::*;
use insta::assert_snapshot;
fn count_tokens(s: &str) -> usize {
s.split_whitespace().count()
}
// Test 1: Output format (snapshot)
#[test]
fn test_filter_output_format() {
let input = include_str!("../tests/fixtures/mycmd_raw.txt");
let output = filter_mycmd(input).expect("filter should not fail");
assert_snapshot!(output);
}
// Test 2: Token savings ≥60%
#[test]
fn test_token_savingView full source on GitHub →Other skills
django-tdd
★ 229,918Django testing strategies with pytest-django, TDD methodology, factory_boy, mocking, coverage, and testing Django REST Framework APIs.
affaan-mupdated 15d agoMITclickhouse-io
★ 229,918ClickHouse database patterns, query optimization, analytics, and data engineering best practices for high-performance analytical workloads.
affaan-mupdated 15d agoMITlaravel-patterns
★ 229,918Patrones de arquitectura Laravel, routing/controladores, Eloquent ORM, capas de servicio, colas, eventos, caché y API resources para aplicaciones en producción.
affaan-mupdated 15d agoMITverification-loop
★ 229,918Sistema de verificación completo para sesiones de Claude Code.
affaan-mupdated 15d agoMITstrategic-compact
★ 229,918Suggests manual context compaction at logical intervals to preserve context through task phases rather than arbitrary auto-compaction.
affaan-mupdated 15d agoMITfrontend-patterns
★ 229,918Patrones de desarrollo frontend para React, Next.js, gestión de estado, optimización de rendimiento y buenas prácticas de UI.
affaan-mupdated 15d agoMIT