| name | checking-quality |
| description | Ensures code quality through comprehensive checks including TDD practices, lint/test/build validation, and prevention of common mistakes. Use after completing implementations, fixing bugs, refactoring, or before committing code. |
Checking Quality
Comprehensive code quality assurance through systematic validation and common mistake prevention.
Table of Contents
Quick Start Checklist
Before committing any code changes, verify all quality gates pass:
# Frontend
cd frontend
npm run lint && npm run test && npm run build
# Backend
cd backend
npm run lint && npm run test && npm run build
Commit only when all checks pass:
- ✅ Lint: 0 errors, 0 warnings
- ✅ Tests: All passed
- ✅ Build: Success
Quality Gates
When to Run Quality Checks
Execute complete quality validation after:
- New feature implementation
- Bug fixes
- Refactoring
- Responding to feedback
- Before every commit (mandatory)
Frontend Validation
cd frontend
npm run lint # Linting
npm run test # All tests
npm run build # Build verification
Backend Validation
cd backend
npm run lint # Linting
npm run test # All tests
npm run build # Build verification
Test-First Development
Critical Rule: Always modify tests before implementation.
Correct Modification Sequence
When changing implementation:
- Modify tests first
- Verify tests fail (proving test validity)
- Update implementation
- Verify tests pass
Red-Green-Refactor Cycle
For new features and bug fixes:
- RED: Write failing test
- GREEN: Minimal code to pass test
- REFACTOR: Improve while tests stay green
See TDD Practices for detailed guidelines and examples.
Common Mistakes
Most Frequent Errors
- Forgetting test updates when modifying implementation
- Missing related file updates after interface changes
- Overlooking lint warnings before committing
- Skipping quality checks when rushed
Detailed Patterns
For comprehensive coverage of common mistakes with examples, see Common Mistakes Guide.
Quick Prevention
- Change interface → Update all call sites
- Modify types → Update all usages
- Add async → Add await to callers
- Remove unused imports/variables
- Convert
lettoconstwhen not reassigned
Workflows
New Feature Implementation
1. Write failing test (RED)
2. Run test to confirm failure
3. Write minimal implementation (GREEN)
4. Run test to confirm pass
5. Refactor while keeping tests green
6. Run quality checks (lint/test/build)
7. Commit when all checks pass
Bug Fixing
1. Write test reproducing the bug
2. Confirm test fails
3. Fix implementation
4. Confirm test passes
5. Check for related file updates
6. Run quality checks (lint/test/build)
7. Commit when all checks pass
Responding to Feedback
1. Understand the feedback
2. Modify tests first (critical!)
3. Update implementation
4. Verify related files
5. Run quality checks (lint/test/build)
6. Commit when all checks pass
Error Recovery
Lint Errors
- Read error message carefully
- Check tests first (may have same issue)
- Fix implementation
- Re-run
npm run lint
Test Failures
- Identify failing test
- Determine if implementation or test expectations changed
- Apply appropriate fix
- Re-run
npm run test
Build Errors
- Check type errors
- Verify dependencies
- Fix issues
- Re-run
npm run build
Best Practices
Small, Frequent Commits
- Commit after each completed feature
- Break large changes into incremental steps
- Keep each commit focused and self-contained
Automation
- Configure pre-commit hooks for automatic validation
- Use CI/CD pipelines to enforce quality gates
- Automate repetitive quality checks
Self-Review
- Re-read code changes before committing
- List modified files and their dependencies
- Verify test coverage for changes
Integration with Development
Quality checking should be seamless:
- During development: Run specific tests frequently
- Before breaks: Run full test suite
- Before committing: Run complete quality validation
- After merging: Verify integration tests pass
This systematic approach prevents quality issues from reaching the codebase while maintaining development velocity.