lifecycle-management
Skill2 starsChanged 11 days agoMITView on GitHub
Manage application lifecycle, error handling, and resource cleanup to prevent memory leaks and ensure stability. Use this skill when handling startup/shutdown sequences, managing resource pools, implementing error boundaries, preventing memory leaks, or ensuring graceful degradation — even if they just say "clean up resources" or "fix the memory leak". Not for security-code-auditor.
In this repository63 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .agents/skills/avoid-ai-writing/AGENTS.mdAGENTS.md
- .agents/skills/do-web-doc-resolver/AGENTS.mdAGENTS.md
- .agents/skills/skill-evaluator/AGENTS.mdAGENTS.md
- scripts/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- llms-full.txtllms.txt
- llms.txtllms.txt
- accessibility-auditorSkill
- agent-browserSkill
- agentic-abstentionSkill
- agents-mdSkill
- api-design-firstSkill
- architecture-diagramSkill
- avoid-ai-writingSkill
- cicd-pipelineSkill
- cloudflare-worker-apiSkill
- codacySkill
- codeberg-apiSkill
- code-review-assistantSkill
- css-render-performanceSkill
- database-devopsSkill
- debuggerSkill
- delegateSkill
- dependency-upgradesSkill
- dist-channel-selectionSkill
- docs-hookSkill
- document-rendering-and-locatorsSkill
- dogfoodSkill
- dora-reportSkill
- do-web-doc-resolverSkill
- durable-objectsSkill
- eu-ai-act-complianceSkill
- git-github-workflowSkill
- goap-agentSkill
- implementerSkill
- intent-classifierSkill
- iterative-refinementSkill
- jules-delegatorSkill
- learnSkill
- local-context-sanitizationSkill
- memory-contextSkill
- migration-refactoringSkill
- nested-build-isolationSkill
- privacy-firstSkill
- progressive-deliverySkill
- pwa-offline-syncSkill
- reader-ui-uxSkill
- readme-best-practicesSkill
- secrets-managementSkill
- secure-invite-and-accessSkill
- security-code-auditorSkill
- shell-script-qualitySkill
- skill-creatorSkill
- skill-evaluatorSkill
- static-analysisSkill
- testing-strategySkill
- test-runnerSkill
- triz-solverSkill
- turso-dbSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 41
Call lifecycle.cleanupRoute() before navigating to cancel in-flight fetch requests via a global AbortController.
- Very specific: line 55
Use AbortController signal for all addEventListener calls where possible to automate cleanup.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
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 auditspwa-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. |
Red Flags
addEventListenerused without a correspondingremoveEventListenerorsignal.- No global error handling implementation.
- In-flight requests not cancelled during navigation or component unmounting.
Voice & Context
- Default:
professional+blog - Reference:
voice-profilesskill for definitions and auto-detection.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

