.forge/skills/tdd-workflow/SKILL.md
# TDD Workflow Apply Test-Driven Development when implementing new functionality. Use your judgment to determine when TDD is appropriate — it's most valuable for business logic, algorithms, and complex state management. ## When to Use TDD - New functions with defined inputs/outputs - Bug fixes (write failing test first, then fix) - Refactoring existing code (ensure tests exist first) - API endpoints and data transformations ## When TDD May Not Apply - Configuration files, constants, types/i
npx skillsauth add jdsingh122918/forge .forge/skills/tdd-workflowInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Apply Test-Driven Development when implementing new functionality. Use your judgment to determine when TDD is appropriate — it's most valuable for business logic, algorithms, and complex state management.
// 1. RED - Write the test first (this won't compile yet)
#[test]
fn test_parse_phase_number_valid_input() {
assert_eq!(parse_phase_number("03"), Ok(3));
}
#[test]
fn test_parse_phase_number_invalid_input() {
assert!(parse_phase_number("abc").is_err());
}
// 2. GREEN - Minimal implementation to pass
fn parse_phase_number(s: &str) -> Result<u32> {
s.parse().context("invalid phase number")
}
// 3. REFACTOR - Clean up if needed (in this case, it's already clean)
test_<function>_<scenario> (e.g., test_load_config_missing_file)cargo test after each change to verify state<promise>DONE</promise> with failing testsdevelopment
# Testing Strategy Apply this testing strategy for all new code: ## Test Levels 1. **Unit Tests** - Test individual functions in isolation - Located in `mod tests` at the bottom of each file - Mock external dependencies - Fast, deterministic, no I/O 2. **Integration Tests** - Test modules working together - Located in `tests/` directory - Use real dependencies where practical - May involve filesystem, database, or network 3. **End-to-End Tests** - Test complete user workflo
tools
# Secure Coding Follow these secure coding practices for all code in this project. ## Input Validation - Validate all external input (user input, API responses, file contents) - Use allowlists over denylists when validating - Sanitize data before use in SQL, shell commands, or HTML output - Validate early, at system boundaries (CLI args, file reads, network responses) ## Rust-Specific Security - Minimize `unsafe` blocks; document safety invariants when used - Use established crypto librarie
tools
# Rust Conventions Follow these Rust conventions for all code in this project: ## Code Style - Use `rustfmt` defaults for formatting - Run `cargo clippy` and address all warnings before committing - Prefer `?` operator for error propagation over `.unwrap()` in library code - Use `.expect("meaningful message")` only when failure indicates a bug ## Error Handling - Use `anyhow::Result` for application code and CLI - Use `thiserror` for library errors that callers need to match on - Provide cont
development
# DRY Principles Eliminate duplication to improve maintainability. Every piece of knowledge should have a single, authoritative representation in the codebase. ## Before Writing Code - Search for existing functions/utilities that solve the problem - Check if similar patterns exist elsewhere that should be unified - Consider if this logic belongs in a shared module ## Duplication Red Flags - Copy-pasting code blocks (extract to function) - Similar functions with minor variations (parameteriz