engremran07/gsmvault/alp-component-lifecycle

Claude Code and agent skill by engremran07/gsmvault

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Component lifecycle: init(), destroy(). Use when: setting up timers/intervals on mount, cleaning up event listeners, running initialization logic when component appears.

Install

npx vskill@latest install engremran07/gsmvault/alp-component-lifecycle

SKILL.md

The same SKILL.md was published earlier as engremran07/gsmvault/alp-component-lifecycle.

Alpine Component Lifecycle

When to Use

  • Running setup logic when a component initializes (fetch data, start timers)
  • Cleaning up resources when a component is removed from DOM
  • Registering/deregistering global event listeners tied to a component's lifetime

Patterns

init() — Runs on Component Mount
html
<div x-data="{
count: 0,
init() {
console.log('Component mounted');
this.count = parseInt(this.$el.dataset.initial || '0');
}
}" data-initial="{{ initial_count }}">
<span x-text="count"></span>
</div>
destroy() — Cleanup on Removal
html
<div x-data="{
intervalId: null,
elapsed: 0,
init() {
this.intervalId = setInterval(() => { this.elapsed++; }, 1000);
},
destroy() {
if (this.intervalId) clearInterval(this.intervalId);
}
}">
<span x-text="elapsed + 's'"></span>
</div>
Async Init with Fetch
html
<div x-data="{
items: [],
loading: true,
async init() {
try {
const res = await fetch('/api/v1/devices/recent/');
if (res.ok) this.items = await res.json();
} finally {
this.loading = false;
}
}
}">
<div x-show="loading" x-cloak>Loading...</div>
<template x-for="item in items" :key="item.id">
<div x-text="item.name"></div>
</template>
</div>
Global Listener with Cleanup
html
<div x-data="{
handler: null,
init() {
this.handler = (e) => { /* handle resize */ };
window.addEventListener('resize', this.handler);
},
destroy() {
window.removeEventListener('resize', this.handler);
}
}">
<!-- component content -->
</div>

Anti-Patterns

PatternProblemFix
setInterval without destroy() cleanupMemory leak, ghost timersAlways clear in destroy()
addEventListener without removeEventListenerLeaked listeners accumulateStore handler ref, remove in destroy()
Heavy sync work in init()Blocks renderingUse async init() or $nextTick
Using x-init AND init() method togetherDouble initializationPick one — init() method preferred

Red Flags

  • setInterval or setTimeout without corresponding cleanup in destroy()
  • Global event listeners added in init() without removal
  • Fetch calls in init() without loading/error states

Quality Gate

powershell
& .\.venv\Scripts\python.exe -m ruff check . --fix
& .\.venv\Scripts\python.exe -m ruff format .
& .\.venv\Scripts\python.exe manage.py check --settings=app.settings_dev

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
5

Refreshed 8 Oct 2026, a month ago.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/engremran07/gsmvault/alp-component-lifecycle/badge)](https://verified-skill.com/skills/engremran07/gsmvault/alp-component-lifecycle)

Something wrong with this skill or its page? Tell us.