# M12 lifecycle

> M12 lifecycle is an open-source agent skill for developer tools. Guides Rust resource lifecycle design: Drop cleanup, lazy init, pools and guards. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/k1-c/linear-tui/tree/main/.claude/skills/m12-lifecycle
- **Repository:** https://github.com/k1-c/linear-tui
- **GitHub stars:** 21
- **License:** MIT
- **Skill name:** m12-lifecycle
- **Collection:** https://github.com/k1-c/linear-tui
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-02

## About

This skill is a design reference for deciding when a resource should be created, used and cleaned up. It walks the agent through questions about cost, scope and error behavior, then maps the chosen pattern to Rust mechanisms such as the Drop trait, OnceLock and LazyLock, connection pools like r2d2 and deadpool, MutexGuard-style scoped access and custom transaction structs.

The skill includes templates for an RAII guard that removes a temporary file on drop and a lazily initialized global config using OnceLock. It also lists common errors such as forgotten cleanup, leaked pool connections and moving fields out of a Drop type, with fixes for each, and points to related skills for ownership, concurrency and error handling.

It is a single instruction file with no scripts. It expects a Rust codebase and a design question about resources, and it does not run any tools itself.

## When your agent uses it

> Use when designing resource lifecycles. Keywords: RAII, Drop, resource lifecycle, connection pool, lazy initialization, connection pool design, resource cleanup patterns, cleanup, scope, OnceCell, Lazy, once_cell, OnceLock, transaction, session management, when is Drop called, cleanup on error, guard pattern, scope guard, 资源生命周期, 连接池, 惰性初始化, 资源清理, RAII 模式

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/k1-c/linear-tui/tree/HEAD/.claude/skills/m12-lifecycle)
- [License: MIT](https://github.com/k1-c/linear-tui/tree/HEAD/.claude/skills/m12-lifecycle)

## Features

- **Lifecycle decision checklist:** Guides the agent through resource cost, scope and error-handling questions before choosing a pattern.
- **RAII and Drop patterns:** Covers automatic cleanup with the Drop trait and scope guards for transactions.
- **Lazy initialization options:** Explains when to use OnceLock or LazyLock for deferred or global setup.
- **Connection pool guidance:** Names pooling crates such as r2d2 and deadpool and the pitfalls of unreturned connections.
- **Rust code templates:** Provides example RAII guard and lazy singleton implementations.
- **Common error reference:** Lists typical lifecycle bugs such as leaks, dangling references and E0509 with fixes.

## Good for

- Design cleanup behavior for a temporary file handle in Rust
- Choose between a connection pool and per-use connections
- Set up a lazily loaded global configuration
- Implement a transaction guard that rolls back on early return
- Diagnose a pool exhaustion or resource leak in Rust code

## Install

### Claude Code

Copy the skill folder to `~/.claude/skills/m12-lifecycle` to use it in all your projects:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/k1-c/linear-tui.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/m12-lifecycle &&
cp -R "$tmp/.claude/skills/m12-lifecycle" ~/.claude/skills/m12-lifecycle &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/m12-lifecycle` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/m12-lifecycle` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/k1-c/linear-tui.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/m12-lifecycle &&
cp -R "$tmp/.claude/skills/m12-lifecycle" ~/.agents/skills/m12-lifecycle &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/m12-lifecycle` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/m12-lifecycle` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/k1-c/linear-tui.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/m12-lifecycle &&
cp -R "$tmp/.claude/skills/m12-lifecycle" ~/.cursor/skills/m12-lifecycle &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/m12-lifecycle` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/k1-c/linear-tui.git --path .claude/skills/m12-lifecycle
```

Or copy the folder to `~/.gemini/skills/m12-lifecycle` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/m12-lifecycle`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/k1-c/linear-tui.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/m12-lifecycle &&
cp -R "$tmp/.claude/skills/m12-lifecycle" ~/.copilot/skills/m12-lifecycle &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/m12-lifecycle` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/k1-c/linear-tui.git
```

Then copy `linear-tui/.claude/skills/m12-lifecycle` into your agent's skills folder as `m12-lifecycle`. Agents that support SKILL.md read one folder per skill.

## FAQ

### What does M12 lifecycle need to run?

It is a single SKILL.md with no scripts or extra files. It assumes a Rust project and does not declare allowed tools.

### When does M12 lifecycle trigger?

It is meant for requests about designing resource lifecycles, including terms such as RAII, Drop, connection pools, lazy initialization and cleanup on error.

### Does M12 lifecycle change any files?

The skill itself only provides guidance and code patterns for the agent to apply; it does not run scripts.

### How do I install M12 lifecycle in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/m12-lifecycle to use it in all your projects, or to .claude/skills/m12-lifecycle in one project.

### Does M12 lifecycle run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use M12 lifecycle?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to M12 lifecycle?

The closest alternatives to M12 lifecycle are M11 ecosystem, M02 resource, M01 ownership, M06 error handling and M03 mutability.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [M11 ecosystem](https://ai-powered.com/skills/m11-ecosystem): M11 ecosystem is an open-source agent skill for developer tools.
- [M02 resource](https://ai-powered.com/skills/m02-resource): M02 resource is an open-source agent skill for developer tools.
- [M01 ownership](https://ai-powered.com/skills/m01-ownership): M01 ownership is an open-source agent skill for developer tools.
- [M06 error handling](https://ai-powered.com/skills/m06-error-handling): M06 error handling is an open-source agent skill for developer tools.
- [M03 mutability](https://ai-powered.com/skills/m03-mutability): M03 mutability is an open-source agent skill for developer tools.
- [M04 zero cost](https://ai-powered.com/skills/m04-zero-cost): M04 zero cost is an open-source agent skill for developer tools.
- [M07 concurrency](https://ai-powered.com/skills/m07-concurrency): M07 concurrency is an open-source agent skill for developer tools.
- [M15 anti pattern](https://ai-powered.com/skills/m15-anti-pattern): M15 anti pattern is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/m12-lifecycle
