Skip to content
Agentmart
Submit a tool

audit-resource-leak

Sweep a codebase for resource-leak sites — acquired handles, connections, contexts, or locks with no guaranteed release on every path — and surface each as a…

Skill by krixon

IndexedMIT★ 1
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/krixon-audit-resource-leak

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Sweep a codebase for resource-leak sites — acquired handles, connections, contexts, or locks with no guaranteed release on every path — and surface each as a finding. Static-first, no leak detector required. Use when the user wants to find resource leaks, hunt unclosed handles or connections, check for missing with/defer/finally, or asks "what leaks?".

Use cases: security

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/audit-resource-leak

What's inside

Skill name
audit-resource-leak
Description
Sweep a codebase for resource-leak sites — acquired handles, connections, contexts, or locks with no guaranteed release on every path — and surface each as a finding. Static-first, no leak detector required. Use when the user wants to find resource leaks, hunt unclosed handles or connections, check for missing with/defer/finally, or asks "what leaks?".
License
MIT
Instructions
43 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Resource-Leak Audit

Find where the code **acquires a resource without guaranteeing its release on every path**, and surface each as a finding. Run the shared audit method in [../AUDIT-METHOD.md](../AUDIT-METHOD.md) with the lens, sub-dimensions, and dimension below.

The aim is *risk-weighted* leaks, not a raw list of every `open(` — target acquire sites whose leak compounds under load.

## Risk lens (step 1)

Find acquire sites — file handles, DB/network connections, contexts, locks, semaphores, OS handles, subprocesses — and rank by under-load exposure:

- **Hot paths** — request handlers, message consumers, anything per-request or per-event, where a leak per call exhausts the pool or fd limit fast.
- **Loops** — acquisition inside a loop or recursion multiplies a single missed release.
- **Long-lived processes** — daemons and workers where leaks accumulate instead of dying with a short-lived process.

## Current state: trace release on every path (step 2)

For each acquire site, confirm the resource is released on **every** path, not only the happy one. A close on success that an exception or early `return` skips is still a leak. Release counts as guaranteed when a context manager (`with`), `defer`, `finally`, `try`-with-resources, or RAII owns it — or when ownership transfers to a caller that closes it. A bare close call on the happy path does not. Where the language has no scope-guard idiom, trace the error and early-return paths by hand.

## Sub-dimensions to sweep (step 3)

- **File handles** — files, sockets, pipes, OS descriptors opened without a scope guard.
- **Connections** — DB, HTTP, or pool connections checked out but not returned on error.
- **Contexts / locks** — locks, semaphores, transactions, or contexts acquired without a guaranteed release, also risking deadlock.
- **Subprocesses / OS handles** — spawned processes, temp files, or handles never waited on or cleaned up.

Drop low-confidence noise — a handle the runtime reclaims immediately at scope exit, or one a guard already covers, is not a finding.

## Dimension (step 4)

- **Dimension** — `resource-leak` (the sub-dimension goes in the title/evidence, e.g. "DB connection leaked on error in …", "file handle unclosed on early return in …" — never as a new top-level dimension)
- **Suggested category** — `enhancement` (guarding an acquire site against a leak); a leak already exhausting a pool or fd limit in production is a `bug`
- **Where** — the acquire site's module / type / function
- **Evidence** — the resource acquired, the path that skips release, and the under-load exposure

## Handover

Per [../AUDIT-METHOD.md](../AUDIT-METHOD.md) → *Handover*.

- **artifact:** findings (in [../contracts/finding.md](../contracts/finding.md) shape)
- **default:** `capture` — dedups against open issues, culls, files survivors as `needs-triage`
- **alternatives:** stop (review the findings yourself first)

From krixon/skills, MIT.

More from krixon/skills

Signals

Stars
1
Forks
0
Open issues
11
Last commit (this folder)
Jun 7, 2026 (4 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from krixon

Cite this page

audit-resource-leak skill. Agent Mart. https://agentmart.dev/skills/krixon-audit-resource-leak (last updated 2026-10-24)