TDDAI Quick Reference Guide
π Quick Startβ
Install TDDAI in Your Projectβ
# For TypeScript/JavaScript projects
npm install --save-dev @bluefly/tddai
# For Python projects
pip install tddai
# For PHP/Drupal projects
composer require bluefly/tddai
Initialize TDDAIβ
# Interactive setup
npx tddai init
# Quick setup with defaults
npx tddai init --defaults
# Setup Claude integration
npx tddai setup claude
π Essential Commandsβ
Testing Commandsβ
# Run tests
npx tddai test
# Run specific test file
npx tddai test src/utils/helpers.test.ts
# Run with coverage
npx tddai coverage
# Watch mode
npx tddai test --watch
Validation & Complianceβ
# Check TDD compliance
npx tddai validate
# Strict validation (fails on warnings)
npx tddai validate --strict
# Check specific files
npx tddai validate src/
AI-Powered Featuresβ
# Generate missing tests
npx tddai generate-tests
# Analyze project quality
npx tddai improve analyze --detailed
# Auto-fix common issues
npx tddai improve fix --all
# AI chat assistance
npx llmcli ai chat "How do I test this async function?"
π§ Configurationβ
Basic tddai.config.ymlβ
project:
name: my-project
type: typescript
testing:
framework: jest
coverageThreshold: 95
ai:
enabled: true
provider: ollama
Claude Settings (.claude/settings.json)β
{
"hooks": {
"UserPromptSubmit": {
"command": "/path/to/.claude/hooks/tdd-context-injector.js"
},
"PreToolUse": {
"command": "/path/to/.claude/hooks/tdd-compliance-guardian.js"
}
}
}
π― TDD Workflowβ
1οΈβ£ RED Phaseβ
# Create test file
touch src/calculator.test.ts
# Write failing test
echo "test('adds numbers', () => {
expect(add(2, 3)).toBe(5);
});" > src/calculator.test.ts
# Verify it fails
npx tddai test src/calculator.test.ts
2οΈβ£ GREEN Phaseβ
# Create implementation
touch src/calculator.ts
# Write minimal code
echo "export const add = (a, b) => a + b;" > src/calculator.ts
# Verify test passes
npx tddai test src/calculator.test.ts
3οΈβ£ REFACTOR Phaseβ
# Improve code (with types)
echo "export const add = (a: number, b: number): number => {
return a + b;
};" > src/calculator.ts
# Ensure tests still pass
npx tddai test
π Coverage Thresholdsβ
Project Type | Minimum | Recommended | Excellent |
---|---|---|---|
TypeScript | 85% | 90% | 95%+ |
Python | 80% | 85% | 90%+ |
PHP/Drupal | 75% | 80% | 85%+ |
Docker | 70% | 75% | 80%+ |
π οΈ Common Tasksβ
Generate Tests for Existing Codeβ
# Single file
npx llmcli test-gen src/utils/parser.ts
# Multiple files
npx llmcli test-gen batch "src/**/*.ts"
# Analyze coverage gaps
npx llmcli test-gen analyze ./
Fix Common Issuesβ
# Auto-fix linting issues
npx tddai fix lint
# Update dependencies
npx tddai fix deps
# Fix test imports
npx tddai fix imports
Project Analysisβ
# Full analysis
npx tddai improve analyze --all --detailed
# Quick health check
npx tddai status
# Coverage report
npx tddai coverage --report
β‘ Keyboard Shortcuts (Claude Code)β
Action | Shortcut | Description |
---|---|---|
Run Tests | Cmd+Shift+T | Run all tests |
Coverage | Cmd+Shift+C | Show coverage |
Generate | Cmd+Shift+G | Generate tests |
Validate | Cmd+Shift+V | Check compliance |
π¨ Troubleshootingβ
Hook Not Workingβ
# Check installation
ls -la .claude/hooks/
# Test manually
node .claude/hooks/tdd-context-injector.js
# Fix permissions
chmod +x .claude/hooks/*.js
Coverage Too Lowβ
# Find uncovered code
npx tddai coverage --show-uncovered
# Generate tests for gaps
npx tddai generate-tests --uncovered-only
# Focus on critical paths
npx tddai coverage --critical
ES Module Issuesβ
# For "type": "module" projects
mv .claude/hooks/*.js .claude/hooks/*.cjs
# Update settings
sed -i '' 's/\.js/.cjs/g' .claude/settings.json
π Resourcesβ
Documentationβ
Examplesβ
Supportβ
- Issues:
gitlab.com/bluefly/tddai/issues
- Discussions:
gitlab.com/bluefly/tddai/discussions
- Chat:
#tddai
on Slack
π‘ Pro Tipsβ
- Start Small: Write one test at a time
- Test Behavior: Not implementation details
- Keep It Simple: Minimal code to pass tests
- Refactor Often: Clean code with green tests
- Use AI: Let TDDAI generate boilerplate
π― Quick Winsβ
# Monday: Setup TDDAI
npx tddai init --defaults
# Tuesday: Generate missing tests
npx tddai generate-tests
# Wednesday: Fix issues
npx tddai improve fix --all
# Thursday: Increase coverage
npx tddai coverage --improve
# Friday: Celebrate 95%+ coverage! π
npx tddai status --celebrate
Remember: Red β Green β Refactor β Repeat! π