auto-resource-lifecycle
Installation
SKILL.md
Resource Lifecycle — What Claude Gets Wrong
You open resources and close them on the happy path. Then an error occurs between open and close, and the resource leaks. You do this in every language, every time.
The Iron Rule
Every resource acquisition must have a paired release in a construct that guarantees execution regardless of control flow.
| Language | Guaranteed Cleanup |
|---|---|
| Rust | Drop trait (RAII) — compiler enforces it |
| Python | with statement (context managers) |
| TypeScript/JS | try/finally, using (TC39 Stage 3) |
| Go | defer |
| Java | try-with-resources |
If you're manually calling .close() or .dispose() in a non-finally/non-Drop path, it's a bug.