lifecycle-management

lifecycle-management is a skill for Claude Code, Codex from d-o-hub/github-template-ai-agents. It costs 74 tokens per session (611 once invoked), scanned A, original, MIT.

A set of patterns for managing an application’s startup, shutdown, errors, cancelled requests, and event listeners. These areas affect whether an application stays stable and releases resources correctly.

In plain words
What is it for?
Use it when adding lifecycle handling, error boundaries, resource cleanup, request cancellation, or global handling for uncaught errors and rejected promises in a web application.
Why use it?
It helps prevent memory leaks, uncaught errors, and unfinished network work when users navigate or the application stops. It also describes graceful cleanup and error handling.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/d-o-hub/github-template-ai-agents/lifecycle-management
Any agent
npx skills add d-o-hub/github-template-ai-agents --skill lifecycle-management
Clone the repo
git clone --depth 1 https://github.com/d-o-hub/github-template-ai-agents

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for lifecycle-management

README.md
[![agentmods](https://agentmods.dev/badge/skills/d-o-hub/github-template-ai-agents/lifecycle-management.svg)](https://agentmods.dev/skills/d-o-hub/github-template-ai-agents/lifecycle-management)
Your own site
<a href="https://agentmods.dev/skills/d-o-hub/github-template-ai-agents/lifecycle-management"><img src="https://agentmods.dev/badge/skills/d-o-hub/github-template-ai-agents/lifecycle-management.svg" alt="Measured on agentmods" height="20"></a>
Per session 74 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 611 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00074 $0.00611
Opus 5 $0.00037 $0.00305
Sonnet 5 $0.00015 $0.00122
Haiku 4.5 $0.00007 $0.00061

Measured 5d ago against content hash 149638bfeadc, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

lifecycle-management scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.agents/skills/lifecycle-management/SKILL.md · 90 lines

How it starts

The opening of the file, as written. The whole thing — 90 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Lifecycle Management

Generic patterns for managing application lifecycle, specifically for web applications to prevent memory leaks and handle global errors.

When to Use

  • User asks to handle startup/shutdown sequences or manage resource pools
  • Need to implement error boundaries or prevent memory leaks
  • Even if they just say "clean up resources" or "fix the memory leak"

Patterns

Global Error Handler

initGlobalErrorHandling() MUST be called to catch uncaught exceptions and unhandled rejections.

function initGlobalErrorHandling() {
  window.addEventListener('error', (event) => {
    console.error('Uncaught exception:', event.error);
    // Add telemetry/reporting here
  });

  window.addEventListener('unhandledrejection', (event) => {
    console.error('Unhandled rejection:', event.reason);
    // Add telemetry/reporting here
  });
}

Route Cleanup

Call lifecycle.cleanupRoute() before navigating to cancel in-flight fetch requests via a global AbortController.

const lifecycle = {
  controller: new AbortController(),
  cleanupRoute() {
    this.controller.abort();
    this.controller = new AbortController();
  }
};

Event Listeners

Use AbortController signal for all addEventListener calls where possible to automate cleanup.

const controller = new AbortController();
const { signal } = controller;

// handleResize must be defined in your component or module
window.addEventListener('resize', handleResize, { signal });

// Later, to remove all listeners associated with this controller:
controller.abort();

See Also

  • security-code-auditor — Security audits
  • pwa-offline-sync — Service workers and caching

Rationalizations

Rationalization Reality
"It's just a small app, no leaks." Memory leaks accumulate over time and affect performance and stability even in small apps.
"I'll remove listeners manually." Manual removal is error-prone and often forgotten. AbortController is a cleaner, more robust pattern.

Read the full file on GitHub · 90 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 90 lines · 74 tokens per session scan A 149638bfeadc

Subscribe to this mod's changes

lifecycle-management is a skill published in the GitHub repository d-o-hub/github-template-ai-agents (2 stars, last pushed today), licensed MIT. It adds 74 tokens to every session and 611 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

code-review

Orchestrates code review by detecting the project language and architecture, then routing to the appropriate specialized review skill (code-review-go, code-review-typescript, code-review-python, code-review-php, code-review-architecture). Falls back to the generic checklist when no specific skill applies. Invoked when…

soulcodex/agentic · 80 tokens

static-code-analysis

Selects, configures, and integrates a static analysis tool for the project's language. Covers tool selection, rule configuration, CI integration, fixing existing violations, and pre-commit hook setup. Invoked when the user asks to add linting, set up static analysis, or configure a code quality tool.

soulcodex/agentic · 65 tokens

code-review-architecture

Architecture-focused code review covering hexagonal boundary violations, DDD anti-patterns, CQRS misuse, and microservices coupling issues. Applied in addition to the language-specific review skill when architecture markers are detected. Invoked when reviewing hexagonal architectures, DDD patterns, or microservices…

soulcodex/agentic · 63 tokens

code-review-go

Deep Go-specific code review covering goroutine lifecycle, data races, error wrapping, domain modeling, and interface design. Applied in addition to the generic code-review skill when Go code is detected. Invoked when reviewing Go PRs, Go code changes, or performing Go-specific quality checks.

soulcodex/agentic · 61 tokens

code-review-php

Deep PHP-specific code review covering strict types, PHPStan compliance, PSR standards, domain modeling, and ORM boundary violations. Applied in addition to the generic code-review skill when PHP code is detected. Invoked when reviewing PHP PRs, Symfony/Laravel changes, or performing PHP-specific quality checks.

soulcodex/agentic · 66 tokens

code-review-python

Deep Python-specific code review covering type annotations, async pitfalls, mutable defaults, threading safety, and domain modeling. Applied in addition to the generic code-review skill when Python code is detected. Invoked when reviewing Python PRs, Py changes, or performing Python-specific quality checks.

soulcodex/agentic · 59 tokens