resource-leak-audit

Audit .NET code for IDisposable misuse and CTS lifecycle leaks.

Updated May 13, 2026
One-click install
npx skills add https://github.com/capitalexchange/bourse --skill resource-leak-audit
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: resource-leak-audit
Source: https://github.com/capitalexchange/bourse/tree/main/.agents/skills/resource-leak-audit
Command: npx skills add https://github.com/capitalexchange/bourse --skill resource-leak-audit

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Audit and identify resource-leak patterns in C#/.NET code, focusing on IDisposable/IAsyncDisposable misuse, CTS lifecycles, and related persistence issues that degrade runtime stability.

Core Features & Use Cases

  • Two-phase audit methodology with forward/backward searches and disposal-site checks to locate leaks across PR changes or full codebase.
  • Pattern-driven discovery guided by resource-management categories (CTS, buffer pools, event unsubscriptions, static leaks) to surface actionable findings.
  • Structured triage and risk assessment with clear ownership and remediation guidance for developers and reviewers.

Quick Start

Run the PR-mode audit to scan changed C# files for resource-leak patterns and begin remediation planning.

Frequently Asked Questions about resource-leak-audit

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I find IDisposable misuse and resource leaks in C# .NET code?▼

To find IDisposable misuse and resource leaks in C# .NET code, apply a two-phase audit methodology with forward and backward searches to locate disposal-site issues. This scan validates findings against disposal patterns across changed files or a full codebase.

What are common .NET resource leak patterns I should scan my codebase for?▼

Common .NET resource leak patterns include CancellationTokenSource lifecycle issues, buffer pool mismanagement, missing event unsubscriptions, and static leaks. A pattern-driven discovery audit surfaces these actionable findings for risk assessment and remediation.

How do I audit a pull request for CancellationTokenSource lifecycle issues?▼

To audit a pull request for CancellationTokenSource lifecycle issues, run a PR-mode audit to scan changed C# files. The workflow follows forward and backward analyses to locate CTS leaks and validates findings against disposal patterns.

Does this resource leak audit work on a full codebase or only changed PR files?▼

This resource leak audit works on both a full codebase and changed PR files. You can run the PR-mode audit to scan only changed C# files or apply the two-phase methodology across the entire project to locate IDisposable misuse.

How does the .NET resource leak audit validate findings before reporting?▼

The .NET resource leak audit validates findings by checking disposal-site patterns using forward and backward searches. This two-phase methodology ensures located IDisposable and CancellationTokenSource leaks are actionable before triage and risk assessment.

What's the best way to triage and fix .NET memory management leaks found in code?▼

The best way to triage and fix .NET memory management leaks is to use a structured triage and risk assessment workflow that provides clear ownership and remediation guidance for the identified IDisposable and CTS lifecycle issues.