| name | loose-ends |
| description | Before declaring work complete, checks for loose ends: unused imports, TODO
comments created, missing tests, stale references, incomplete error handling.
Activates after implementing features or fixes. The cleanup that always gets
skipped.
|
| allowed-tools | bash: grep, git, python
file: read
scripts: sweep.py
|
Loose Ends
Implementation feels done, but loose ends remain. The import you added but didn't
use. The TODO you wrote and forgot. The test you meant to add. The console.log
you left in. This skill forces a sweep before declaring victory.
When To Activate
- About to say "done" or "complete"
- Finishing a feature implementation
- After fixing a bug
- Before committing changes
- After any multi-file change
- User asks "is it ready?"
Instructions
The Loose Ends Checklist
Before declaring complete, run through:
## Loose Ends Sweep
Code Hygiene
TODOs and FIXMEs
Tests
Types (if applicable)
References
Error Handling
Automated Sweep
Run the sweep script to find common cruft:
python scripts/sweep.py
Scans for:
console.log, print(), debugger statements
TODO, FIXME, XXX, HACK comments
dd(), var_dump(), binding.pry (PHP/Ruby)
Quick Scan Commands
git diff --name-only | xargs grep -n "TODO\|FIXME"
git diff --name-only | xargs grep -n "console.log"
npx tsc --noEmit 2>&1 | grep "declared but"
git diff | grep ": any"
Prioritize by Impact
Not all loose ends are equal:
| Priority | Type | Action |
|---|
| Fix now | Broken imports, missing exports | Blocks functionality |
| Fix now | console.log in production code | Leaks info |
| Should fix | Unused imports/variables | Code smell |
| Should fix | Missing tests for new logic | Technical debt |
| Note for later | Old TODOs in touched files | Existing debt |
| Ignore | Style inconsistencies | Not your scope |
Output Format
## Loose Ends Check
**Files changed:** [count]
**Fixed:**
- [x] Removed unused import in `file.ts`
- [x] Removed console.log in `handler.ts`
**Noted:**
- [ ] `utils.ts:45` has existing TODO (not from this change)
**Clean:** No loose ends found / All addressed
NEVER
- Declare "done" without scanning for loose ends
- Leave console.log in production code
- Create TODOs and forget about them
- Leave unused imports from experimentation
- Skip the checklist because "it's a small change"
ALWAYS
- Scan changed files before committing
- Remove debugging artifacts
- Address or document any TODOs you create
- Verify imports are used
- Check that tests pass after changes
Example
After implementing a new API endpoint:
## Loose Ends Check
**Files changed:** 4
**Scanning...**
`api/users.ts`:
- Line 3: unused import `lodash` → Removed
- Line 45: console.log for debugging → Removed
`types/user.ts`:
- Clean
`tests/users.test.ts`:
- New endpoint has test → Good
- Edge case (empty input) not tested → Added
`services/user.ts`:
- Line 23: TODO I wrote: "validate email format" → Addressed now
**Result:** 4 loose ends found and fixed. Ready to commit.