[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M767791C1KRP2ZRW2Z73VZ5Q":3,"skill-same:01M767791C1KRP2ZRW2Z73VZ5Q":70},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":48,"commitSha":49,"skillDirectory":50,"forksCount":51,"repositoryHtmlUrl":52,"repositoryHomepageUrl":6,"ownerHtmlUrl":53,"ownerBlogUrl":6,"ownerDescription":54,"updatedAt":55,"install":56,"resources":69},"01M767791C1KRP2ZRW2Z73VZ5Q","system-lifecycle-designer",null,"Universal architectural methodology for designing granular, atomic, and sub-atomic lifecycles and end-to-end workflows for single functionality integrations across any domain (daemons, batch jobs, request transactions, resource pools). Provides patterns for deterministic identity, pre-commit validation, differential reconciliation, sticky leasing, state machines, transactional persistence, and closed-loop feedback.","mdnaimul22\u002Fhuman-skills","mdnaimul22","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F64520358?v=4","01M70FH95MH2H796Q01TYSFZ03","Naimul","01M70FH96798CQR4YHA13F17GA",3,"MIT","https:\u002F\u002Fgithub.com\u002Fmdnaimul22\u002Fhuman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fstorage\u002Fmy_skills\u002Fsystem-lifecycle-designer\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: \"system-lifecycle-designer\"\ndescription: \"Universal architectural methodology for designing granular, atomic, and sub-atomic lifecycles and end-to-end workflows for single functionality integrations across any domain (daemons, batch jobs, request transactions, resource pools). Provides patterns for deterministic identity, pre-commit validation, differential reconciliation, sticky leasing, state machines, transactional persistence, and closed-loop feedback.\"\nversion: \"2.0.0\"\nauthor: \"Human Skills Team\"\ntags: [\"lifecycle\", \"lifecycle_designer\", \"system-design\", \"state-machine\", \"architecture\", \"universal-workflow\", \"reconciliation\", \"resource-leasing\", \"atomic-persistence\", \"closed-loop\"]\ntrigger_patterns:\n  - \"lifecycle designer\"\n  - \"lifecycle design\"\n  - \"system-lifecycle-designer\"\n  - \"workflow design\"\n  - \"state machine design\"\n  - \"subatomic lifecycle\"\n  - \"atomic workflow\"\n  - \"reconciliation engine\"\n  - \"resource leasing\"\n  - \"daemon supervisor design\"\n  - \"batch job lifecycle\"\n---\n\n# Universal Feature Lifecycle & Workflow Design Methodology\n\n> *\"A software feature is not merely a function that executes; it is a state machine governing resources, identity, and invariants across time. True robustness begins at the sub-atomic lifecycle layer.\"*\n\n---\n\n## 1. Scope & Primary Directive\n\nThis skill does **NOT** design an entire generic application or high-level product MVP.  \nInstead, it provides the universal, domain-agnostic methodology to design the **complete, end-to-end atomic and sub-atomic lifecycle for any specific, isolated functionality integration** (e.g., daemon supervisor, worker pool, batch job pipeline, database transaction context, autonomous connection pool, cache manager, or rate-limited service client).\n\nWhenever an AI agent or software engineer is tasked with architecting, documenting, or reviewing a single functionality workflow, they must apply the **7 Invariant Pillars** and select the appropriate **Domain Archetype Profile** defined here.\n\n---\n\n## 2. Leverage the `human-skills` Gateway\n\nBefore designing or implementing, consult specialized capabilities within the `human-skills` ecosystem:\n\n| Skill \u002F Tool | Namespace | Purpose in Lifecycle Design |\n| :--- | :--- | :--- |\n| **`human-skills`** | Gateway | Master dispatcher to inspect available capabilities before assuming or improvising. |\n| **`writing-plans`** | `obra_superpowers` | Structuring execution plans with exact file paths, test-driven steps, and zero placeholders. |\n| **`test-driven-development`** | `obra_superpowers` | Formulating failing state transition and boundary tests prior to implementation. |\n| **`linter`** | `my_skills` | AST-based architectural auditor to ensure unidirectional imports, sandboxing, and zero forbidden patterns. |\n| **`mermaid_view`** | `my_skills` | Validating and rendering workflow and state-machine Mermaid diagrams. |\n\n```bash\n# Verify skills or inspect tools\nhuman-skills --skill_info writing-plans\nhuman-skills --tool_info linter\n```\n\n---\n\n## 3. The 7 Universal Invariant Pillars\n\nEvery functionality integration must explicitly answer and architect these 7 dimensions, regardless of domain:\n\n```mermaid\nflowchart TD\n    P1[\"1. Canonical Identity\\n(Deterministic Content Hashing)\"] --> P2[\"2. Pre-Commit Boundary Defense\\n(Staging Sandbox & Invariant Audit)\"]\n    P2 --> P3[\"3. Differential State Reconciliation\\n(Candidate vs Active State Diff)\"]\n    P3 --> P4[\"4. Resource Leasing & Capacity Bounds\\n(Sticky Allocation & Autonomous Pooling)\"]\n    P4 --> P5[\"5. Archetype State Machine\\n(Complete Lifecycle Transitions)\"]\n    P5 --> P6[\"6. Transactional Persistence\\n(Atomic Commit & Split-Brain Defense)\"]\n    P6 --> P7[\"7. Closed-Loop Bidirectional Feedback\\n(Consumer to Orchestrator Signals)\"]\n```\n\n---\n\n### Pillar 1: Canonical Identity & Deterministic Fingerprinting\n- **The Anti-Pattern:** Using arbitrary runtime auto-increment IDs, random UUIDs, or unstable mutable labels to identify managed entities.\n- **The Universal Standard:** Compute a deterministic SHA-256 fingerprint from the entity's immutable, normalized payload or configuration parameters:\n  $$\\text{Fingerprint} = \\text{SHA256}(\\text{CanonicalJSON}(\\text{NormalizedImmutableAttributes}))$$\n- **Guarantee:** \n  - Guarantees strict idempotency across restarts and repeated ingestion cycles.\n  - Eliminates duplicate entities masquerading under different aliases, labels, or routing handles.\n\n---\n\n### Pillar 2: Pre-Commit Boundary Defense & Staging Sandbox\n- **The Anti-Pattern:** Blindly writing raw input or newly spawned configurations directly into live production stores, runtime memory pools, or active pipelines.\n- **The Universal Standard:** Validate the candidate entity completely **before** it touches live operational state:\n  - **Schema & Invariant Check:** Strict Pydantic\u002Ftype validation with zero-fallback Tony Hoare boundary defense.\n  - **Dry-Run \u002F Syntax Audit:** If the entity produces executable configs, scripts, or external specs, invoke an offline dry-run validation pass against an isolated `.tmp` buffer.\n  - **Resource Pre-Check:** Verify resource availability (memory, ports, worker quota, disk space) before committing state.\n- **Guarantee:** Invalid or corrupt configurations fail fast in isolation; active production execution is never halted by unverified inputs.\n\n---\n\n### Pillar 3: Differential State Reconciliation\n- **The Anti-Pattern:** Destructive full overwrites on every sync cycle (tearing down the entire active pool and rebuilding from scratch), or concurrent reconciliation passes causing split-brain states.\n- **The Universal Standard:** Compute set-theoretic differential state between Candidate Ingestion ($C$) and Active State ($A$):\n  - **Concurrency Guard:** Enforce a non-reentrant state lock or optimistic concurrency control via monotonic version tags (`generation_id += 1`).\n  - **Unchanged ($C \\cap A$):** Retain entity and existing operational leases without interruption or connection drop.\n  - **Added ($C \\setminus A$):** Allocate required resource leases, stage in sandbox, and promote to active.\n  - **Modified ($C \\cap A$ with mutated payload):** Perform in-place hot-patch if supported; otherwise, execute a seamless blue-green rollover.\n  - **Missing ($A \\setminus C$):** Never terminate abruptly! Gracefully drain in-flight operations before releasing resources.\n\n---\n\n### Pillar 4: Resource Leasing, Quotas & Autonomous Pooling\n- **The Anti-Pattern:** Unbounded allocation, volatile index-based slot assignment (`index + base`), or synchronous on-demand fetching inside hot caller loops causing latency spikes.\n- **The Universal Standard:**\n  - **Explicit Resource Leases:** Any scarce or shared resource (ports, GPU memory, worker threads, DB connections, rate tokens) must be managed through an explicit `LeaseManager` that issues unique, tracked lease tokens.\n  - **Autonomous Pre-Warming (High-Latency Dependencies):**\n    When upstream dependency provisioning introduces high latency (>1-2s), synchronous on-demand allocation inside user requests is strictly forbidden.\n    - Maintain an autonomous background worker maintaining target warm capacity:\n      $$N_{\\text{target}} = \\text{Peak Concurrency} \\times \\text{Safety Factor}$$\n    - When available warm items drop below replenishment threshold ($T_{\\text{replenish}}$), asynchronously replenish without blocking active consumers.\n    - **TTL & Expiration Defense:** Prune stale entities according to proactive expiration buffers ($t_{\\text{expiry}} - \\Delta t_{\\text{safety}}$).\n\n---\n\n### Pillar 5: Archetype State Machine Topologies\n\nDo not force a single monolithic state machine onto every project. Select the appropriate **Archetype Profile** based on the entity's operational lifecycle:\n\n```mermaid\nflowchart TD\n    Entity[\"Entity Assessment\"] --> Decision{\"What is the entity's operational nature?\"}\n    Decision -->|\"Long-Running Daemon \u002F Process Pool\"| ArchA[\"Archetype A: Managed Supervisor Pool\"]\n    Decision -->|\"Discrete Batch Job \u002F Task\"| ArchB[\"Archetype B: Finite Batch Pipeline\"]\n    Decision -->|\"Scoped Request \u002F Transaction\"| ArchC[\"Archetype C: Request\u002FTransaction Context\"]\n    Decision -->|\"Recyclable Resource \u002F Connection\"| ArchD[\"Archetype D: Resource Pool Entity\"]\n```\n\n#### Archetype A: Managed Supervisor Pool (Long-running Services & Daemons)\nDesigned for managed processes, proxy daemons, background workers, and persistent connections:\n```mermaid\nstateDiagram-v2\n    [*] --> Ingested\n    Ingested --> Staged: Fingerprint & Validate\n    Staged --> Active: Bound & Healthy\n    Active --> Degraded: Health Check Warning\n    Degraded --> Active: Health Restored\n    Degraded --> Quarantined: Threshold Breached\n    Active --> Draining: Upstream Deregistration\n    Quarantined --> Draining: Quarantine Timeout\n    state Draining {\n        [*] --> RejectNew\n        RejectNew --> WaitInFlight\n        WaitInFlight --> DrainComplete\n    }\n    Draining --> Tombstone: In-flight == 0 \u002F Deadline Reached\n    Tombstone --> Purged: Tombstone TTL Expired\n    Purged --> [*]: Lease Recycled\n```\n\n#### Archetype B: Finite Batch Pipeline (Jobs, Tasks & Transformations)\nDesigned for discrete work units, ETL tasks, video transcode jobs, and async commands:\n```mermaid\nstateDiagram-v2\n    [*] --> Submitted: Enqueued\n    Submitted --> Validated: Payload & Quota Checked\n    Validated --> Queued: Awaiting Worker Slot\n    Queued --> Running: Worker Acquired\n    Running --> Completed: Execution Success\n    Running --> Failed: Unrecoverable Error\n    Running --> Cancelled: Explicit Abort\n    Failed --> Retrying: Retry Policy Eligible\n    Retrying --> Queued: Exponential Backoff\n    Completed --> Archived: Retained Output Stored\n    Failed --> Archived: Error Log Stored\n    Cancelled --> Archived: Partial Cleanup\n    Archived --> [*]\n```\n\n#### Archetype C: Request \u002F Transaction Context (APIs & Atomic Mutations)\nDesigned for HTTP requests, RPC calls, database units-of-work, and interactive operations:\n```mermaid\nstateDiagram-v2\n    [*] --> Received: Input Arrival\n    Received --> Authenticated: Identity Verified\n    Authenticated --> Validated: Schema & Invariants Passed\n    Validated --> Processing: Unit of Work Active\n    Processing --> Committed: Invariant Success\n    Processing --> RolledBack: Invariant or System Error\n    Committed --> Responded: Success Payload Sent\n    RolledBack --> Responded: Error Payload Sent\n    Responded --> [*]: Scope Terminated\n```\n\n#### Archetype D: Resource Pool Entity (Connections, Buffers, Tokens)\nDesigned for database connection pools, memory buffers, pre-warmed sessions, and tokens:\n```mermaid\nstateDiagram-v2\n    [*] --> Initializing: Allocation\n    Initializing --> Available: Health Verified\n    Available --> Leased: Checked Out by Caller\n    Leased --> InUse: Work Underway\n    InUse --> Returning: Work Finished\n    Returning --> Available: Sanitized & Healthy\n    Returning --> Evicted: Unhealthy \u002F Stale\n    Available --> Evicted: Idle TTL Expired\n    Evicted --> Destroyed: Resources Released\n    Destroyed --> [*]\n```\n\n---\n\n### Pillar 6: Transactional Persistence & Split-Brain Defense\n- **The Anti-Pattern:** Sequential writes across multiple independent files. If the process crashes or disk fills after writing File A but before writing File B, the system enters an unrecoverable **split-brain state**.\n- **The Universal Standard:**\n  1. **Single-File Updates:** Write to isolated temporary buffer (`.tmp`), flush and sync (`os.fsync`), then execute an atomic file swap (`os.replace`).\n  2. **Multi-File Updates:**\n     - *Directory Pointer Swap:* Write all related files into a timestamped\u002Fversioned directory (e.g., `data\u002Fversions\u002Fv42\u002F`), fsync, and update a single `current` symlink\u002Fpointer atomically.\n     - *Write-Ahead Log (WAL) \u002F Transaction Manifest:* Write an immutable transaction manifest declaring the commit intent. Only after manifest commit are changes applied. On restart, any half-written state is rolled back cleanly.\n  3. **Crash Recovery:** On restart, always clean dangling `.tmp` buffers and resume strictly from the last verified snapshot.\n\n---\n\n### Pillar 7: Closed-Loop Bidirectional Feedback Contract\n- **The Anti-Pattern:** One-way fire-and-forget architectures. The orchestrator produces configuration; consumers read it passively. When a consumer discovers an anomaly or failure, it has no channel to alert the orchestrator without triggering a costly full system restart.\n- **The Universal Standard:** Establish an explicit event channel or callback interface:\n  - **Consumer Anomaly Signal:** When an active entity encounters recurring runtime failures (e.g., connection reset, consecutive timeouts, poison payload), the consumer notifies the orchestrator: `orchestrator.notify_anomaly(entity_id, reason)`.\n  - **Surgical Quarantine & Eviction:** The orchestrator transitions only that specific entity to `Degraded` or `Quarantined`, releases its lease, and provisions a replacement without recycling healthy peers.\n  - **Circuit Breaker:** If pool-wide error rates breach thresholds, temporarily trip the circuit breaker and fall back to safe degradation mode.\n\n---\n\n## 4. Canonical Workflow Document Template (`docs\u002Fworkflows\u002F`)\n\nWhen documenting any feature lifecycle, adhere to this standard layout:\n\n```markdown\n# [Component Name] Lifecycle & Workflow\n\n## 1. Overview & Single Responsibility\n[1 concise paragraph defining the boundaries: what it owns, what it isolates, and what it delegates.]\n\n## 2. Selected Lifecycle Archetype\n[State whether this is Archetype A (Daemon Pool), B (Batch Pipeline), C (Transaction Scope), or D (Resource Pool) and justify why.]\n\n## 3. Sub-Atomic Invariant Guarantees\n[Markdown Table mapping the 7 Invariant Pillars to project-specific guarantees.]\n\n## 4. End-to-End Workflow Diagram\n[Mermaid flowchart TD tracing: Trigger -> Ingestion -> Fingerprint -> Diff\u002FValidation -> Execution -> Persistence -> Feedback.]\n\n## 5. Lifecycle State Machine\n[Mermaid stateDiagram-v2 illustrating complete states and transition guards for the chosen archetype.]\n\n## 6. Failure Modes, Self-Healing & Invariant Checklist\n[Markdown Table detailing specific failure modes, detection mechanism, and automated deterministic mitigation.]\n```\n\n---\n\n## 5. Isolated Subsystem & File-by-File Implementation Sequence\n\n1. **Enforce Single-Facade Subsystem Boundaries:**\n   - Keep internal sub-engines and private worker units strictly isolated within their domain package (e.g., `src\u002F\u003Csubsystem>\u002Fhelpers\u002F` or private modules).\n   - Expose only a single public manager\u002Forchestrator facade with an explicit, typed interface (`start()`, `stop()`, `execute()`, `notify_anomaly()`).\n\n2. **The 5-Step Implementation Loop (One File at a Time):**\n   - **Step 1 (Analyze):** Map *Current State* vs. *Target State*, identifying edge cases, concurrency boundaries, and data contracts.\n   - **Step 2 (Implement):** Write clean, production-grade code adhering strictly to the Tony Hoare rule (no `None` returns, strict Pydantic schemas, typed exceptions). No docstrings or comments inside implementation code.\n   - **Step 3 (Lint):** Run the architectural linter to verify zero forbidden imports, no raw `pathlib` outside `config\u002F`, and strict single responsibility.\n   - **Step 4 (Verify & Time):** Execute isolated unit tests asserting state machine transitions and boundary defenses.\n   - **Step 5 (Orchestrate):** Validate the full end-to-end integration test verifying multi-component orchestration.\n\n---\n\n## 6. Cross-Platform Runtime & Concurrency Checklist\n\nWhen auditing or designing any lifecycle engine, verify these 5 cross-platform invariants:\n\n1. **Re-Entrant Cross-Platform File & State Locking:**\n   - Avoid platform-locked POSIX calls (`fcntl.flock`) in portable code. Use cross-platform libraries (such as `filelock`) or database\u002FRedis advisory locks with explicit timeouts and context managers to prevent thread\u002Fprocess self-deadlock.\n2. **Lock-Free External I\u002FO & In-Memory Rollback:**\n   - Never hold a synchronization lock during external network or high-latency filesystem I\u002FO. Perform pre-flight I\u002FO outside critical sections, stage mutations in memory, and acquire locks solely for atomic state swaps.\n3. **Cross-Platform Process Supervision & PID Verification:**\n   - Never rely on `\u002Fproc\u002F` paths or raw `os.kill(pid, 0)` which fail on Windows, macOS, and containers with PID recycling. Use cross-platform process management (such as `psutil`) to verify process creation time, status, and executable command line before signaling.\n4. **Graceful Signal Handling Across Platforms:**\n   - Handle termination signals (`SIGTERM`, `SIGINT`) gracefully. For background child processes, ensure clean shutdown protocols that allow active in-flight tasks to drain before forced termination.\n5. **Structured Async Supervision & Thread Boundaries:**\n   - Long-running orchestrators must offload blocking synchronous I\u002FO via `asyncio.to_thread`. Implement cancellation tokens so `stop()` awaits in-flight tasks before concluding teardown.\n","# Universal Feature Lifecycle & Workflow Design Methodology\n\n> *\"A software feature is not merely a function that executes; it is a state machine governing resources, identity, and invariants across time. True robustness begins at the sub-atomic lifecycle layer.\"*\n\n---\n\n## 1. Scope & Primary Directive\n\nThis skill does **NOT** design an entire generic application or high-level product MVP.  \nInstead, it provides the universal, domain-agnostic methodology to design the **complete, end-to-end atomic and sub-atomic lifecycle for any specific, isolated functionality integration** (e.g., daemon supervisor, worker pool, batch job pipeline, database transaction context, autonomous connection pool, cache manager, or rate-limited service client).\n\nWhenever an AI agent or software engineer is tasked with architecting, documenting, or reviewing a single functionality workflow, they must apply the **7 Invariant Pillars** and select the appropriate **Domain Archetype Profile** defined here.\n\n---\n\n## 2. Leverage the `human-skills` Gateway\n\nBefore designing or implementing, consult specialized capabilities within the `human-skills` ecosystem:\n\n| Skill \u002F Tool | Namespace | Purpose in Lifecycle Design |\n| :--- | :--- | :--- |\n| **`human-skills`** | Gateway | Master dispatcher to inspect available capabilities before assuming or improvising. |\n| **`writing-plans`** | `obra_superpowers` | Structuring execution plans with exact file paths, test-driven steps, and zero placeholders. |\n| **`test-driven-development`** | `obra_superpowers` | Formulating failing state transition and boundary tests prior to implementation. |\n| **`linter`** | `my_skills` | AST-based architectural auditor to ensure unidirectional imports, sandboxing, and zero forbidden patterns. |\n| **`mermaid_view`** | `my_skills` | Validating and rendering workflow and state-machine Mermaid diagrams. |\n\n```bash\n# Verify skills or inspect tools\nhuman-skills --skill_info writing-plans\nhuman-skills --tool_info linter\n```\n\n---\n\n## 3. The 7 Universal Invariant Pillars\n\nEvery functionality integration must explicitly answer and architect these 7 dimensions, regardless of domain:\n\n```mermaid\nflowchart TD\n    P1[\"1. Canonical Identity\\n(Deterministic Content Hashing)\"] --> P2[\"2. Pre-Commit Boundary Defense\\n(Staging Sandbox & Invariant Audit)\"]\n    P2 --> P3[\"3. Differential State Reconciliation\\n(Candidate vs Active State Diff)\"]\n    P3 --> P4[\"4. Resource Leasing & Capacity Bounds\\n(Sticky Allocation & Autonomous Pooling)\"]\n    P4 --> P5[\"5. Archetype State Machine\\n(Complete Lifecycle Transitions)\"]\n    P5 --> P6[\"6. Transactional Persistence\\n(Atomic Commit & Split-Brain Defense)\"]\n    P6 --> P7[\"7. Closed-Loop Bidirectional Feedback\\n(Consumer to Orchestrator Signals)\"]\n```\n\n---\n\n### Pillar 1: Canonical Identity & Deterministic Fingerprinting\n- **The Anti-Pattern:** Using arbitrary runtime auto-increment IDs, random UUIDs, or unstable mutable labels to identify managed entities.\n- **The Universal Standard:** Compute a deterministic SHA-256 fingerprint from the entity's immutable, normalized payload or configuration parameters:\n  $$\\text{Fingerprint} = \\text{SHA256}(\\text{CanonicalJSON}(\\text{NormalizedImmutableAttributes}))$$\n- **Guarantee:** \n  - Guarantees strict idempotency across restarts and repeated ingestion cycles.\n  - Eliminates duplicate entities masquerading under different aliases, labels, or routing handles.\n\n---\n\n### Pillar 2: Pre-Commit Boundary Defense & Staging Sandbox\n- **The Anti-Pattern:** Blindly writing raw input or newly spawned configurations directly into live production stores, runtime memory pools, or active pipelines.\n- **The Universal Standard:** Validate the candidate entity completely **before** it touches live operational state:\n  - **Schema & Invariant Check:** Strict Pydantic\u002Ftype validation with zero-fallback Tony Hoare boundary defense.\n  - **Dry-Run \u002F Syntax Audit:** If the entity produces executable configs, scripts, or external specs, invoke an offline dry-run validation pass against an isolated `.tmp` buffer.\n  - **Resource Pre-Check:** Verify resource availability (memory, ports, worker quota, disk space) before committing state.\n- **Guarantee:** Invalid or corrupt configurations fail fast in isolation; active production execution is never halted by unverified inputs.\n\n---\n\n### Pillar 3: Differential State Reconciliation\n- **The Anti-Pattern:** Destructive full overwrites on every sync cycle (tearing down the entire active pool and rebuilding from scratch), or concurrent reconciliation passes causing split-brain states.\n- **The Universal Standard:** Compute set-theoretic differential state between Candidate Ingestion ($C$) and Active State ($A$):\n  - **Concurrency Guard:** Enforce a non-reentrant state lock or optimistic concurrency control via monotonic version tags (`generation_id += 1`).\n  - **Unchanged ($C \\cap A$):** Retain entity and existing operational leases without interruption or connection drop.\n  - **Added ($C \\setminus A$):** Allocate required resource leases, stage in sandbox, and promote to active.\n  - **Modified ($C \\cap A$ with mutated payload):** Perform in-place hot-patch if supported; otherwise, execute a seamless blue-green rollover.\n  - **Missing ($A \\setminus C$):** Never terminate abruptly! Gracefully drain in-flight operations before releasing resources.\n\n---\n\n### Pillar 4: Resource Leasing, Quotas & Autonomous Pooling\n- **The Anti-Pattern:** Unbounded allocation, volatile index-based slot assignment (`index + base`), or synchronous on-demand fetching inside hot caller loops causing latency spikes.\n- **The Universal Standard:**\n  - **Explicit Resource Leases:** Any scarce or shared resource (ports, GPU memory, worker threads, DB connections, rate tokens) must be managed through an explicit `LeaseManager` that issues unique, tracked lease tokens.\n  - **Autonomous Pre-Warming (High-Latency Dependencies):**\n    When upstream dependency provisioning introduces high latency (>1-2s), synchronous on-demand allocation inside user requests is strictly forbidden.\n    - Maintain an autonomous background worker maintaining target warm capacity:\n      $$N_{\\text{target}} = \\text{Peak Concurrency} \\times \\text{Safety Factor}$$\n    - When available warm items drop below replenishment threshold ($T_{\\text{replenish}}$), asynchronously replenish without blocking active consumers.\n    - **TTL & Expiration Defense:** Prune stale entities according to proactive expiration buffers ($t_{\\text{expiry}} - \\Delta t_{\\text{safety}}$).\n\n---\n\n### Pillar 5: Archetype State Machine Topologies\n\nDo not force a single monolithic state machine onto every project. Select the appropriate **Archetype Profile** based on the entity's operational lifecycle:\n\n```mermaid\nflowchart TD\n    Entity[\"Entity Assessment\"] --> Decision{\"What is the entity's operational nature?\"}\n    Decision -->|\"Long-Running Daemon \u002F Process Pool\"| ArchA[\"Archetype A: Managed Supervisor Pool\"]\n    Decision -->|\"Discrete Batch Job \u002F Task\"| ArchB[\"Archetype B: Finite Batch Pipeline\"]\n    Decision -->|\"Scoped Request \u002F Transaction\"| ArchC[\"Archetype C: Request\u002FTransaction Context\"]\n    Decision -->|\"Recyclable Resource \u002F Connection\"| ArchD[\"Archetype D: Resource Pool Entity\"]\n```\n\n#### Archetype A: Managed Supervisor Pool (Long-running Services & Daemons)\nDesigned for managed processes, proxy daemons, background workers, and persistent connections:\n```mermaid\nstateDiagram-v2\n    [*] --> Ingested\n    Ingested --> Staged: Fingerprint & Validate\n    Staged --> Active: Bound & Healthy\n    Active --> Degraded: Health Check Warning\n    Degraded --> Active: Health Restored\n    Degraded --> Quarantined: Threshold Breached\n    Active --> Draining: Upstream Deregistration\n    Quarantined --> Draining: Quarantine Timeout\n    state Draining {\n        [*] --> RejectNew\n        RejectNew --> WaitInFlight\n        WaitInFlight --> DrainComplete\n    }\n    Draining --> Tombstone: In-flight == 0 \u002F Deadline Reached\n    Tombstone --> Purged: Tombstone TTL Expired\n    Purged --> [*]: Lease Recycled\n```\n\n#### Archetype B: Finite Batch Pipeline (Jobs, Tasks & Transformations)\nDesigned for discrete work units, ETL tasks, video transcode jobs, and async commands:\n```mermaid\nstateDiagram-v2\n    [*] --> Submitted: Enqueued\n    Submitted --> Validated: Payload & Quota Checked\n    Validated --> Queued: Awaiting Worker Slot\n    Queued --> Running: Worker Acquired\n    Running --> Completed: Execution Success\n    Running --> Failed: Unrecoverable Error\n    Running --> Cancelled: Explicit Abort\n    Failed --> Retrying: Retry Policy Eligible\n    Retrying --> Queued: Exponential Backoff\n    Completed --> Archived: Retained Output Stored\n    Failed --> Archived: Error Log Stored\n    Cancelled --> Archived: Partial Cleanup\n    Archived --> [*]\n```\n\n#### Archetype C: Request \u002F Transaction Context (APIs & Atomic Mutations)\nDesigned for HTTP requests, RPC calls, database units-of-work, and interactive operations:\n```mermaid\nstateDiagram-v2\n    [*] --> Received: Input Arrival\n    Received --> Authenticated: Identity Verified\n    Authenticated --> Validated: Schema & Invariants Passed\n    Validated --> Processing: Unit of Work Active\n    Processing --> Committed: Invariant Success\n    Processing --> RolledBack: Invariant or System Error\n    Committed --> Responded: Success Payload Sent\n    RolledBack --> Responded: Error Payload Sent\n    Responded --> [*]: Scope Terminated\n```\n\n#### Archetype D: Resource Pool Entity (Connections, Buffers, Tokens)\nDesigned for database connection pools, memory buffers, pre-warmed sessions, and tokens:\n```mermaid\nstateDiagram-v2\n    [*] --> Initializing: Allocation\n    Initializing --> Available: Health Verified\n    Available --> Leased: Checked Out by Caller\n    Leased --> InUse: Work Underway\n    InUse --> Returning: Work Finished\n    Returning --> Available: Sanitized & Healthy\n    Returning --> Evicted: Unhealthy \u002F Stale\n    Available --> Evicted: Idle TTL Expired\n    Evicted --> Destroyed: Resources Released\n    Destroyed --> [*]\n```\n\n---\n\n### Pillar 6: Transactional Persistence & Split-Brain Defense\n- **The Anti-Pattern:** Sequential writes across multiple independent files. If the process crashes or disk fills after writing File A but before writing File B, the system enters an unrecoverable **split-brain state**.\n- **The Universal Standard:**\n  1. **Single-File Updates:** Write to isolated temporary buffer (`.tmp`), flush and sync (`os.fsync`), then execute an atomic file swap (`os.replace`).\n  2. **Multi-File Updates:**\n     - *Directory Pointer Swap:* Write all related files into a timestamped\u002Fversioned directory (e.g., `data\u002Fversions\u002Fv42\u002F`), fsync, and update a single `current` symlink\u002Fpointer atomically.\n     - *Write-Ahead Log (WAL) \u002F Transaction Manifest:* Write an immutable transaction manifest declaring the commit intent. Only after manifest commit are changes applied. On restart, any half-written state is rolled back cleanly.\n  3. **Crash Recovery:** On restart, always clean dangling `.tmp` buffers and resume strictly from the last verified snapshot.\n\n---\n\n### Pillar 7: Closed-Loop Bidirectional Feedback Contract\n- **The Anti-Pattern:** One-way fire-and-forget architectures. The orchestrator produces configuration; consumers read it passively. When a consumer discovers an anomaly or failure, it has no channel to alert the orchestrator without triggering a costly full system restart.\n- **The Universal Standard:** Establish an explicit event channel or callback interface:\n  - **Consumer Anomaly Signal:** When an active entity encounters recurring runtime failures (e.g., connection reset, consecutive timeouts, poison payload), the consumer notifies the orchestrator: `orchestrator.notify_anomaly(entity_id, reason)`.\n  - **Surgical Quarantine & Eviction:** The orchestrator transitions only that specific entity to `Degraded` or `Quarantined`, releases its lease, and provisions a replacement without recycling healthy peers.\n  - **Circuit Breaker:** If pool-wide error rates breach thresholds, temporarily trip the circuit breaker and fall back to safe degradation mode.\n\n---\n\n## 4. Canonical Workflow Document Template (`docs\u002Fworkflows\u002F`)\n\nWhen documenting any feature lifecycle, adhere to this standard layout:\n\n```markdown\n# [Component Name] Lifecycle & Workflow\n\n## 1. Overview & Single Responsibility\n[1 concise paragraph defining the boundaries: what it owns, what it isolates, and what it delegates.]\n\n## 2. Selected Lifecycle Archetype\n[State whether this is Archetype A (Daemon Pool), B (Batch Pipeline), C (Transaction Scope), or D (Resource Pool) and justify why.]\n\n## 3. Sub-Atomic Invariant Guarantees\n[Markdown Table mapping the 7 Invariant Pillars to project-specific guarantees.]\n\n## 4. End-to-End Workflow Diagram\n[Mermaid flowchart TD tracing: Trigger -> Ingestion -> Fingerprint -> Diff\u002FValidation -> Execution -> Persistence -> Feedback.]\n\n## 5. Lifecycle State Machine\n[Mermaid stateDiagram-v2 illustrating complete states and transition guards for the chosen archetype.]\n\n## 6. Failure Modes, Self-Healing & Invariant Checklist\n[Markdown Table detailing specific failure modes, detection mechanism, and automated deterministic mitigation.]\n```\n\n---\n\n## 5. Isolated Subsystem & File-by-File Implementation Sequence\n\n1. **Enforce Single-Facade Subsystem Boundaries:**\n   - Keep internal sub-engines and private worker units strictly isolated within their domain package (e.g., `src\u002F\u003Csubsystem>\u002Fhelpers\u002F` or private modules).\n   - Expose only a single public manager\u002Forchestrator facade with an explicit, typed interface (`start()`, `stop()`, `execute()`, `notify_anomaly()`).\n\n2. **The 5-Step Implementation Loop (One File at a Time):**\n   - **Step 1 (Analyze):** Map *Current State* vs. *Target State*, identifying edge cases, concurrency boundaries, and data contracts.\n   - **Step 2 (Implement):** Write clean, production-grade code adhering strictly to the Tony Hoare rule (no `None` returns, strict Pydantic schemas, typed exceptions). No docstrings or comments inside implementation code.\n   - **Step 3 (Lint):** Run the architectural linter to verify zero forbidden imports, no raw `pathlib` outside `config\u002F`, and strict single responsibility.\n   - **Step 4 (Verify & Time):** Execute isolated unit tests asserting state machine transitions and boundary defenses.\n   - **Step 5 (Orchestrate):** Validate the full end-to-end integration test verifying multi-component orchestration.\n\n---\n\n## 6. Cross-Platform Runtime & Concurrency Checklist\n\nWhen auditing or designing any lifecycle engine, verify these 5 cross-platform invariants:\n\n1. **Re-Entrant Cross-Platform File & State Locking:**\n   - Avoid platform-locked POSIX calls (`fcntl.flock`) in portable code. Use cross-platform libraries (such as `filelock`) or database\u002FRedis advisory locks with explicit timeouts and context managers to prevent thread\u002Fprocess self-deadlock.\n2. **Lock-Free External I\u002FO & In-Memory Rollback:**\n   - Never hold a synchronization lock during external network or high-latency filesystem I\u002FO. Perform pre-flight I\u002FO outside critical sections, stage mutations in memory, and acquire locks solely for atomic state swaps.\n3. **Cross-Platform Process Supervision & PID Verification:**\n   - Never rely on `\u002Fproc\u002F` paths or raw `os.kill(pid, 0)` which fail on Windows, macOS, and containers with PID recycling. Use cross-platform process management (such as `psutil`) to verify process creation time, status, and executable command line before signaling.\n4. **Graceful Signal Handling Across Platforms:**\n   - Handle termination signals (`SIGTERM`, `SIGINT`) gracefully. For background child processes, ensure clean shutdown protocols that allow active in-flight tasks to drain before forced termination.\n5. **Structured Async Supervision & Thread Boundaries:**\n   - Long-running orchestrators must offload blocking synchronous I\u002FO via `asyncio.to_thread`. Implement cancellation tokens so `stop()` awaits in-flight tasks before concluding teardown.\n",{"name":5,"tags":24,"author":35,"version":36,"description":7,"trigger_patterns":37},[25,26,27,28,29,30,31,32,33,34],"lifecycle","lifecycle_designer","system-design","state-machine","architecture","universal-workflow","reconciliation","resource-leasing","atomic-persistence","closed-loop","Human Skills Team","2.0.0",[38,39,5,40,41,42,43,44,45,46,47],"lifecycle designer","lifecycle design","workflow design","state machine design","subatomic lifecycle","atomic workflow","reconciliation engine","resource leasing","daemon supervisor design","batch job lifecycle","main","1c3a5e1d7894fb6e3a473a45da896eb4a6550642","skills\u002Fstorage\u002Fmy_skills\u002Fsystem-lifecycle-designer",0,"https:\u002F\u002Fgithub.com\u002Fmdnaimul22\u002Fhuman-skills","https:\u002F\u002Fgithub.com\u002Fmdnaimul22","AI Agents Workflows Automation | Specializing in Python, FastAPI, MCP Agents & Custom ERP.","2026-11-11 21:16:57",{"source":8,"skillName":5,"commands":57,"prompt":67,"zipAvailable":68},[58,61,64],{"tool":59,"command":60},"npx","npx skills add mdnaimul22\u002Fhuman-skills --skill system-lifecycle-designer",{"tool":62,"command":63},"bunx","bunx skills add mdnaimul22\u002Fhuman-skills --skill system-lifecycle-designer",{"tool":65,"command":66},"pnpm","pnpm dlx skills add mdnaimul22\u002Fhuman-skills --skill system-lifecycle-designer","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmdnaimul22\u002Fhuman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fstorage\u002Fmy_skills\u002Fsystem-lifecycle-designer\u002FSKILL.md",true,[],[71,79,86,93,100,107],{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":78},"01M748ABPN5F1FANHH6HKZQMXT","style-sampling","Make a new episode in a proven video style - Collage Explainer, Finance Explainer, Animated Science Explainer, 3D Brand Explainer, 3D True Crime - on the person's topic. Use for \"an episode of\", \"in the style of\", \"sample this style\", 「用这个风格做一集」. One video to copy is reverse-any-video.","https:\u002F\u002Fgithub.com\u002Fmdnaimul22\u002Fhuman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fstorage\u002Fheygen-com_hyperframes\u002Fstyle-sampling\u002FSKILL.md",[],[],"2026-11-11 15:11:14",{"skillNo":80,"name":81,"nameZh":6,"description":82,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":83,"categories":84,"keywords":85,"publishedAt":78},"01M748A59V04PKW4HA0XQ81FGP","reverse-any-video","Rebuild any video file as an editable HyperFrames project - motion graphics, talking heads, live action or AI-generated footage - checked against the original frame by frame. Use to reverse, recreate, remake, replicate or copy a video, or 「复刻这个视频」「照着这个视频做一个」.","https:\u002F\u002Fgithub.com\u002Fmdnaimul22\u002Fhuman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fstorage\u002Fheygen-com_hyperframes\u002Freverse-any-video\u002FSKILL.md",[],[],{"skillNo":87,"name":88,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":78},"01M7487T50P55CSXMWXZ0G9KRG","typescript-patterns","TypeScript patterns for strict, type-safe, maintainable code in modern TypeScript and JavaScript applications. Covers strict compiler configuration, type design, narrowing, discriminated unions, generics, async and error handling, module boundaries, dependency hygiene, and type-level testing. Use when writing or reviewing TypeScript or JavaScript code.","https:\u002F\u002Fgithub.com\u002Fmdnaimul22\u002Fhuman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fstorage\u002Faffaan-m_ECC\u002Ftypescript-patterns\u002FSKILL.md",[],[],{"skillNo":94,"name":95,"nameZh":6,"description":96,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":97,"categories":98,"keywords":99,"publishedAt":78},"01M7487ERZRGPC5NJ75077Y238","test-collaboration","Inventory and govern a project's test assets. Connect requirements, business rules, risks, bugs, and cross-boundary contracts to stable TEST-IDs and executable evidence in the repository's existing test registry or TESTS.md. Use for test inventory, test gap analysis, unit\u002Fintegration\u002Fcontract\u002FE2E\u002Fsmoke classification, bug-to-test regression protection, consumer\u002Fprovider contract testing, test-necessity review, and pre-delivery evidence review.","https:\u002F\u002Fgithub.com\u002Fmdnaimul22\u002Fhuman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fstorage\u002Faffaan-m_ECC\u002Ftest-collaboration\u002FSKILL.md",[],[],{"skillNo":101,"name":102,"nameZh":6,"description":103,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":104,"categories":105,"keywords":106,"publishedAt":78},"01M748721J3GKR2WS6K0QWFC35","story-lifecycle","Manage a file-based epic → story → sprint development loop without requiring an external project management tool. Creates and tracks epics, breaks them into user stories, assigns them to sprints, and drives implementation story by story. Use when starting a new feature initiative or when the team has no Jira\u002FLinear\u002FTaiga but needs structured delivery tracking.","https:\u002F\u002Fgithub.com\u002Fmdnaimul22\u002Fhuman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fstorage\u002Faffaan-m_ECC\u002Fstory-lifecycle\u002FSKILL.md",[],[],{"skillNo":108,"name":109,"nameZh":6,"description":110,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":111,"categories":112,"keywords":113,"publishedAt":78},"01M7486VNZHNK4JAPWQXTDDT3J","skill-host-compat","Lint ECC skills for Codex\u002FCursor-safe frontmatter and Claude-only substitutions before a skill PR.","https:\u002F\u002Fgithub.com\u002Fmdnaimul22\u002Fhuman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fstorage\u002Faffaan-m_ECC\u002Fskill-host-compat\u002FSKILL.md",[],[]]