ln-629-lifecycle-auditor
Checks bootstrap initialization, graceful shutdown, resource cleanup, signal handling, liveness/readiness probes. Use when auditing app lifecycle.
Best use case
ln-629-lifecycle-auditor is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Checks bootstrap initialization, graceful shutdown, resource cleanup, signal handling, liveness/readiness probes. Use when auditing app lifecycle.
Teams using ln-629-lifecycle-auditor should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/ln-629-lifecycle-auditor/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How ln-629-lifecycle-auditor Compares
| Feature / Agent | ln-629-lifecycle-auditor | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Checks bootstrap initialization, graceful shutdown, resource cleanup, signal handling, liveness/readiness probes. Use when auditing app lifecycle.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
> **Paths:** File paths (`shared/`, `references/`, `../ln-*`) are relative to skills repo root. If not found at CWD, locate this SKILL.md directory and go up one level for repo root. If `shared/` is missing, fetch files via WebFetch from `https://raw.githubusercontent.com/levnikolaevich/claude-code-skills/master/skills/{path}`.
# Lifecycle Auditor (L3 Worker)
**Type:** L3 Worker
Specialized worker auditing application lifecycle and entry points.
## Purpose & Scope
- **Worker in ln-620 coordinator pipeline**
- Audit **lifecycle** (Category 12: Medium Priority)
- Check bootstrap, shutdown, signal handling, probes
- Calculate compliance score (X/10)
## Inputs (from Coordinator)
**MANDATORY READ:** Load `shared/references/audit_worker_core_contract.md`.
Receives `contextStore` with tech stack, deployment type, codebase root, output_dir.
## Workflow
**MANDATORY READ:** Load `shared/references/two_layer_detection.md` for detection methodology.
1) Parse context + output_dir
2) Check lifecycle patterns (Layer 1: grep for SIGTERM, shutdown handlers, probes)
3) Analyze context per candidate (Layer 2):
- Bootstrap order: read main file -- trace actual init sequence, verify dependencies satisfied before use
- Graceful shutdown: read signal handlers -- do they actually close all resources? Or just log and exit?
- Resource cleanup: read shutdown handler -- are ALL opened resources (DB, Redis, queues) closed?
- Probes: check deployment config (Dockerfile, k8s manifests) -- is this containerized?
4) Collect confirmed findings
5) Calculate score
6) **Write Report:** Build full markdown report in memory per `shared/templates/audit_worker_report_template.md`, write to `{output_dir}/629-lifecycle.md` in single Write call
7) **Return Summary:** Return minimal summary to coordinator
## Audit Rules
### 1. Bootstrap Initialization Order
**Detection:**
- Check main/index file for initialization sequence
- Verify dependencies loaded before usage (DB before routes)
**Severity:**
- **HIGH:** Incorrect order causes startup failures
**Recommendation:** Initialize in correct order: config -> DB -> routes -> server
**Effort:** M (refactor startup)
### 2. Graceful Shutdown
**Detection:**
- Grep for `SIGTERM`, `SIGINT` handlers
- Check `process.on('SIGTERM')` (Node.js)
- Check `signal.Notify` (Go)
**Severity:**
- **HIGH:** No shutdown handler (abrupt termination)
**Recommendation:** Add SIGTERM handler, close connections gracefully
**Effort:** M (add shutdown logic)
### 3. Resource Cleanup on Exit
**Detection:**
- Check if DB connections closed on shutdown
- Verify file handles released
- Check worker threads stopped
**Severity:**
- **MEDIUM:** Resource leaks on shutdown
**Recommendation:** Close all resources in shutdown handler
**Effort:** S-M (add cleanup calls)
### 4. Signal Handling
**Detection:**
- Check handlers for SIGTERM, SIGINT, SIGHUP
- Verify proper signal propagation to child processes
**Severity:**
- **MEDIUM:** Missing signal handlers
**Recommendation:** Handle all standard signals
**Effort:** S (add signal handlers)
### 5. Liveness/Readiness Probes
**Detection (for containerized apps):**
- Check for `/live`, `/ready` endpoints
- Verify Kubernetes probe configuration
**Severity:**
- **MEDIUM:** No probes (Kubernetes can't detect health)
**Recommendation:** Add `/live` (is running) and `/ready` (ready for traffic)
**Effort:** S (add endpoints)
## Scoring Algorithm
**MANDATORY READ:** Load `shared/references/audit_worker_core_contract.md` and `shared/references/audit_scoring.md`.
## Output Format
**MANDATORY READ:** Load `shared/references/audit_worker_core_contract.md` and `shared/templates/audit_worker_report_template.md`.
If summaryArtifactPath is present, write JSON summary per shared/references/audit_summary_contract.md. Compact text output is fallback only.
Write report to `{output_dir}/629-lifecycle.md` with `category: "Lifecycle"` and checks: bootstrap_order, graceful_shutdown, resource_cleanup, signal_handling, probes.
Return summary per `shared/references/audit_summary_contract.md`.
Legacy compact text output is allowed only when `summaryArtifactPath` is absent:
```
Report written: .hex-skills/runtime-artifacts/runs/{run_id}/audit-report/629-lifecycle.md
Score: X.X/10 | Issues: N (C:N H:N M:N L:N)
```
## Reference Files
- **Audit output schema:** `shared/references/audit_output_schema.md`
## Critical Rules
**MANDATORY READ:** Load `shared/references/audit_worker_core_contract.md`.
- **Do not auto-fix:** Report only, lifecycle changes risk downtime
- **Deployment-aware:** Adapt probe checks to deployment type (Kubernetes = probes required, bare metal = optional)
- **Effort realism:** S = <1h, M = 1-4h, L = >4h
- **Exclusions:** Skip CLI tools and scripts (no long-running lifecycle), skip serverless functions (platform-managed lifecycle)
- **Initialization order matters:** Flag DB usage before DB init as HIGH regardless of context
## Definition of Done
**MANDATORY READ:** Load `shared/references/audit_worker_core_contract.md`.
- [ ] contextStore parsed (deployment type, output_dir)
- [ ] All 5 checks completed (bootstrap order, graceful shutdown, resource cleanup, signal handling, probes)
- [ ] Findings collected with severity, location, effort, recommendation
- [ ] Score calculated per `shared/references/audit_scoring.md`
- [ ] Report written to `{output_dir}/629-lifecycle.md` (atomic single Write call)
- [ ] Summary written per contract
---
**Version:** 3.0.0
**Last Updated:** 2025-12-23Related Skills
ln-654-resource-lifecycle-auditor
Checks session scope mismatch, missing cleanup, pool config, error path leaks, resource holding. Use when auditing resource lifecycle.
ln-653-runtime-performance-auditor
Checks blocking IO in async, unnecessary allocations, sync sleep, string concat in loops, redundant copies. Use when auditing runtime performance.
ln-652-transaction-correctness-auditor
Checks transaction scope, missing rollback handling, long-held transactions, trigger/notify interaction. Use when auditing transaction correctness.
ln-651-query-efficiency-auditor
Checks redundant fetches, N+1 loops, over-fetching, missing bulk operations, wrong caching scope. Use when auditing query efficiency.
ln-650-persistence-performance-auditor
Coordinates persistence and performance audit across queries, transactions, runtime, and resource lifecycle. Use when auditing data layer performance.
ln-647-env-config-auditor
Checks env var config sync, missing defaults, naming conventions, startup validation. Use when auditing environment configuration.
ln-646-project-structure-auditor
Checks file hygiene, ignore files, framework conventions, domain/layer organization, naming. Use when auditing project structure.
ln-644-dependency-graph-auditor
Builds dependency graph, detects cycles, validates boundary rules, calculates coupling metrics (Ca/Ce/I). Use when auditing dependency structure.
ln-643-api-contract-auditor
Checks layer leakage in method signatures, missing DTOs, entity leakage to API, inconsistent error contracts. Use when auditing API contracts.
ln-642-layer-boundary-auditor
Checks layer boundary violations, transaction boundaries, session ownership, cross-layer consistency. Use when auditing architecture layers.
ln-640-pattern-evolution-auditor
Audits architectural patterns against best practices, maintains patterns catalog with compliance scores. Use when auditing pattern evolution.
ln-637-test-structure-auditor
Checks test file organization, directory layout, test-to-source mapping, domain grouping, co-location. Use when auditing test structure.