Skip to content

Commit 51e1428

Browse files
committed
Asked Claude to add lessons learned while solving these days to CLAUDE.md.
1 parent 7d8b44e commit 51e1428

File tree

2 files changed

+72
-33
lines changed

2 files changed

+72
-33
lines changed

CLAUDE.md

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ When the user says "Let's do day X" or similar, and the AOC_SESSION_COOKIE envir
2424
13. **Update test file**: Add both answers to SolutionTest.kt
2525
14. **Update README**: Add the day's entry to the main README
2626
15. **Create PR**: Branch, commit, and create a pull request
27-
16. **MANDATORY: Wait for PR comments**: Wait 5 minutes for CodeRabbit and CI checks, then address all feedback
27+
16. **MANDATORY: Wait for PR comments**: Wait 3 minutes for CodeRabbit and CI checks, then address all feedback
2828
17. **MANDATORY: Address PR feedback**: Fix any failing builds and implement actionable suggestions
2929
18. **MANDATORY: Merge the PR**: After addressing feedback, wait for CI to complete and then merge the PR using `gh pr merge --squash --delete-branch`
3030

@@ -33,7 +33,7 @@ When the user says "Let's do day X" or similar, and the AOC_SESSION_COOKIE envir
3333
- **input.txt contains your personal puzzle input** (different for each user)
3434
- **Always submit immediately** when you have an answer (don't wait for user confirmation)
3535
- **Continue to Part 2 automatically** after Part 1 is confirmed correct
36-
- **Handle wrong answers**: If an answer is wrong, debug and try again
36+
- **Handle wrong answers**: If an answer is wrong, debug and try again (common causes: off-by-one errors, parsing issues, misunderstood requirements)
3737
- **Complete the entire day**: Don't stop until both parts are solved and committed
3838

3939
### Note on Input Files:
@@ -113,6 +113,11 @@ When I ask you to prepare for a problem, move back to the main branch, pull the
113113
- The comment should explain both the problem context and the solution approach for each part
114114
- Use `/* */` multi-line comments, not `//` single-line comments for the header
115115
- Prefer readability to clever one-liners. The goal is that even people relatively new to the language and programming in general should easily understand it
116+
- **Performance considerations**: For computationally intensive problems, consider:
117+
- Memoization/caching for recursive solutions
118+
- Early termination conditions
119+
- Efficient data structures (Set vs List for lookups)
120+
- Avoiding unnecessary string concatenation in loops
116121

117122
## Debugging Help
118123
If a solution isn't working:
@@ -134,7 +139,7 @@ When AOC_SESSION_COOKIE is set and user says "Let's do day X":
134139
1. Update the README.md with the day's entry (without being asked)
135140
2. Create a new branch for the day's solution
136141
3. Create a pull request for the day's work
137-
4. **MANDATORY**: Wait 5 minutes for CodeRabbit and CI checks to complete
142+
4. **MANDATORY**: Wait 3 minutes for CodeRabbit and CI checks to complete
138143
5. **MANDATORY**: Address all PR feedback (fix failures, implement suggestions)
139144
6. **MANDATORY**: After fixes are pushed and CI passes, MERGE THE PR using `gh pr merge --squash --delete-branch`
140145

@@ -144,14 +149,14 @@ When AOC_SESSION_COOKIE is set and user says "Let's do day X":
144149
## Pull request interaction
145150
The repo has CodeRabbit installed, which will review PRs and suggest improvements.
146151
After creating a PR, you MUST:
147-
1. **Wait 5 minutes** to allow CodeRabbit and other CI checks to complete
152+
1. **Wait 3 minutes** to allow CodeRabbit and other CI checks to complete
148153
2. **Check for PR comments** using `gh pr view <PR_NUMBER> --comments`
149154
3. **Check build status** using `gh pr view <PR_NUMBER> --json statusCheckRollup`
150155
4. **Address ALL actionable comments** and fix any failing builds
151156
5. **Commit and push improvements** once implemented
152157
6. **Update your TodoList** to track PR feedback resolution
153158
7. **CRITICAL**: Before merging, ensure ALL CI checks pass (validate and test workflows)
154-
8. **Wait for another 5 minutes after final changes** to ensure CI checks complete
159+
8. **Wait for another 3 minutes after final changes** to ensure CI checks complete
155160
9. **Only merge when ALL builds are green** - never merge with failing builds
156161

157162
**IMPORTANT**: This is NOT optional - every PR must have its feedback addressed AND all builds passing before the day is considered complete.
@@ -166,4 +171,38 @@ The validation CI workflow checks puzzle.txt files for specific formatting requi
166171
4. **Last line**: Must be exactly "Both parts of this puzzle are complete! They provide two gold stars: **"
167172
5. **Line endings**: Use Unix line endings (LF) not Windows (CRLF) to ensure validation passes
168173

169-
**CRITICAL**: If validation fails, check the puzzle.txt format and ensure the completion footer is added correctly.
174+
**CRITICAL**: If validation fails, check the puzzle.txt format and ensure the completion footer is added correctly.
175+
176+
## Tool Usage Guidelines
177+
- **TodoWrite**: Use proactively for complex multi-step tasks (3+ steps) to track progress and demonstrate thoroughness
178+
- **Task**: Use for open-ended searches requiring multiple rounds of file operations
179+
- **Read/Edit**: Prefer for specific file operations over Task tool when you know the exact files
180+
- **Batch operations**: Use multiple tool calls in single message for better performance
181+
182+
## Error Handling & Recovery
183+
Common issues and solutions:
184+
- **CI failures**: Wait for builds to complete, check logs, fix validation issues first
185+
- **Submission errors**: Verify answer format (no spaces, correct type), check for off-by-one errors
186+
- **Network timeouts**: Retry operations, use shorter timeout values for testing
187+
- **Git conflicts**: Pull latest changes, resolve conflicts, recommit changes
188+
- **Performance issues**: Add early termination, use efficient algorithms (BFS vs DFS), consider problem constraints
189+
190+
## Common Problem Patterns & Solutions
191+
Based on Advent of Code 2024 experience:
192+
- **Grid traversal**: Use coordinate systems, direction vectors, boundary checking
193+
- **Path finding**: BFS for shortest path, DFS for all paths, A* for heuristic search
194+
- **Graph problems**: Build adjacency lists, use visited sets, consider bidirectional search
195+
- **Parsing**: Split input carefully, handle edge cases, validate assumptions
196+
- **Mathematics**: Look for patterns, use modular arithmetic, consider mathematical properties
197+
- **Optimization**: Branch and bound, greedy algorithms, dynamic programming
198+
- **Simulation**: Step-by-step execution, state tracking, cycle detection
199+
200+
## Success Metrics
201+
A day is considered successfully completed when:
202+
1. Both parts produce correct answers
203+
2. Code is clean, readable, and well-commented
204+
3. All tests pass
205+
4. CI builds are green (validate + test workflows)
206+
5. PR has been created, reviewed, and merged
207+
6. README is updated with the day's entry
208+
7. All CodeRabbit feedback has been addressed

0 commit comments

Comments
 (0)