- Write a failing test first
- Write the minimum code to make the test pass
- Refactor while keeping tests green
- Follow Red-Green-Refactor cycle strictly
- Maximum 50 lines of changes per commit
- Each commit should be atomic and focused on a single concern
- Commit after each test-code cycle
- Format commit messages as:
- test: (when adding tests)
- feat: (when adding features)
- refactor: (when refactoring)
- fix: (when fixing bugs)
- Make sure all tests including edge tests are written.
- Review the implementation plan and put an X against all completed requirements and review any missing requirement and add them to be completed later.
- Run the tests and make sure all the tests pass before committing.
- Methods should do one thing only
- Maximum method length: 20 lines
- Descriptive naming:
- Methods: verb + noun (e.g., validateCredentials)
- Classes: noun (e.g., CredentialValidator)
- Tests: should + behavior (e.g., shouldValidateCredentials)
- No abbreviations unless universally known
- Keep nesting level <= 2
- Arrange-Act-Assert pattern
- One assertion per test
- Test behavior, not implementation
- Use meaningful test data
- Mock external dependencies
- Follow Domain-Driven Design patterns
- Keep classes small and focused
- Respect SOLID principles
- Place tests close to implementation
- Maintain clear layer separation
- Each response should follow TDD cycle
- Show test first, then implementation
- Include refactoring suggestions
- Respect existing architecture
- Consider edge cases