|
| 1 | +# Task Type Identification: Implementation vs Documentation |
| 2 | + |
| 3 | +When given a task, correctly identify whether you're being asked to IMPLEMENT functionality or CREATE documentation. Don't assume a task is about documentation just because you found existing code. |
| 4 | + |
| 5 | +## The Problem |
| 6 | + |
| 7 | +Agents often misclassify implementation tasks as documentation tasks when they discover existing code that seems to match the requirements. This leads to: |
| 8 | +- Creating unnecessary documentation instead of implementing features |
| 9 | +- Claiming tasks are "already complete" without proper validation |
| 10 | +- Ignoring the actual user need (working functionality) |
| 11 | + |
| 12 | +## Task Classification Rules |
| 13 | + |
| 14 | +### Implementation Tasks (require code changes) |
| 15 | + |
| 16 | +Keywords that indicate implementation work: |
| 17 | +- "Add redirects for..." |
| 18 | +- "Implement feature X" |
| 19 | +- "Create endpoint that..." |
| 20 | +- "Make it so that when..." |
| 21 | +- "Fix the bug where..." |
| 22 | +- "Update the config to..." |
| 23 | + |
| 24 | +**Action required:** Write/modify code, test functionality, verify it works. |
| 25 | + |
| 26 | +### Documentation Tasks (require writing docs) |
| 27 | + |
| 28 | +Keywords that indicate documentation work: |
| 29 | +- "Document how to..." |
| 30 | +- "Write a guide for..." |
| 31 | +- "Create documentation explaining..." |
| 32 | +- "Add README section about..." |
| 33 | +- "Explain the architecture of..." |
| 34 | + |
| 35 | +**Action required:** Write markdown/text files, create examples, explain concepts. |
| 36 | + |
| 37 | +## When You Find Existing Code |
| 38 | + |
| 39 | +If you discover code that appears to implement the requested functionality: |
| 40 | + |
| 41 | +### 1. Verify It Actually Works |
| 42 | + |
| 43 | +```bash |
| 44 | +# For Next.js redirects, test the actual redirect |
| 45 | +curl -I http://localhost:3000/b/test123 |
| 46 | +# Should return 307/308 with Location header |
| 47 | + |
| 48 | +# For API endpoints, test the endpoint |
| 49 | +curl http://localhost:3000/api/endpoint |
| 50 | +# Should return expected response |
| 51 | + |
| 52 | +# For features, test the user flow |
| 53 | +# Navigate to the feature and verify it behaves as expected |
| 54 | +``` |
| 55 | + |
| 56 | +### 2. Check Configuration vs Runtime |
| 57 | + |
| 58 | +Just because code exists doesn't mean it's active: |
| 59 | +- **Next.js redirects:** Must be in `next.config.mjs` redirects() function AND server must be restarted |
| 60 | +- **API routes:** File must exist in correct location AND export correct HTTP methods |
| 61 | +- **Features:** Code must be imported/called from the right places |
| 62 | + |
| 63 | +### 3. Validate Against Requirements |
| 64 | + |
| 65 | +Even if code exists, check if it matches the exact requirements: |
| 66 | +- **Correct URL pattern:** `/b/:hash` vs `/b/:id` vs `/buffer/:hash` |
| 67 | +- **Correct destination:** `https://go.trybeluga.ai/:hash` vs other domains |
| 68 | +- **Correct behavior:** temporary vs permanent redirects, query parameter handling |
| 69 | + |
| 70 | +## Response Patterns |
| 71 | + |
| 72 | +### ✅ When Implementation Already Works |
| 73 | + |
| 74 | +``` |
| 75 | +I found the redirect configuration in next.config.mjs and tested it: |
| 76 | +
|
| 77 | +[show the existing code] |
| 78 | +
|
| 79 | +Testing confirms it works: |
| 80 | +$ curl -I http://localhost:3000/b/test123 |
| 81 | +HTTP/1.1 307 Temporary Redirect |
| 82 | +Location: https://go.trybeluga.ai/test123 |
| 83 | +
|
| 84 | +The feature is already implemented and functional. No changes needed. |
| 85 | +``` |
| 86 | + |
| 87 | +### ✅ When Implementation Exists But Doesn't Work |
| 88 | + |
| 89 | +``` |
| 90 | +I found redirect configuration in next.config.mjs, but testing shows it's not working: |
| 91 | +
|
| 92 | +[show the existing code] |
| 93 | +
|
| 94 | +Testing reveals the issue: |
| 95 | +$ curl -I http://localhost:3000/b/test123 |
| 96 | +HTTP/1.1 404 Not Found |
| 97 | +
|
| 98 | +The configuration looks correct but the server needs to be restarted. After restart: |
| 99 | +[show working test results] |
| 100 | +
|
| 101 | +The feature now works correctly. |
| 102 | +``` |
| 103 | + |
| 104 | +### ✅ When Implementation Is Missing |
| 105 | + |
| 106 | +``` |
| 107 | +I need to add the redirect configuration to next.config.mjs: |
| 108 | +
|
| 109 | +[show the changes being made] |
| 110 | +
|
| 111 | +This will redirect /b/:hash to https://go.trybeluga.ai/:hash as requested. |
| 112 | +``` |
| 113 | + |
| 114 | +## Anti-Patterns to Avoid |
| 115 | + |
| 116 | +❌ **Assuming task completion without testing:** |
| 117 | +``` |
| 118 | +"The redirect is already implemented in next.config.mjs. No changes needed." |
| 119 | +// Without actually testing if it works |
| 120 | +``` |
| 121 | + |
| 122 | +❌ **Creating documentation for implementation tasks:** |
| 123 | +``` |
| 124 | +// Task: "Add redirects for short URLs" |
| 125 | +// WRONG: Creating docs/patterns/redirect-patterns.md |
| 126 | +// RIGHT: Modifying next.config.mjs |
| 127 | +``` |
| 128 | + |
| 129 | +❌ **Confusing configuration with functionality:** |
| 130 | +``` |
| 131 | +// Code exists in config file ≠ feature works |
| 132 | +// Must test the actual user-facing behavior |
| 133 | +``` |
| 134 | + |
| 135 | +## Testing Implementation Tasks |
| 136 | + |
| 137 | +For common implementation types: |
| 138 | + |
| 139 | +**Web redirects:** |
| 140 | +```bash |
| 141 | +curl -I http://localhost:PORT/path |
| 142 | +# Check status code (307/308) and Location header |
| 143 | +``` |
| 144 | + |
| 145 | +**API endpoints:** |
| 146 | +```bash |
| 147 | +curl http://localhost:PORT/api/endpoint |
| 148 | +# Check response status and body |
| 149 | +``` |
| 150 | + |
| 151 | +**UI features:** |
| 152 | +```bash |
| 153 | +# Start dev server and manually test in browser |
| 154 | +# Or run existing test suite |
| 155 | +bun test path/to/feature.test.ts |
| 156 | +``` |
| 157 | + |
| 158 | +## Key Principle |
| 159 | + |
| 160 | +**Implementation tasks require working code, not documentation about code.** When you find existing code, your job is to verify it works and fix it if it doesn't, not to document how it should work. |
0 commit comments