|
| 1 | +--- |
| 2 | +description: Quick access to refactoring project status, documentation, and common operations |
| 3 | +--- |
| 4 | + |
| 5 | +# π Refactoring Project Assistant |
| 6 | + |
| 7 | +**Context:** You're working on the rec_to_nwb_yaml_creator refactoring project following the comprehensive Phase 0-5 plan. |
| 8 | + |
| 9 | +--- |
| 10 | + |
| 11 | +## π Current Status |
| 12 | + |
| 13 | +**Phase:** Phase 1 - Testing Foundation |
| 14 | +**Branch:** `main` (Phase 0 merged and approved) |
| 15 | +**Working Directory:** `/Users/edeno/Documents/GitHub/rec_to_nwb_yaml_creator` |
| 16 | + |
| 17 | +--- |
| 18 | + |
| 19 | +## π Key Documentation |
| 20 | + |
| 21 | +You MUST READ these files IN ORDER to understand context: |
| 22 | + |
| 23 | +### Critical Reading Order |
| 24 | + |
| 25 | +1. **CLAUDE.md** - Project overview, zero-tolerance policy, critical workflows |
| 26 | +2. **docs/TASKS.md** - Current task checklist with completion status (PHASE 1 tasks) |
| 27 | +3. **docs/plans/COMPREHENSIVE_REFACTORING_PLAN.md** - Overall refactoring strategy |
| 28 | +4. **docs/SCRATCHPAD.md** - Session notes and performance baselines |
| 29 | +5. **docs/REFACTOR_CHANGELOG.md** - All changes made during refactoring |
| 30 | + |
| 31 | +### Supporting Documentation |
| 32 | + |
| 33 | +- **docs/ENVIRONMENT_SETUP.md** - Node.js environment details |
| 34 | +- **docs/CI_CD_PIPELINE.md** - GitHub Actions workflow documentation |
| 35 | +- **docs/GIT_HOOKS.md** - Pre-commit/pre-push hook details |
| 36 | +- **docs/INTEGRATION_CONTRACT.md** - Schema sync and device type contracts |
| 37 | + |
| 38 | +--- |
| 39 | + |
| 40 | +## π§ͺ Common Test Commands |
| 41 | + |
| 42 | +```bash |
| 43 | +# Run all tests |
| 44 | +npm test -- --run |
| 45 | + |
| 46 | +# Run baseline tests only |
| 47 | +npm run test:baseline -- --run |
| 48 | + |
| 49 | +# Run specific test file |
| 50 | +npm test -- validation-baseline.test.js --run |
| 51 | + |
| 52 | +# Run with coverage |
| 53 | +npm run test:coverage -- --run |
| 54 | + |
| 55 | +# Run E2E tests |
| 56 | +npm run test:e2e |
| 57 | + |
| 58 | +# Run integration tests |
| 59 | +npm run test:integration -- --run |
| 60 | + |
| 61 | +# Update visual regression snapshots |
| 62 | +npm run test:e2e -- --update-snapshots |
| 63 | +``` |
| 64 | + |
| 65 | +--- |
| 66 | + |
| 67 | +## π§ Quick Actions |
| 68 | + |
| 69 | +### Check Project Status |
| 70 | + |
| 71 | +```bash |
| 72 | +# View current phase tasks |
| 73 | +cat docs/TASKS.md | grep -A 100 "## Phase 1" |
| 74 | + |
| 75 | +# Check what's been completed |
| 76 | +git log --oneline -20 |
| 77 | + |
| 78 | +# View performance baselines |
| 79 | +cat docs/SCRATCHPAD.md |
| 80 | +``` |
| 81 | + |
| 82 | +### Run Verification Suite |
| 83 | + |
| 84 | +```bash |
| 85 | +# Full verification (what CI runs) |
| 86 | +npm run lint && npm run test:baseline -- --run && npm run test:coverage -- --run |
| 87 | + |
| 88 | +# Quick smoke test |
| 89 | +npm test -- --run --passWithNoTests |
| 90 | +``` |
| 91 | + |
| 92 | +### Git Workflow |
| 93 | + |
| 94 | +```bash |
| 95 | +# Current branch and status |
| 96 | +git status |
| 97 | + |
| 98 | +# Commit with phase prefix |
| 99 | +git add <files> |
| 100 | +git commit -m "phase1(category): description" |
| 101 | + |
| 102 | +# View recent commits |
| 103 | +git log --oneline -10 |
| 104 | + |
| 105 | +# Push to remote |
| 106 | +git push origin main |
| 107 | +``` |
| 108 | + |
| 109 | +--- |
| 110 | + |
| 111 | +## β οΈ Critical Rules |
| 112 | + |
| 113 | +### Test-Driven Development (TDD) |
| 114 | + |
| 115 | +1. **ALWAYS write test FIRST** |
| 116 | +2. **Run test and verify it FAILS** (or establishes baseline) |
| 117 | +3. **Only then create implementation** |
| 118 | +4. **Run test until it PASSES** |
| 119 | +5. **Run full regression suite** |
| 120 | + |
| 121 | +### Phase Gate Rules |
| 122 | + |
| 123 | +- β **DO NOT move to next phase** until ALL current phase tasks are checked |
| 124 | +- β **DO NOT skip tests** to match broken code |
| 125 | +- β **DO NOT change baselines** without explicit approval |
| 126 | +- β
**ASK permission** if you need to change requirements |
| 127 | + |
| 128 | +### Zero-Tolerance Policy |
| 129 | + |
| 130 | +- This is **critical scientific infrastructure** |
| 131 | +- Any regression can **corrupt irreplaceable data** |
| 132 | +- Always use **verification-before-completion** skill |
| 133 | +- Never skip verification steps |
| 134 | + |
| 135 | +--- |
| 136 | + |
| 137 | +## π Phase 1 Exit Criteria |
| 138 | + |
| 139 | +Before moving to Phase 2, ALL must be β
: |
| 140 | + |
| 141 | +- [ ] Unit test coverage β₯ 60% |
| 142 | +- [ ] Integration test coverage β₯ 50% |
| 143 | +- [ ] All tests passing (baseline + new unit tests) |
| 144 | +- [ ] No new ESLint errors introduced |
| 145 | +- [ ] Documentation updated |
| 146 | +- [ ] Human review and approval |
| 147 | + |
| 148 | +**Check current status:** `cat docs/TASKS.md | grep -A 10 "Phase 1 Exit Gate"` |
| 149 | + |
| 150 | +--- |
| 151 | + |
| 152 | +## π Troubleshooting |
| 153 | + |
| 154 | +### Tests Failing |
| 155 | + |
| 156 | +```bash |
| 157 | +# Check console output for errors |
| 158 | +npm test -- <test-file> --run --no-coverage |
| 159 | + |
| 160 | +# Verify imports work |
| 161 | +npm test -- --run --passWithNoTests |
| 162 | + |
| 163 | +# Clear and reinstall |
| 164 | +rm -rf node_modules && npm install |
| 165 | +``` |
| 166 | + |
| 167 | +### Snapshots Need Updating |
| 168 | + |
| 169 | +```bash |
| 170 | +# Update Vitest snapshots |
| 171 | +npm test -- --run --update |
| 172 | + |
| 173 | +# Update Playwright screenshots |
| 174 | +npm run test:e2e -- --update-snapshots |
| 175 | +``` |
| 176 | + |
| 177 | +### Hooks Not Running |
| 178 | + |
| 179 | +```bash |
| 180 | +# Reinstall hooks |
| 181 | +npx husky install |
| 182 | + |
| 183 | +# Check hook files exist |
| 184 | +ls -la .husky/ |
| 185 | +``` |
| 186 | + |
| 187 | +### Environment Issues |
| 188 | + |
| 189 | +```bash |
| 190 | +# Run environment setup |
| 191 | +/setup |
| 192 | + |
| 193 | +# Or manually |
| 194 | +nvm use && npm install |
| 195 | +``` |
| 196 | + |
| 197 | +--- |
| 198 | + |
| 199 | +## π― Your Next Steps |
| 200 | + |
| 201 | +1. **Read docs/TASKS.md** to find the next unchecked [ ] task in Phase 1 |
| 202 | +2. **Read existing production code** that you'll be testing |
| 203 | +3. **Follow TDD workflow** for the task: |
| 204 | + - Write test first (covering existing behavior) |
| 205 | + - Verify test passes (we're testing existing code, not fixing bugs) |
| 206 | + - Add additional test cases for edge cases |
| 207 | + - Run full regression suite |
| 208 | +4. **Update documentation**: |
| 209 | + - Check off [x] in TASKS.md |
| 210 | + - Add notes to SCRATCHPAD.md if you discover important behaviors |
| 211 | + - Update REFACTOR_CHANGELOG.md |
| 212 | +5. **Commit with phase prefix**: `phase1(tests): description` |
| 213 | + |
| 214 | +--- |
| 215 | + |
| 216 | +## π‘ Remember |
| 217 | + |
| 218 | +- **Read before you code** - Use Read tool to understand context |
| 219 | +- **Test before you implement** - TDD is mandatory |
| 220 | +- **Verify before you claim completion** - Use verification-before-completion skill |
| 221 | +- **Ask when uncertain** - Better to ask than assume |
| 222 | +- **Document as you go** - Update SCRATCHPAD.md with decisions/blockers |
| 223 | + |
| 224 | +--- |
| 225 | + |
| 226 | +## π When Blocked |
| 227 | + |
| 228 | +If you encounter any of these, STOP and document in SCRATCHPAD.md: |
| 229 | + |
| 230 | +1. β **Unclear requirements** - Ask for clarification |
| 231 | +2. π **Unexpected test failures** - Use systematic-debugging skill |
| 232 | +3. π **Conflicting requirements** - Ask for guidance |
| 233 | +4. β οΈ **Need to change baselines** - Request approval |
| 234 | +5. π« **Missing dependencies** - Document and ask for help |
| 235 | + |
| 236 | +**Never proceed with assumptions** - this is critical scientific infrastructure. |
| 237 | + |
| 238 | +--- |
| 239 | + |
| 240 | +Now tell me: **What task are you working on next?** |
| 241 | + |
| 242 | +Read docs/TASKS.md to find the first unchecked [ ] task in Phase 0. |
0 commit comments