fec-tdd-workflow
Installation
SKILL.md
Front-end TDD workflow
Purpose
Use the rhythm of "write failing tests first, then implement the minimum code, and then refactor" to deliver front-end functions to avoid supplementing coverage only after implementation.
Procedure
- Identify observable behaviors: UI, component contracts, hook/composable return values, route guard results, API client output or error status that users can see.
- First write a minimum failure test:
- Pure logic first unit testing.
- Prioritize component interaction Testing Library / Vue Test Utils.
- Prioritize critical processes across pages Playwright/Cypress.
- Run the test and confirm that the failure reason is correct and should come from behavior that has not yet been implemented, rather than a syntax, import, or test environment error.
- Write the minimum implementation that can just pass the test, and do not expand the scope easily.
- Rerun the test and confirm it turns green.
- Refactor naming, boundaries and duplication logic while keeping tests passing.
- Fix bugs and retain regression tests that can reproduce the problem.
- Only one observable behavior is expanded in each round; new requirements, new boundaries and new abnormal paths enter the next round respectively.