Index of every page on this site: llms.txt
All skills
fiveonecode avatar

/lifecycle-and-side-effects-correctness

@8f30014
Run it yourself

Audit and design lifecycle side-effect correctness for async UI, purchase, analytics, retry, cancellation, presentation, and session flows. Use when reviewing SwiftUI or other UI lifecycle code, paywalls, subscription or purchase flows, analytics emission, async tasks, retries, reloads, sheet dismissal, remount behavior, or any change where user-visible state and side effects must stay consistent across lifecycle transitions.

Use this Skill: https://skilld.dev/gh/fiveonecode/agent-skills/lifecycle-and-side-effects-correctness

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

≈117 tokens for metadata: the name and description. ≈992 when used: this file. ≈67 more on demand in 1 file.

Description uses 5.9% of example budget

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

  • A shorter description leaves more room for other Skills. This entry exceeds our 1% size suggestion.

In our Claude Code example, all Skill names and descriptions share 8,000 characters. This Skill uses ≈470 characters, or 5.9%.

The 1% threshold is a size suggestion. Longer descriptions can still fit.

Your model, settings, and other Skills decide how much text your Agent can read.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

Lifecycle And Side Effects Correctness

Overview

Use this skill to prevent duplicate, stale, missing, or misattributed side effects across lifecycle transitions. Treat analytics, purchases, network retries, persistence, and callbacks as contract-bearing effects, not incidental code inside a view or async closure.

Workflow

1. Identify the owner

  • Name the durable owner for each effect: service, coordinator, store, view model, view task, or external SDK.
  • Keep one-shot effects out of view identity when remounts, .id(...), previews, or sheet recreation can run the code again.
  • Separate view-local state from session, purchase, analytics, or persisted state.

2. Map lifecycle transitions

List the transitions that can start, repeat, cancel, or complete work:

  • appear, disappear, dismiss, remount, reload, retry, background, foreground;
  • task start, cancellation, timeout, success, failure, fallback;
  • purchase start, product/offering reload, checkout, restore, completion;
  • analytics impression, dismiss, branch, conversion, error, and retry.

For each transition, write the expected state and allowed side effects.

3. Enforce side-effect invariants

  • No duplicate side effects from view remount, .task restart, .onAppear, .id(...), or sheet recreation.
  • No stale completion side effects after cancellation, dismissal, navigation away, or superseded input.
  • No false dismiss/present, impression, purchase, or retry analytics caused by view identity churn.
  • In-flight purchase or mutation actions are idempotent, disabled, or otherwise guarded.
  • Retry paths emit required lifecycle events exactly as specified and preserve session attribution.
  • Failure paths either emit the required failure effect or explicitly suppress it under a documented rule.
  • Persisted state, analytics properties, and user-visible copy derive from the same canonical source when they describe the same decision.

4. Check identity and attribution

  • Define the stable session, impression, request, purchase, or operation ID before work starts.
  • Preserve attribution through retries, slow loads, fallback, and personalized copy refresh.
  • Do not derive experiment, package, offering, campaign, or branch attribution from display text when a canonical ID exists.
  • Normalize stale IDs only at the boundary that owns the crosswalk; do not let tests erase identity bugs through broad normalization.

5. Verify cancellation and retry

  • Prefer lifecycle-bound tasks such as .task(id:) when the effect should cancel with the view.
  • Move effects to a longer-lived owner when they must survive view dismissal.
  • After await, check cancellation, current identity, or generation token before emitting effects.
  • Bound retries and state what happens to analytics, user-visible errors, and persisted state on each retry.
  • Treat silent discard as invalid unless the spec names it and defines observability.

6. Design tests

Use focused tests around lifecycle edges:

  • remount does not duplicate impression or purchase effects;
  • dismissal cancels or suppresses stale completion effects;
  • retry preserves the same session attribution when required;
  • checkout disables plan changes or makes plan changes explicitly safe;
  • failure, fallback, and cancellation emit the required event sequence;
  • stale async completion cannot overwrite newer state.

Use exact event sequences when order is contractual. Use multiset checks only when order is intentionally irrelevant.

Review output

When reviewing a lifecycle-sensitive change, report:

  • Effect owners: which component owns each side effect.
  • Lifecycle transitions: starts, repeats, cancellations, completions, and retries.
  • Risk findings: duplicate, stale, missing, or misattributed effects.
  • Required tests: the smallest tests that prove the lifecycle boundary.
  • Residual risk: any behavior that still depends on manual QA, live SDK behavior, or product policy.

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts3mo3 checks · Risk SAFE
  • Gen Agent Trust Hub3mo

    The lifecycle-and-side-effects-correctness skill is a set of text-based instructions for auditing UI lifecycle side effects in software development. It contains no executable code, no external dependencies, and no network operations. The skill is entirely safe and follows best practices for providing analytical guidance without introducing technical risk.

  • Socket3mo

    No alerts

  • Snyk3mo

    Risk: LOW · No issues

Signed by skilld at 8f30014. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 weeks ago.

Activeupdated 4 months ago

README badge

README badge for fiveonecode/agent-skills/lifecycle-and-side-effects-correctness