Enforces rigorous validation-first workflow for TypeScript monorepo projects. Never assume code works - always validate after every change with type checking, linting, builds, and manual testing.
A comprehensive skill for enforcing validation-first development workflows in TypeScript monorepo projects.
This skill enforces a rigorous iterative development approach where code is never assumed to work until validated. It's designed for TypeScript monorepo projects using pnpm workspaces and emphasizes continuous validation after every code change.
**Never assume code works - always validate it.** Every code change must be immediately followed by validation steps including type checking, linting, building, and manual testing.
Before writing any code:
1. **Read Required Documentation**
- Check for `docs/iterative-task-execution.md` - Complete workflow guide
- Review `docs/technical-architecture.md` - System architecture
- Read `docs/development-setup.md` - Environment setup
- For API work: read `docs/api-specification.md`
- For data work: read `docs/data-models.md`
- For frontend work: read `docs/design-system.md`
2. **Understand Current State**
- Read existing code in the area you'll modify
- Understand current patterns and conventions
- Identify dependencies and integration points
3. **Plan Implementation**
- Break down task into small, testable increments
- Identify validation points
- Note files that will need changes
Before making changes:
1. **Verify Prerequisites**
```bash
# Install dependencies
pnpm install
# Build shared packages first
pnpm --filter @clearvalue/shared build
# Verify environment
pnpm typecheck
pnpm lint
pnpm build
```
2. **Start Development Server**
```bash
pnpm dev
```
3. **Verify Baseline**
- Ensure all packages build successfully
- Ensure type checking passes
- Ensure linting passes
For EVERY code change, follow this cycle:
1. **Make Small Change**
- Modify ONE thing at a time
- Keep changes focused and minimal
2. **Immediate Validation** (REQUIRED after every change)
```bash
# Run type checking
pnpm typecheck
# Run linting
pnpm lint
# Build affected package
pnpm --filter <package-name> build
```
3. **Fix Errors Immediately**
- Do NOT proceed if validation fails
- Fix all errors before next change
- Never accumulate errors
4. **Manual Testing**
- For API changes: Test with curl or API client
- For frontend changes: Test in browser
- Verify the change works as expected
5. **Repeat** - Make next small change and validate again
After implementing core functionality:
1. **Test Success Cases**
- Verify happy path works
- Test all main use cases
2. **Test Error Cases**
- Test invalid inputs
- Test permission errors
- Test network failures
3. **Test Edge Cases**
- Test null/empty values
- Test boundary values
- Test unusual but valid inputs
4. **Integration Testing**
- Test with existing code
- Verify no breaking changes to existing functionality
- Test data flow through the system
Before marking task complete:
1. **Clean Build**
```bash
# Remove build artifacts
pnpm clean
# Full rebuild
pnpm build
```
2. **Production Build Test**
```bash
# Build in production mode
pnpm --filter <package> build
```
3. **Verify All Packages**
- Ensure all dependent packages still build
- Check for breaking changes
Run comprehensive quality checks:
```bash
pnpm typecheck
pnpm lint
pnpm build
```
**Code Review Checklist:**
Verify all acceptance criteria:
Complete pre-commit checklist:
```bash
pnpm install
pnpm --filter @clearvalue/shared build
pnpm typecheck
pnpm lint
pnpm build
pnpm dev # Manual testing
```
**Final Checklist:**
```
project-root/
├── apps/
│ ├── api/ # Backend (Fastify + TypeScript)
│ └── web/ # Frontend (React + Vite + TypeScript)
├── packages/
│ └── shared/ # Shared types and schemas
└── docs/ # Documentation
```
When modifying `packages/shared/`:
1. **Make Changes**
- Edit types or schemas
2. **Rebuild Shared Package**
```bash
pnpm --filter @clearvalue/shared build
```
3. **Rebuild Dependent Packages**
```bash
pnpm --filter @clearvalue/api build
pnpm --filter @clearvalue/web build
```
4. **Verify No Breaking Changes**
- Check all consumers still work
- Update consumers if needed
```bash
pnpm typecheck && pnpm lint && pnpm build
pnpm install
pnpm --filter @clearvalue/shared build
pnpm typecheck
pnpm lint
pnpm build
pnpm dev
curl http://localhost:3000/api/v1/health
pnpm --filter <package-name> build
pnpm typecheck
pnpm lint
pnpm clean
```
Use conventional commits:
**Commit Guidelines:**
**DO:**
**DO NOT:**
A task is NOT complete until:
1. All code compiles without errors
2. All type checking passes
3. All linting passes
4. Manual testing is complete
5. All acceptance criteria are met
6. No regressions introduced
7. Documentation updated (if needed)
8. Code follows project patterns
9. Error handling is comprehensive
10. Production build succeeds
**Scenario: Adding a new API endpoint**
1. Read `docs/api-specification.md` and `docs/data-models.md`
2. Plan the endpoint structure and validation
3. Add route handler (small change)
4. Run `pnpm typecheck && pnpm lint && pnpm --filter @clearvalue/api build`
5. Test with curl
6. Add validation schema (small change)
7. Run validation commands again
8. Test invalid inputs
9. Add error handling (small change)
10. Run validation commands again
11. Complete full testing suite
12. Run final validation pipeline
13. Verify all checklist items
Each step includes immediate validation - no moving forward with errors.
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/cursor-iterative-development-rules/raw