raii-sweep

Analyze C codebases for RAII lifecycle pairing and error-cleanup defects.

15|8|Updated Oct 8, 2024
One-click install
npx skills add https://github.com/yanet-platform/yanet2 --skill raii-sweep
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: raii-sweep
Source: https://github.com/yanet-platform/yanet2/tree/main/.claude/skills/raii-sweep
Command: npx skills add https://github.com/yanet-platform/yanet2 --skill raii-sweep

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Weekly RAII symmetry maintenance across a C codebase by enforcing strict lifecycle pairs (new, init, fini, free) and a single error-cleanup path to prevent leaks, double-frees, and fragility in lifecycle transitions.

Core Features & Use Cases

  • Four orthogonal primitives: new allocs the struct, init fills fields, fini releases fields safely, and free deallocates the struct.
  • Ledger-driven workflow: per-prefix tracking to ensure one PR per lifecycle family and avoid re-litigating fixed issues.
  • Phase-based scanning: enables naming and structural checks to surface defects and enforce idempotent cleanup.
  • Real-world application: suitable for yanet2's C codebase to repair and standardize RAII patterns.

Quick Start

Run the phase-1 scans to inventory lifecycles, review findings in the ledgers, and implement targeted fixes in separate worktrees.

Frequently Asked Questions about raii-sweep

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

FAQPage Schema
How do I enforce RAII lifecycle cleanup in C code to prevent memory leaks?

RAII lifecycle cleanup in C is enforced by automating strict pairing of new, init, fini, and free operations alongside a single error-cleanup path. This prevents leaks and double-frees by scanning codebases to ensure zero-init before errors and idempotent fini releases.

What is the best way to automate static analysis for C code lifecycle pairing?

Automating static analysis for C code lifecycle pairing is done through phase-based scanning that inventories lifecycles using a ledger workflow. This approach surfaces structural defects, enforcing idempotent cleanup and NULL-safe free operations across multi-file projects.

How do I manage RAII code refactoring across multiple files without re-litigating fixed issues?

RAII code refactoring across multiple files is managed using a ledger-driven workflow that tracks fixes per-prefix. This ensures one PR per lifecycle family and prevents re-litigating previously resolved issues by strictly limiting the remediation scope.

Does RAII lifecycle analysis work for large multi-file C codebases like yanet2?

RAII lifecycle analysis works for large multi-file C codebases like yanet2 by scanning core and peripheral modules. It identifies structural defects and prepares PR-ready fixes to standardize lifecycle patterns across the entire project.

Why do I need zero-init before error paths in C code RAII patterns?

Zero-init before error paths in C code RAII patterns is needed to ensure safe deallocation during cleanup. This practice guarantees that a single error-cleanup path can execute without accessing uninitialized fields or causing fragility.