Initial commit
This commit is contained in:
93
commands/tcr-log-failure.md
Normal file
93
commands/tcr-log-failure.md
Normal file
@@ -0,0 +1,93 @@
|
||||
---
|
||||
description: Document a TCR failure to build pattern recognition and learning
|
||||
---
|
||||
|
||||
# Log TCR Failure
|
||||
|
||||
Document what you tried, why it failed, and what you learned when TCR reverts your code.
|
||||
|
||||
## Purpose
|
||||
|
||||
Every TCR revert is a teaching moment. Documenting failures helps you:
|
||||
- Calibrate step sizes
|
||||
- Recognize patterns in what fails
|
||||
- Build confidence in what's safe
|
||||
- Track fatigue-related failures
|
||||
- Learn your personal coding patterns
|
||||
|
||||
## Usage
|
||||
|
||||
When TCR reverts your code, immediately document:
|
||||
|
||||
1. **What you tried** - Describe the change you attempted
|
||||
2. **Why it failed** - What test broke or error occurred
|
||||
3. **What you learned** - Pattern or insight gained
|
||||
4. **Next step** - How you'll break it down smaller
|
||||
|
||||
## Log File
|
||||
|
||||
Creates or appends to `TCR-LEARNINGS.md` in current directory.
|
||||
|
||||
## Template
|
||||
|
||||
```markdown
|
||||
## [Date] [Time] - [Brief description]
|
||||
|
||||
**What I tried:** [The change you attempted]
|
||||
|
||||
**Why it failed:** [Test failure, error message, or behavior]
|
||||
|
||||
**What I learned:** [Pattern or insight]
|
||||
|
||||
**Next time:** [How to avoid or what to do differently]
|
||||
|
||||
**Step size:** Too big | Just right but timing wrong | Other: [explain]
|
||||
|
||||
**Time of day:** [Morning/Afternoon/Evening - track fatigue patterns]
|
||||
|
||||
---
|
||||
```
|
||||
|
||||
## Example
|
||||
|
||||
```markdown
|
||||
## 2025-01-20 14:30 - Extract validation and rename together
|
||||
|
||||
**What I tried:** Extract email validation to helper function AND rename emailAddr to email
|
||||
|
||||
**Why it failed:** Tests failed because they expected old variable name in error messages
|
||||
|
||||
**What I learned:** Extract and rename are two separate steps, even if they feel related
|
||||
|
||||
**Next time:**
|
||||
1. Extract with existing names first
|
||||
2. Verify tests pass
|
||||
3. THEN rename in a second TCR cycle
|
||||
|
||||
**Step size:** Too big - combined two logical changes
|
||||
|
||||
**Time of day:** Early afternoon (2:30pm) - moderate fatigue
|
||||
|
||||
**Pattern:** This is the 3rd time I've failed combining extract + rename. Need to internalize this!
|
||||
|
||||
---
|
||||
```
|
||||
|
||||
## Auto-Generation
|
||||
|
||||
If `$ARGUMENTS` provided, use as brief description. Otherwise, prompt for:
|
||||
- What you tried
|
||||
- Why it failed
|
||||
- What you learned
|
||||
|
||||
Then append to `TCR-LEARNINGS.md` with template filled in.
|
||||
|
||||
## Review Your Log
|
||||
|
||||
Periodically review your `TCR-LEARNINGS.md` to:
|
||||
- Identify recurring failure patterns
|
||||
- Calibrate your step sizes
|
||||
- Recognize fatigue indicators
|
||||
- Build confidence in safe changes
|
||||
|
||||
Execute the logging and confirm the entry was added to the file.
|
||||
72
commands/tcr-setup.md
Normal file
72
commands/tcr-setup.md
Normal file
@@ -0,0 +1,72 @@
|
||||
---
|
||||
description: Set up TCR (Test && Commit || Revert) for the current project
|
||||
---
|
||||
|
||||
# TCR Setup
|
||||
|
||||
Set up TCR (Test && Commit || Revert) for practicing baby-step programming.
|
||||
|
||||
## Steps
|
||||
|
||||
1. Ensure git is initialized:
|
||||
```bash
|
||||
git init
|
||||
```
|
||||
|
||||
2. Create a TCR script:
|
||||
```bash
|
||||
cat > tcr.sh << 'EOF'
|
||||
#!/bin/bash
|
||||
# TCR: Test && Commit || Revert
|
||||
|
||||
# Replace with your actual test command
|
||||
TEST_CMD="go test -v ./... || npm test"
|
||||
|
||||
echo "Running TCR..."
|
||||
if $TEST_CMD; then
|
||||
git add -A
|
||||
git commit -m "TCR $(date +%H:%M:%S)"
|
||||
echo "✅ Tests passed - Changes committed"
|
||||
else
|
||||
git restore .
|
||||
echo "❌ Tests failed - Changes reverted"
|
||||
fi
|
||||
EOF
|
||||
|
||||
chmod +x tcr.sh
|
||||
```
|
||||
|
||||
3. Test it:
|
||||
```bash
|
||||
./tcr.sh
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
After making a tiny code change:
|
||||
```bash
|
||||
./tcr.sh
|
||||
```
|
||||
|
||||
- If tests pass → Changes automatically committed
|
||||
- If tests fail → Changes automatically reverted
|
||||
|
||||
## Tips
|
||||
|
||||
- Start with refactoring only (not new features)
|
||||
- Make the smallest possible changes
|
||||
- When you get stuck (keep reverting), take a break
|
||||
- Don't cheat with CTRL+Z to recover reverted code
|
||||
|
||||
## Advanced: Watch Mode
|
||||
|
||||
Auto-run TCR on file changes:
|
||||
```bash
|
||||
# macOS with fswatch
|
||||
fswatch -o src/ test/ | xargs -n1 -I{} ./tcr.sh
|
||||
|
||||
# Linux with inotifywait
|
||||
while inotifywait -r -e modify src/ test/; do ./tcr.sh; done
|
||||
```
|
||||
|
||||
Ask which test command to use, then create the TCR script and explain how to use it.
|
||||
Reference in New Issue
Block a user