Skip to main content
skill CX Codex

m12-lifecycle — Claude Code skill: lifecycle and install

Helps design Rust resource lifecycles, from creation and scope to cleanup and error handling. Useful for connections, transactions, guards, and lazy initialization.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add actionbook/rust-skills --skill m12-lifecycle -a claude-code
Open on GitHub

What m12-lifecycle does

This skill helps choose how a Rust resource should be created, owned, used, and cleaned up. It maps RAII to Drop, deferred creation to OnceLock and LazyLock, expensive resource reuse to r2d2 or deadpool, and scoped access to the MutexGuard pattern.

It includes design questions about scope and cleanup ownership, lifecycle event tables, RAII guard and lazy singleton templates, plus common failures such as leaks, double free, E0509, and pool exhaustion. Related paths connect the decisions to m02-resource, m03-mutability, m06-error-handling, and m07-concurrency.

When cleanup itself can fail, the skill points to an explicit close that returns Result, so that case deserves a separate design check before relying on Drop. For cleanup at scope exit, it uses Drop with an RAII wrapper.

What it helps with

  • choose a resource scope
  • design cleanup for error paths
  • set up lazy initialization
  • select a pool for costly connections
  • trace why a resource pool is exhausted

Example prompts for the agent

  • Design a Rust lifecycle for database connections, covering creation cost, scope, ownership, and cleanup on errors.
  • Compare Drop, OnceLock, LazyLock, and a connection pool for this resource, then recommend an implementation.
  • Inspect this resource leak and show where Drop should return the resource to the pool.

How to install m12-lifecycle

1Skills CLI (Vercel)

npx skills add actionbook/rust-skills --skill m12-lifecycle -a claude-code

2Manually: put the files in place

~/.claude/skills/m12-lifecycle/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/m12-lifecycle/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about m12-lifecycle

How do I install m12-lifecycle in Claude Code?

Run npx skills add actionbook/rust-skills --skill m12-lifecycle -a claude-code, then run the same command again: npx skills add actionbook/rust-skills --skill m12-lifecycle -a claude-code. The skill file is at ~/.claude/skills/m12-lifecycle/SKILL.md.

What does m12-lifecycle do?

It helps choose a Rust resource lifecycle pattern: RAII with Drop, lazy initialization, pooling, scoped guards, or transaction boundaries. It also covers cleanup on errors and common ownership mistakes.

Which Rust tools does it use for lazy initialization?

The skill covers OnceLock and LazyLock for deferred creation. Its related guidance connects OnceLock with thread-safe initialization and LazyLock with synchronization.

Similar skills

All skills for Programming languages →

From the same set35

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor