fraim-framework 1.0.12 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/.ai-agents/agent-guardrails.md +58 -0
  2. package/.ai-agents/mcp-template.jsonc +34 -0
  3. package/.ai-agents/rules/agent-testing-guidelines.md +545 -0
  4. package/.ai-agents/rules/architecture.md +52 -0
  5. package/.ai-agents/rules/communication.md +122 -0
  6. package/.ai-agents/rules/continuous-learning.md +55 -0
  7. package/.ai-agents/rules/git-safe-commands.md +34 -0
  8. package/.ai-agents/rules/integrity-and-test-ethics.md +223 -0
  9. package/.ai-agents/rules/local-development.md +252 -0
  10. package/.ai-agents/rules/merge-requirements.md +231 -0
  11. package/.ai-agents/rules/pr-workflow-completeness.md +191 -0
  12. package/.ai-agents/rules/simplicity.md +112 -0
  13. package/.ai-agents/rules/software-development-lifecycle.md +276 -0
  14. package/.ai-agents/rules/spike-first-development.md +199 -0
  15. package/.ai-agents/rules/successful-debugging-patterns.md +313 -0
  16. package/.ai-agents/scripts/cleanup-branch.ts +278 -0
  17. package/.ai-agents/scripts/exec-with-timeout.ts +122 -0
  18. package/.ai-agents/scripts/prep-issue.sh +162 -0
  19. package/.ai-agents/templates/evidence/Design-Evidence.md +30 -0
  20. package/.ai-agents/templates/evidence/Implementation-BugEvidence.md +48 -0
  21. package/.ai-agents/templates/evidence/Implementation-FeatureEvidence.md +54 -0
  22. package/.ai-agents/templates/evidence/Spec-Evidence.md +19 -0
  23. package/.ai-agents/templates/help/HelpNeeded.md +14 -0
  24. package/.ai-agents/templates/retrospective/RETROSPECTIVE-TEMPLATE.md +55 -0
  25. package/.ai-agents/templates/specs/BUGSPEC-TEMPLATE.md +37 -0
  26. package/.ai-agents/templates/specs/FEATURESPEC-TEMPLATE.md +29 -0
  27. package/.ai-agents/templates/specs/TECHSPEC-TEMPLATE.md +39 -0
  28. package/.ai-agents/workflows/design.md +121 -0
  29. package/.ai-agents/workflows/implement.md +170 -0
  30. package/.ai-agents/workflows/resolve.md +152 -0
  31. package/.ai-agents/workflows/retrospect.md +84 -0
  32. package/.ai-agents/workflows/spec.md +103 -0
  33. package/.ai-agents/workflows/test.md +90 -0
  34. package/.cursor/rules/cursor-rules.mdc +8 -0
  35. package/.cursor/rules/design.mdc +4 -0
  36. package/.cursor/rules/implement.mdc +6 -0
  37. package/.cursor/rules/resolve.mdc +5 -0
  38. package/.cursor/rules/retrospect.mdc +4 -0
  39. package/.cursor/rules/spec.mdc +4 -0
  40. package/.cursor/rules/test.mdc +5 -0
  41. package/.windsurf/rules/windsurf-rules.md +7 -0
  42. package/.windsurf/workflows/resolve-issue.md +6 -0
  43. package/.windsurf/workflows/retrospect.md +6 -0
  44. package/.windsurf/workflows/start-design.md +6 -0
  45. package/.windsurf/workflows/start-impl.md +6 -0
  46. package/.windsurf/workflows/start-spec.md +6 -0
  47. package/.windsurf/workflows/start-tests.md +6 -0
  48. package/CHANGELOG.md +66 -0
  49. package/CODEOWNERS +24 -0
  50. package/DISTRIBUTION.md +6 -6
  51. package/PUBLISH_INSTRUCTIONS.md +93 -0
  52. package/README.md +330 -104
  53. package/bin/fraim.js +49 -3
  54. package/index.js +30 -3
  55. package/install.sh +58 -58
  56. package/labels.json +52 -0
  57. package/linkedin-post.md +23 -0
  58. package/package.json +12 -7
  59. package/sample_package.json +18 -0
  60. package/setup.js +712 -389
  61. package/test-utils.ts +118 -0
  62. package/tsconfig.json +22 -0
  63. package/agents/claude/CLAUDE.md +0 -42
  64. package/agents/cursor/rules/architecture.mdc +0 -49
  65. package/agents/cursor/rules/continuous-learning.mdc +0 -48
  66. package/agents/cursor/rules/cursor-workflow.mdc +0 -29
  67. package/agents/cursor/rules/design.mdc +0 -25
  68. package/agents/cursor/rules/implement.mdc +0 -26
  69. package/agents/cursor/rules/local-development.mdc +0 -104
  70. package/agents/cursor/rules/prep.mdc +0 -15
  71. package/agents/cursor/rules/resolve.mdc +0 -46
  72. package/agents/cursor/rules/simplicity.mdc +0 -18
  73. package/agents/cursor/rules/software-development-lifecycle.mdc +0 -41
  74. package/agents/cursor/rules/test.mdc +0 -25
  75. package/agents/windsurf/rules/architecture.md +0 -49
  76. package/agents/windsurf/rules/continuous-learning.md +0 -47
  77. package/agents/windsurf/rules/local-development.md +0 -103
  78. package/agents/windsurf/rules/remote-development.md +0 -22
  79. package/agents/windsurf/rules/simplicity.md +0 -17
  80. package/agents/windsurf/rules/windsurf-workflow.md +0 -28
  81. package/agents/windsurf/workflows/prep.md +0 -20
  82. package/agents/windsurf/workflows/resolve-issue.md +0 -47
  83. package/agents/windsurf/workflows/start-design.md +0 -26
  84. package/agents/windsurf/workflows/start-impl.md +0 -27
  85. package/agents/windsurf/workflows/start-tests.md +0 -26
  86. package/github/phase-change.yml +0 -218
  87. package/github/status-change.yml +0 -68
  88. package/github/sync-on-pr-review.yml +0 -66
  89. package/scripts/__init__.py +0 -10
  90. package/scripts/cli.py +0 -141
  91. package/setup.py +0 -0
  92. package/test-config.json +0 -32
  93. package/workflows/setup-fraim.yml +0 -147
@@ -0,0 +1,231 @@
1
+ # Merge Requirements
2
+
3
+ ## INTENT
4
+ To ensure the stability of the `master` branch and prevent accidental overwrites by requiring all agents to apply their local changes *on top of* the latest `master` branch changes, ensuring `master`'s history is never overwritten.
5
+
6
+ ## PRINCIPLES
7
+ - **Rebase, Don't Merge:** Always rebase your feature branch on top of the latest `master` to maintain a clean, linear history and ensure changes from `master` are applied first.
8
+ - **Verify After Rebase:** Run all tests and builds *after* a successful rebase to ensure stability before pushing.
9
+ - **Document Conflict Resolution:** Clearly document how any rebase conflicts were resolved, emphasizing how `master`'s changes were preserved.
10
+ - **Force-with-Lease:** When pushing a rebased branch, use `git push --force-with-lease` to avoid overwriting work from other contributors.
11
+
12
+ ## WORKFLOW
13
+
14
+ ## MANDATORY PRE-PUSH WORKFLOW
15
+
16
+ ### Before ANY push to your feature branch:
17
+ ```bash
18
+ # 1. Sync with latest master
19
+ git fetch origin
20
+ git rebase origin/master
21
+
22
+ # 2. If conflicts occur, resolve them using conflict resolution guide
23
+ # (Git will pause and show you conflict markers)
24
+ git rebase --continue
25
+
26
+ # 3. Verify everything works
27
+ npm run build
28
+ npm run test-smoke test*.ts
29
+
30
+ # 4. Only then push
31
+ git push origin <your-feature-branch> --force-with-lease
32
+ ```
33
+
34
+ ### This workflow is MANDATORY because:
35
+ - Prevents creating stale PRs
36
+ - Ensures your changes work with latest master
37
+ - Reduces merge conflicts
38
+ - Required by GitHub branch protection rules
39
+
40
+ ## DETAILED REBASE PROCESS
41
+ 1. **Sync with `master`:** Before pushing your changes, rebase your feature branch on top of the latest `master` branch. This applies `master`'s changes first, then your local changes on top.
42
+
43
+ ```bash
44
+ git checkout <your-feature-branch>
45
+ git fetch origin
46
+ git rebase origin/master
47
+ ```
48
+
49
+ 2. **Resolve Rebase Conflicts:** If there are any conflicts during the rebase, you must resolve them intelligently. The rebase process will pause to allow you to fix the files. Your goal is to preserve the changes from `master` while reapplying your feature's changes.
50
+
51
+ ## CONFLICT RESOLUTION DURING REBASE
52
+
53
+ ### When Git Pauses for Conflicts:
54
+ 1. **Read the conflict markers carefully:**
55
+ - `<<<<<<< HEAD` = Your changes
56
+ - `=======` = Separator
57
+ - `>>>>>>> origin/master` = Master's changes
58
+
59
+ 2. **Understand what each version does:**
60
+ - Master's version = What's already in production
61
+ - Your version = What you're trying to add
62
+
63
+ 3. **Resolution Strategy:**
64
+ - **Keep master's base** (it's already tested/deployed)
65
+ - **Add your enhancements** on top
66
+ - **Never overwrite master's working code**
67
+ - **Never lose your new functionality**
68
+
69
+ 4. **Common Conflict Scenarios:**
70
+
71
+ **Scenario 1: Same function, different implementations**
72
+ ```typescript
73
+ <<<<<<< HEAD (your changes)
74
+ async function processMessage(message: string) {
75
+ // Your new implementation
76
+ return await this.messageService.process(message);
77
+ }
78
+ =======
79
+ async function processMessage(message: string) {
80
+ // Master's updated implementation
81
+ return await this.messageService.processWithValidation(message);
82
+ }
83
+ >>>>>>> origin/master
84
+ ```
85
+
86
+ **Resolution:** Keep master's version + add your enhancements
87
+ ```typescript
88
+ async function processMessage(message: string) {
89
+ // Master's base implementation
90
+ const result = await this.messageService.processWithValidation(message);
91
+ // Your additional logic
92
+ return await this.enhanceResult(result);
93
+ }
94
+ ```
95
+
96
+ **Scenario 2: Different functions, no overlap**
97
+ ```typescript
98
+ <<<<<<< HEAD (your changes)
99
+ // Your new function
100
+ async function newFeature() {
101
+ return "new stuff";
102
+ }
103
+ =======
104
+ // Master's new function
105
+ async function masterFeature() {
106
+ return "master stuff";
107
+ }
108
+ >>>>>>> origin/master
109
+ ```
110
+
111
+ **Resolution:** Keep both (no conflict, just different functions)
112
+ ```typescript
113
+ // Master's function
114
+ async function masterFeature() {
115
+ return "master stuff";
116
+ }
117
+
118
+ // Your function
119
+ async function newFeature() {
120
+ return "new stuff";
121
+ }
122
+ ```
123
+
124
+ 5. **After resolving conflicts:**
125
+ ```bash
126
+ # After resolving conflicts in your IDE
127
+ git add <resolved-file-1> <resolved-file-2>
128
+ git rebase --continue
129
+ ```
130
+
131
+ ### NEVER DO THIS:
132
+ ❌ "Accept Current Change" (your version) - overwrites master
133
+ ❌ "Accept Incoming Change" (master's version) - loses your work
134
+ ❌ "Accept Both Changes" - creates duplicate code
135
+
136
+ ### ALWAYS DO THIS:
137
+ ✅ Read both versions carefully
138
+ ✅ Understand what each change does
139
+ ✅ Merge intelligently or choose the better implementation
140
+ ✅ Test the resolution with: npm run build && npm run test-smoke
141
+ ✅ Document your resolution in the PR description
142
+
143
+ 3. **Run Verification Checks:** After the rebase is complete, you must run all local verification checks to ensure the codebase is stable.
144
+ * **Build the project:** Run the build command to ensure there are no compilation errors.
145
+ * **Run tests:** Execute the full test suite to confirm that your changes have not introduced any regressions.
146
+
147
+ 4. **Push Your Changes:** Once all checks have passed, push your rebased branch. You must use `--force-with-lease` because the rebase has rewritten your branch's commit history.
148
+
149
+ ```bash
150
+ git push origin <your-feature-branch> --force-with-lease
151
+ ```
152
+
153
+ 5. **Pull Request:** When creating a pull request, the description must include a confirmation that this rebase process was followed and a detailed summary of how any conflicts were resolved.
154
+
155
+ ## PR Description Template
156
+ ```markdown
157
+ ## Merge Process Confirmation
158
+ - [ ] Rebased on latest master
159
+ - [ ] Resolved X conflicts in files: [list files]
160
+ - [ ] Resolution strategy: [explain what you did]
161
+ - [ ] Verified with: npm run build && npm run test-smoke
162
+ - [ ] All tests passing: ✅
163
+
164
+ ## Conflict Resolution Summary
165
+ ### Files with conflicts:
166
+ - `src/file1.ts`: [Brief description of how conflict was resolved]
167
+ - `src/file2.ts`: [Brief description of how conflict was resolved]
168
+
169
+ ### Resolution approach:
170
+ [Explain your overall strategy - e.g., "Kept master's base implementation and added my enhancements on top"]
171
+ ```
172
+
173
+ ## FINAL MERGE PROCESS (After PR Approval)
174
+
175
+ ### 6. **Execute the Merge:** Once your PR is approved and ready, perform the final merge:
176
+
177
+ ```bash
178
+ # 1. Navigate to your PR on GitHub
179
+ # 2. Click "Merge pull request" button
180
+ # 3. GitHub will automatically:
181
+ # - Rebase your branch on latest master
182
+ # - Apply your changes on top
183
+ # - Create a clean, linear history
184
+ # - Merge into master
185
+ ```
186
+
187
+ ### 7. **Post-Merge Cleanup:** After successful merge:
188
+
189
+ ```bash
190
+ # 1. Switch to master and pull latest changes
191
+ git checkout master
192
+ git pull origin master
193
+
194
+ # 2. Delete your feature branch (local)
195
+ git branch -d <your-feature-branch>
196
+
197
+ # 3. Delete your feature branch (remote)
198
+ git push origin --delete <your-feature-branch>
199
+
200
+ # 4. Verify the merge was successful
201
+ git log --oneline -5
202
+ ```
203
+
204
+ ### 8. **Final Verification:** Ensure everything is working:
205
+
206
+ ```bash
207
+ # Run final tests to confirm merge didn't break anything
208
+ npm run build
209
+ npm run test-smoke test*.ts
210
+ ```
211
+
212
+ ## MERGE WORKFLOW SUMMARY
213
+
214
+ ### Complete Process:
215
+ 1. **Development** → Work on feature branch
216
+ 2. **Pre-Push** → Rebase on master, resolve conflicts, test
217
+ 3. **Push** → Push to GitHub
218
+ 4. **PR Creation** → Create PR with detailed description
219
+ 5. **Review** → Wait for approval
220
+ 6. **Merge** → Click "Merge pull request" on GitHub
221
+ 7. **Cleanup** → Delete branches, verify merge
222
+ 8. **Verification** → Run final tests
223
+
224
+ ### Key Points:
225
+ - ✅ **GitHub handles the final rebase** automatically during merge
226
+ - ✅ **No manual rebasing** needed before merge
227
+ - ✅ **Linear history** maintained automatically
228
+ - ✅ **All conflicts resolved** during the merge process
229
+ - ✅ **Clean, up-to-date master** branch
230
+
231
+ By following this process, we ensure that the `master` branch always remains in a stable and deployable state. Failure to follow these rules will result in the rejection of your pull request.
@@ -0,0 +1,191 @@
1
+ # PR Workflow Completeness
2
+
3
+ ## ⚠️ CRITICAL: Complete PR Lifecycle Required
4
+ **EVERY PR MUST BE MONITORED FROM CREATION TO MERGE**
5
+ - Design PRs, Test Plan PRs, Implementation PRs - ALL need monitoring
6
+ - NO EXCEPTIONS - even if you think the work is "complete"
7
+ - If you push code, you MUST poll for feedback
8
+
9
+
10
+ ## INTENT
11
+ To ensure AI agents autonomously handle the complete PR lifecycle with proper monitoring, feedback handling, and testing, eliminating gaps that require human intervention and ensuring thorough end-to-end handling of development processes.
12
+
13
+ **This applies to every phase - design, test, implementation ... anytime you submit a PR, you must follow all these rules.**
14
+
15
+ ## PRINCIPLES
16
+ - **Complete Autonomy**: Agents should handle the entire PR workflow without requiring human prompting
17
+ - **Proactive Monitoring**: Continuously check status of actions and PRs
18
+ - **Comprehensive Feedback**: Address all comments before resubmission
19
+ - **Evidence-Based Progress**: Document test results and implementation status
20
+ - **Standardized Bug Fixing**: Follow consistent reproduce-test-fix workflow
21
+
22
+ ## REQUIREMENTS
23
+
24
+ ### 1. Git Action Monitoring
25
+ - **MUST** set issue to status:needs-review only after all Git actions associated with the PR are successful
26
+ - **MUST** monitor these actions after commit and sync
27
+ - **MUST** check every 30 seconds until completion
28
+ - **MUST** timeout after 10 minutes (20 attempts) and notify the user
29
+ - **MUST** handle network failures with exponential backoff
30
+ - **MUST** report action failures with detailed error information
31
+
32
+ #### Implementation
33
+ ```
34
+ After commit and push:
35
+ 1. Check GitHub Actions status every 30 seconds
36
+ 2. If actions are still running, continue polling
37
+ 3. If actions fail, understand the failure, debug and fix it, iterate until actions succeed. If actions do not succeed after 3 tries, give up and give the user an analysis of the failures and next steps
38
+ 4. If 10 minutes elapse and the GitHub Action hasn't made progress, timeout and notify user
39
+ 5. If actions succeed, proceed to set issue status as per your workflow stage, and then poll as below.
40
+ ```
41
+
42
+ ### 2. PR Feedback Polling
43
+ - **MUST** poll every 1 minute awaiting PR feedback after submission
44
+ - **MUST NOT** expect a human to come back and tell what to do
45
+ - **MUST** timeout after 24 hours and notify the user
46
+ - **MUST** handle network failures with exponential backoff
47
+ - **MUST** process all types of feedback (comments, suggestions, reviews)
48
+ - **🔥 REMINDER: This applies to DESIGN PRs too! Even if you just created a design document, you MUST poll for feedback on the PR.**
49
+
50
+ #### Implementation
51
+ ```
52
+ After PR submission:
53
+ 1. Poll for PR feedback every 1 minute
54
+ 2. If new feedback is found, process it immediately
55
+ 3. If no feedback after 24 hours, notify user
56
+ 4. Continue polling until PR has been reviewed, then take action based on the phase of the workflow you are in
57
+ ```
58
+
59
+ ### 3. PR Comment Handling
60
+ - **MUST** address every comment in the PR before resubmitting for review
61
+ - **MUST** handle threaded discussions and follow all conversation threads
62
+ - **MUST** implement code suggestions or explain why not
63
+ - **MUST** reply to each comment indicating how it was addressed
64
+ - **MUST** verify all comments are addressed before changing status back to needs-review
65
+
66
+ #### Implementation
67
+ ```
68
+ When PR feedback is received:
69
+ 1. Set status:wip
70
+ 2. Track each comment that requires action
71
+ 3. Address each comment with appropriate changes
72
+ 4. Reply to each comment explaining how it was addressed
73
+ 5. Verify all comments are addressed
74
+ 6. Set status:needs-review when complete
75
+ ```
76
+
77
+ ### 4. Test Result Documentation
78
+ - **MUST** add a comment to the issue with results of test cases before setting status:needs-review
79
+ - **MUST** include which tests failed and analysis on failures
80
+ - **MUST** document test coverage and any gaps
81
+ - **MUST** provide evidence of test execution
82
+ - **MUST** include specific test commands run and their output
83
+ - **MUST** clean up cruft that was created for temporary testing, logs, debugs, etc. Do not commit these files.
84
+
85
+ #### Implementation
86
+ ```
87
+ Before setting status:needs-review:
88
+ 1. Run all relevant tests
89
+ 2. Document test results in a comment on the issue
90
+ 3. Include test command output
91
+ 4. Analyze any failures
92
+ 5. Document test coverage
93
+ 6. Only then set status:needs-review
94
+ ```
95
+
96
+ ### 5. Bug Fix Workflow
97
+ - **MUST** reproduce the issue first
98
+ - **MUST** write a test case that fails
99
+ - **MUST** implement the fix
100
+ - **MUST** ensure the test case passes
101
+ - **MUST** document the entire process
102
+
103
+ #### Implementation
104
+ ```
105
+ When fixing a bug:
106
+ 1. Reproduce the issue and document steps
107
+ 2. Write a test case that fails due to the bug
108
+ 3. Implement the fix
109
+ 4. Verify the test now passes
110
+ 5. Document the entire process in the PR
111
+ ```
112
+
113
+ ## EXAMPLES
114
+
115
+ ### Good: Complete Git Action Monitoring
116
+ ```
117
+ Action: Pushed changes to feature branch
118
+ Monitoring: Checking GitHub Actions status every 30s
119
+ Status at 30s: 2 workflows running
120
+ Status at 60s: 1 workflow running, 1 completed
121
+ Status at 90s: All workflows completed successfully
122
+ Result: Setting status:needs-review
123
+ ```
124
+
125
+ ### Bad: Incomplete Monitoring
126
+ ```
127
+ Action: Pushed changes to feature branch
128
+ Result: Immediately set status:needs-review without checking actions
129
+ ```
130
+
131
+ ### Good: Proper PR Feedback Handling
132
+ ```
133
+ Action: PR submitted for review
134
+ Monitoring: Polling for feedback every 1 minute
135
+ Feedback at 10m: 3 comments received
136
+ Response:
137
+ - Set status:wip
138
+ - Addressed each comment with code changes
139
+ - Replied to each comment explaining changes
140
+ - Verified all comments addressed
141
+ - Set status:needs-review
142
+ ```
143
+
144
+ ### Bad: Incomplete Feedback Handling
145
+ ```
146
+ Action: PR submitted for review
147
+ Response: Waiting for user to tell me about feedback
148
+ ```
149
+
150
+ ### Good: Thorough Test Documentation
151
+ ```
152
+ Before setting status:needs-review:
153
+ - Ran tests: npm test test-api-integration.ts
154
+ - Results: 10/10 tests passing
155
+ - Coverage: 95% of code paths tested
156
+ - Evidence: Full test output included in comment
157
+ ```
158
+
159
+ ### Bad: Missing Test Documentation
160
+ ```
161
+ Action: Set status:needs-review
162
+ Documentation: None provided about test results
163
+ ```
164
+
165
+ ### Good: Proper Bug Fix Workflow
166
+ ```
167
+ Bug: API integration timeout
168
+ Process:
169
+ 1. Reproduced by setting up test environment with slow network
170
+ 2. Wrote test case that fails due to timeout
171
+ 3. Implemented exponential backoff with jitter
172
+ 4. Verified test now passes
173
+ 5. Documented entire process in PR
174
+ ```
175
+
176
+ ### Bad: Incomplete Bug Fix
177
+ ```
178
+ Bug: API integration timeout
179
+ Process: Added retry logic without reproducing or testing
180
+ ```
181
+
182
+ ## FAILURE MODES & TIMEOUTS
183
+ - Git action polling timeout: 10 minutes (20 attempts)
184
+ - PR feedback polling timeout: 24 hours
185
+ - Network failures: Use exponential backoff starting at 30s
186
+
187
+ ## OBSERVABILITY
188
+ - Log all polling attempts and results
189
+ - Track time spent in each phase of the workflow
190
+ - Alert on polling timeouts or repeated failures
191
+ - Record metrics on time to address PR feedback
@@ -0,0 +1,112 @@
1
+ # Simplicity
2
+
3
+ ## INTENT
4
+ To maintain code quality and development velocity by preventing over-engineering, ensuring agents focus on solving the specific problem at hand rather than building unnecessary complexity.
5
+
6
+ ## PRINCIPLES
7
+ - Keep it simple. Don't over-engineer.
8
+ - Don't over-think it.
9
+ - Focus on the assigned issue only.
10
+ - Don't fix other issues or make unrelated changes.
11
+
12
+ ## REQUIREMENTS
13
+ - While fixing an issue, focus on that issue only
14
+ - Don't fix other issues or make unrelated changes
15
+ - If you find other issues that must be fixed, include them in your final report as a suggested Git issue
16
+ - Don't over-engineer solutions
17
+ - Choose the simplest approach that solves the problem
18
+ - **NEVER use placeholder comments** like "For now", "TODO", "FIXME", or "This is a placeholder"
19
+ - **ALWAYS implement complete solutions** - if something needs to be customized later, implement it properly with clear configuration
20
+
21
+ ## PROTOTYPE-FIRST DEVELOPMENT PATTERN
22
+
23
+ ### Core Principle
24
+ **Always prototype the end-to-end solution manually before engineering it correctly.**
25
+
26
+ ### Development Flow
27
+ 1. **Prototype**: Build simplest possible solution that works end-to-end
28
+ 2. **Manual Validation**: Test each step manually using browser/API calls
29
+ 3. **Verify**: Confirm everything works before creating automated tests
30
+ 4. **Engineer**: Refactor to production quality once proven to work
31
+ 5. **Automate**: Create Playwright tests only after manual validation
32
+
33
+ ### Anti-Patterns to Avoid
34
+ - ❌ **"Assume It Works"**: Creating tests before manual validation
35
+ - ❌ **"Over-Engineer First"**: Building complex architecture before proving simple solution works
36
+ - ❌ **"Test-Driven Over-Engineering"**: Writing comprehensive test suites for unproven solutions
37
+ - ❌ **"Band-Aid Fixes"**: Adding delays, retries, workarounds instead of fixing root cause
38
+ - ❌ **"Resource Waste"**: Running expensive operations repeatedly without analyzing failures
39
+
40
+ ### Validation Requirements
41
+ - **Manual Testing**: Use browser/curl to test each step manually
42
+ - **End-to-End Flow**: Verify complete user journey works
43
+ - **No Assumptions**: Don't assume anything works until manually verified
44
+ - **Simple First**: Start with simplest possible implementation
45
+ - **Prove Then Improve**: Only add complexity after proving simple version works
46
+
47
+ ## RESOURCE WASTE PREVENTION
48
+ - Maximum 2 retries for expensive operations (Playwright, API calls, database)
49
+ - After 2 failures: STOP, analyze, propose different approach
50
+ - **STOP** if tests are consuming significant resources repeatedly
51
+ - **Manual validation required** before creating automated tests
52
+
53
+ ## EXAMPLES
54
+
55
+ ### Good: Prototype-First Development
56
+ ```
57
+ Issue: "Add OAuth login"
58
+ Action:
59
+ 1. Built simple OAuth callback → JWT → redirect
60
+ 2. Manually tested with browser (login → redirect → dashboard works)
61
+ 3. Verified end-to-end flow works
62
+ 4. Then created Playwright tests
63
+ Result: Working solution, no overengineering
64
+ ```
65
+
66
+ ### Bad: Over-Engineering First
67
+ ```
68
+ Issue: "Add OAuth login"
69
+ Action:
70
+ 1. Built complex session management system
71
+ 2. Created comprehensive test suite
72
+ 3. Added session validation endpoints
73
+ 4. Created infinite redirect loops
74
+ 5. Added delays/retries to fix timing issues
75
+ Result: Over-engineered, resource waste, doesn't work
76
+ ```
77
+
78
+ ### Good: Manual Validation First
79
+ ```
80
+ Issue: "Fix API endpoint"
81
+ Action:
82
+ 1. Fixed the code
83
+ 2. Tested with curl to verify it works
84
+ 3. Tested in browser to verify UI works
85
+ 4. Then created automated tests
86
+ Result: Confident solution works before automation
87
+ ```
88
+
89
+ ### Bad: Assume It Works
90
+ ```
91
+ Issue: "Fix API endpoint"
92
+ Action:
93
+ 1. Fixed the code
94
+ 2. Created Playwright tests immediately
95
+ 3. Tests fail because solution doesn't actually work
96
+ 4. Keep retrying tests instead of fixing code
97
+ Result: Wasted resources, false confidence
98
+ ```
99
+
100
+ ### Good: Simple Solution
101
+ ```
102
+ Issue: "Add error message for invalid input"
103
+ Action: Added single validation check with clear error message
104
+ Result: Clean, focused solution
105
+ ```
106
+
107
+ ### Bad: Complex Solution
108
+ ```
109
+ Issue: "Add error message for invalid input"
110
+ Action: Built comprehensive validation framework with multiple error types, internationalization, and complex state management
111
+ Result: Over-engineered for simple requirement
112
+ ```