test-driven-development
Test Driven Development
Core Principle
Tests are code, not an add-on. Every feature, bug fix, or refactoring should include tests that verify the behavior. Writing tests is part of implementing functionality, not a separate activity done after.
When to Use This Skill
- Planning new features or functionality
- Implementing any code change
- Fixing bugs
- Refactoring existing code
Trigger Conditions
This skill should be active when:
- Adding new functionality to the codebase
- Modifying existing behavior
- Fixing a bug
- Changing or improving existing code
How to Apply TDD in Agent Workflow
Feature Implementation
- Understand the feature - Read requirements or specifications
- Plan test cases - Identify all behaviors to verify
- Write tests first - Create tests that describe desired behavior
- Watch tests fail - Verify tests fail because behavior does not exist
- Write minimal code - Implement only what tests require
- Refactor - Clean up while keeping tests green
Bug Fixing
- Write a test that reproduces the bug
- Verify the test fails
- Fix the bug
- Verify the test passes
Refactoring
- Ensure tests exist for code being refactored
- Run tests to establish baseline
- Refactor in small steps
- Run tests after each step
- All tests must pass before considering refactoring complete
Key Principles
Tests Before Code
Write tests before writing production code. This drives cleaner design and ensures testability from the start.
Tests as Documentation
Test names and structure should clearly describe the expected behavior. Tests serve as executable documentation.
Minimal Test Scope
Each test should verify one behavior. This makes tests easier to understand, maintain, and debug when they fail.
References
For detailed guidance, see:
- TDD Principles - Three laws, Red-Green-Refactor cycle, test structure
- Test Planning - How to plan tests during feature development
- Anti-Patterns - Common mistakes to avoid
More from cylixlee/skills
skill-creator
Creates new Agent Skills following the Agent Skills specification. Use when the user asks to create a new skill, add a skill, define a skill, or build a skill for a specific capability.
34design-pattern
Applies object-oriented design principles and design patterns to generate maintainable, extensible code. Use when generating code that requires proper architectural layering, SOLID principles, and appropriate design patterns to solve recurring software design problems.
22eino-adk
Eino Agent Development Kit development skill. For building AI Agent applications including ChatModelAgent, workflows (Sequential/Parallel/Loop), multi-agent systems (Supervisor/PlanExecute), human-in-the-loop (interruption/approval). Use when users need to create Agents, use Runner for execution, manage tool calls, build multi-agent systems.
12vuetify-4
Build Vue 3 applications with Vuetify 4 component library. Use when creating new Vuetify 4 projects, adding UI components, layouts, forms, or theming. Assumes environment is already configured with Vuetify 4.
2eino-practices
Provides guidance on using the CloudWeGo Eino framework for building Go AI applications, including LLM calls, prompt templates, tool definitions, Graph/Workflow orchestration, and Agent development. Use this skill when users mention eino, LLM calls, ChatModel, tool calling, workflow orchestration, Agent development, RAG, or related keywords.
1