一键导入
tdd
Test-Driven Development methodology for embedded Rust - Red-Green-Refactor cycle with host testing focus
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Test-Driven Development methodology for embedded Rust - Red-Green-Refactor cycle with host testing focus
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Standard progress report format, location conventions, and handoff documentation for all agents
ESP32-C6 hardware specifics - register addresses, peripherals, and RISC-V considerations
Hardware test automation patterns for ESP32-C6, similar to Tock's existing test infrastructure
Global issue tracker management - creating issues, severity levels, and tech debt tracking
Complete reference for configuring OpenCode (agents, tools, permissions, models)
Tock kernel patterns, HIL traits, and embedded Rust conventions for chip implementation
| name | tdd |
| description | Test-Driven Development methodology for embedded Rust - Red-Green-Refactor cycle with host testing focus |
| license | MIT |
| compatibility | opencode |
| metadata | {"category":"methodology","for_agent":"implementor","focus":"quality, testability"} |
+-------------------------------------------+
| 1. RED: Write a failing test |
| - Test must compile |
| - Test must fail initially |
| - Test should run on HOST |
+-------------------------------------------+
| 2. GREEN: Make the test pass |
| - Write minimal code |
| - Don't optimize yet |
| - Focus on correctness |
+-------------------------------------------+
| 3. REFACTOR: Improve the code |
| - Clean up while tests pass |
| - Run clippy and fmt |
| - Improve naming and structure |
+-------------------------------------------+
Tock kernel code is #![no_std], but tests should run on host where possible:
// In lib.rs or module
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_parse_register_value() {
let value = parse_register(0x12345678);
assert_eq!(value.field1, 0x12);
assert_eq!(value.field2, 0x34);
}
}
One cycle = one edit/compile/test iteration
| Cycles | Status | Action |
|---|---|---|
| < 15 | Normal | Continue |
| 15-20 | Warning | Document struggle |
| 20-25 | Concern | Consider asking for help |
| > 25 | Critical | Pause, escalate |
Run after every GREEN phase:
cargo fmt
cargo clippy --all-targets -- -D warnings
cargo test
src/
lib.rs
module/
mod.rs
submodule.rs
#[cfg(test)]
tests.rs # Unit tests for module
tests/
integration/ # Integration tests (if applicable)
## Cycle 1 (RED)
- Wrote test_gpio_config_default()
- Test fails: GpioConfig not implemented
- Status: RED
## Cycle 2 (GREEN)
- Implemented GpioConfig struct with Default
- cargo test: PASS
- Status: GREEN
## Cycle 3 (REFACTOR)
- Added documentation
- cargo clippy: PASS
- cargo fmt: PASS
- Status: REFACTOR complete
Total cycles: 3 (target <15)