Skip to content

Commit a5b5a2b

Browse files
committed
evalbuff: add patterns/task-completion-validation.md (fde408c)
1 parent 284bc04 commit a5b5a2b

File tree

2 files changed

+131
-0
lines changed

2 files changed

+131
-0
lines changed

AGENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,4 @@ Make an efficient learning agent that can do anything.
4343
- [`docs/agents-and-tools.md`](docs/agents-and-tools.md) — Agent system, shell shims, tool definitions
4444
- [`docs/patterns/handle-steps-generators.md`](docs/patterns/handle-steps-generators.md) — handleSteps generator patterns and spawn_agents tool calls
4545
- [docs/evalbuff/interpreting-task-prompts.md](docs/evalbuff/interpreting-task-prompts.md)
46+
- [docs/patterns/task-completion-validation.md](docs/patterns/task-completion-validation.md)
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
# Task Completion Validation Pattern
2+
3+
When implementing features, always validate whether the requested functionality already exists before making changes. Many tasks may already be complete or partially implemented.
4+
5+
## The Validation Process
6+
7+
### 1. Search for Existing Implementation
8+
9+
Before implementing any feature, search the codebase for existing implementations:
10+
11+
```bash
12+
# Search for relevant patterns
13+
code_search "pattern related to feature"
14+
# Check configuration files
15+
read_files ["config-file.js", "next.config.mjs"]
16+
```
17+
18+
### 2. Verify Implementation Completeness
19+
20+
When you find existing code, verify it matches the requirements:
21+
22+
- **Check the exact pattern**: Does `/b/:hash` match the requested route?
23+
- **Verify the destination**: Does `https://go.trybeluga.ai/:hash` match the target?
24+
- **Confirm the behavior**: Is `permanent: false` the correct redirect type?
25+
26+
### 3. Test the Implementation
27+
28+
If implementation exists, verify it works:
29+
30+
```bash
31+
# Look for existing tests
32+
code_search "test.*redirect.*b/"
33+
# Run relevant tests if they exist
34+
run_terminal_command "bun test path/to/redirect/tests"
35+
```
36+
37+
### 4. Communicate Task Status Clearly
38+
39+
Always provide explicit feedback about task completion:
40+
41+
**✅ When feature is already implemented:**
42+
```
43+
The redirect for /b/:hash is already implemented in next.config.mjs:
44+
45+
[show the relevant code]
46+
47+
This configuration:
48+
- Redirects /b/:hash to https://go.trybeluga.ai/:hash
49+
- Uses temporary redirects (permanent: false)
50+
- Preserves query parameters
51+
52+
No additional changes needed - the feature is complete!
53+
```
54+
55+
**✅ When making changes:**
56+
```
57+
I need to add the redirect configuration to next.config.mjs:
58+
59+
[show the changes being made]
60+
61+
This will enable the requested /b/:hash → go.trybeluga.ai functionality.
62+
```
63+
64+
## Common Scenarios
65+
66+
### Next.js Redirects
67+
68+
For Next.js redirect tasks, always check `next.config.mjs` first:
69+
70+
```javascript
71+
// Look for existing redirects() function
72+
async redirects() {
73+
return [
74+
{
75+
source: '/pattern',
76+
destination: 'https://target.com/pattern',
77+
permanent: false,
78+
},
79+
]
80+
}
81+
```
82+
83+
### API Routes
84+
85+
For API endpoint tasks, check existing route files:
86+
87+
```bash
88+
# Check if route already exists
89+
list_directory "src/app/api/target-path"
90+
read_files ["src/app/api/target-path/route.ts"]
91+
```
92+
93+
### Component Features
94+
95+
For UI feature tasks, search for existing components:
96+
97+
```bash
98+
code_search "component.*feature.*name"
99+
glob "**/*ComponentName*"
100+
```
101+
102+
## Anti-Patterns to Avoid
103+
104+
**Silent failure**: Making no changes without explanation
105+
**Duplicate implementation**: Adding code when it already exists
106+
**Incomplete verification**: Finding partial implementation but not checking if it's complete
107+
**No status communication**: Leaving the user unsure whether the task succeeded
108+
109+
## Test Validation
110+
111+
When tests exist for the feature:
112+
113+
1. **Read the test file** to understand expected behavior
114+
2. **Run the tests** to verify current implementation works
115+
3. **Report test results** as evidence of completion
116+
117+
Example from redirect tests:
118+
```typescript
119+
test('redirects to go.trybeluga.ai with the hash', async ({ request }) => {
120+
const response = await request.get('/b/test123', { maxRedirects: 0 })
121+
expect(response.status()).toBe(307)
122+
expect(response.headers()['location']).toBe('https://go.trybeluga.ai/test123')
123+
})
124+
```
125+
126+
If these tests exist and pass, the feature is confirmed working.
127+
128+
## Key Principle
129+
130+
**Always explicitly state whether a task is complete, incomplete, or already done.** Never leave the user guessing about the status of their request.

0 commit comments

Comments
 (0)