SkillsReviewed · maxrave-dev

State and background footguns

State and background footguns is an instruction pack for coding assistants and Kotlin developers, but its project-specific examples need careful adaptation. Its 23 references explain reactive state, coroutine lifecycles, Android background scheduling and widgets, desktop startup, persistence, logging and optional asset installation. Several notes explicitly identify defects in the patterns they illustrate.

Researched 16 Nov 2026

In short.

State and background footguns is an instruction pack for Kotlin and Compose developers using coding assistants, but some examples deliberately expose incomplete or faulty patterns. Its strength is connecting visible symptoms, such as stale screen data or duplicated background updates, to specific ownership, cancellation and scheduling mistakes. The complete notes matter more than their opening snippets. Compatibility, runtime correctness and effectiveness are unassessed; no code or suggested commands were executed.

Researched and written by an AI model and checked by a second AI model. How it works

Covers skills/state-and-background-footguns/SKILL.md and all 23 Markdown files under its references directory at commit 2c391bc9c9f873580aa855d7a7b1c3a2ed9e68ae, together with the repository-level LICENSE supplied above the folder. Excludes sibling skills, the originating application, external assets, dependency implementations and later revisions. All supplied files were considered as source evidence. No installation, code, commands, builds, devices, assistant behavior or runtime journeys were tested.

The overview

Identity

The resource is skills/state-and-background-footguns in the maxrave-dev/kotlin-footguns repository. It contains SKILL.md and 23 Markdown reference files. The index describes them as traps drawn from a production Kotlin and Compose Multiplatform application.

Original source: [https://github.com/maxrave-dev/kotlin-footguns/tree/main/skills/state-and-background-footguns]. This folder provides instructions, explanations and adapted code examples rather than a complete application.

Assessment

The pack is useful as a focused debugging and code-review reference. It connects concrete symptoms to mechanisms: a spinner can remain visible because the final StateFlow write contradicts the event, while repeated updates can come from launching replacement coroutine jobs without cancelling their predecessors.

A useful feature is its discussion of misleading safeguards, including cancellation handles that were never assigned. These explanations help a reader question apparently protective code. The evidence does not establish measured defect reduction, time savings or reliable assistant performance.

Users

The intended audience is developers maintaining Kotlin applications with coroutines, Compose Multiplatform screens, Android background workers or home-screen widgets. Coding assistants can use the topic index to locate relevant guidance during implementation or debugging.

Beginners get recognizable symptoms and short worked examples, but basic Kotlin, asynchronous programming and application lifecycle knowledge are helpful. Experienced developers get detail about state ownership, dependency injection, cancellation and platform-specific failure paths. It is a targeted reference rather than a beginner programming course.

Capabilities

Reactive-state coverage includes flow sharing, changing-item subscriptions, cancellation, clean state resets and gates built from several conditions. Other notes explain explicit waiting states, deriving UI flags and preset labels from their underlying values, and presenting period statistics as one coherent value.

Android guidance covers database backup archives, settings-driven WorkManager schedules, persistent notification deduplication, and Glance widget state, layout and image handling. These are implementation patterns and review suggestions, not supplied runtime components.

The remaining material covers desktop startup ordering, single-instance behavior, crash-reporting variants, a replaceable logging facade and on-demand dictionary installation. The asset note discusses staging, archive verification, concurrent-download control and retryable tokenizer construction.

Using it

Requirements

Applying the examples requires a Kotlin project using the relevant libraries and platforms. Android-specific notes depend on APIs such as WorkManager, MediaStore or Glance; desktop advice involves Compose rendering, JDK windowing behavior and packaged launchers.

The folder does not specify a required assistant product, model or complete dependency-version matrix. Suggested searches require access to the application's source, while behavioral checks require suitable devices, emulators or packaged desktop builds. The flow-subscription note also identifies an experimental-coroutines opt-in in its source context; applicability to another dependency version needs checking.

Mechanism

The index maps symptoms or proposed work to reference files. Each reference combines an adapted pattern, explanations of failure modes and suggested source searches or runtime observations. Paths and application-specific names must be translated to the reader's project.

The technical guidance often separates concerns that look similar. StateFlow retains the latest state, while sharing a cold Flow controls how often its source runs. Combining conditions determines whether work should start; removing unchanged answers avoids unnecessary restarts. Cancelling the latest collector action does not necessarily stop work launched into a separate scope.

These distinctions provide context for human or assistant reasoning. The supplied files do not demonstrate automatic detection or enforcement.

Setup

Obtain the folder from the original repository and preserve SKILL.md beside its references directory. The source version described here is available at [https://github.com/maxrave-dev/kotlin-footguns/tree/2c391bc9c9f873580aa855d7a7b1c3a2ed9e68ae/skills/state-and-background-footguns]. Retain the accompanying repository licence when sharing copies.

Make the folder available through your assistant's supported skill mechanism, or read the Markdown directly. A host-specific installation procedure is not supplied. Some references point to sibling skills outside this folder, including database raw-query and platform-detection topics; those explanations are separate dependencies.

Example

Suppose a backup keeps running daily after the user changes its setting to weekly. The WorkManager note recommends observing the enabled flag and frequency together in one application-lived collector, ignoring unchanged pairs, and updating unique periodic work with ExistingPeriodicWorkPolicy.UPDATE. Disabling the feature cancels that same unique name.

The worker also checks the enabled flag itself and returns success without doing work when disabled. Suggested observations include inspecting the changed queued interval, checking that unrelated preference writes do not reschedule it, and forcing a disabled run. These are proposed checks, not recorded results.

Assessment & evidence

Limitations

Opening examples are not uniformly ready to copy. The item-switching note discloses a cancellation handle that was never assigned. The widget note explains how its displayed collector arrangement leaks across repeated provisioning. The crash-reporting note says the desktop implementation bypasses the Android-only module pair. Read the corrective discussion with each example.

The bitmap note contains an arithmetic inconsistency: its stated ten 256-by-256 images at four bytes per pixel total about 2.6 MB. Calculated against its illustrative 20 MB budget, that is about 13%, rather than the four percent stated in the prose. The same note says the actual budget depends on the display, so 20 MB is not a universal allowance.

Renderer properties, reflective JDK access, platform API branches and library behavior need validation against the application's actual versions. Compatibility across all Kotlin, Compose, Android, Glance and JDK releases is unknown.

Reasoning

The strongest recurring principle is explicit ownership: replace a job through its own handle, verify an item's identity before publishing its result, and keep durable delivery records outside a short-lived worker. These address different failure windows, so one cancellation operator cannot establish the whole component's correctness.

Reliability claims need a narrow reading. The notifier uses a finite lookback window and posts before recording delivery; its shown design therefore leaves a duplicate window and does not establish delivery after arbitrary delays. Similarly, the persistence example blocks during release(), but does not demonstrate a final save when abrupt termination skips that path. These limits follow from the shown control flow, not execution results.

Alternatives

Reading individual references manually is an alternative to loading the whole skill into an assistant. A developer investigating one statistics screen or ViewModel initialization problem can start with its matching note.

The folder supplies neither an automated linter nor a ready-made implementation library. Those needs require separate tooling. No competing skill pack, assistant product or enforcement tool is compared in the supplied evidence, so relative quality is unknown.

Evidence

The supplied material comprises the complete selected folder: its index and 23 references, plus the repository-level licence. The production-app origin is the author's description. The originating application's full source, build configuration, runtime logs and reproducible test results are outside this evidence.

Nothing was executed, including verification commands. Runtime behavior, assistant integration, performance improvements and the claimed absence of reporting dependencies in a privacy build are unassessed. Suggested checks explain what a reader should investigate; they do not establish successful outcomes.

Access & freshness

Costs

The selected files do not state a purchase price, subscription or support price, so those costs are unknown. They also provide no measured implementation effort or productivity savings.

Any assistant-provider fees, device-testing effort, crash-reporting service charges and asset-download traffic depend on the chosen setup and are unquantified. The presence of an open-source licence does not establish that every related service or dependency has zero cost.

Rights

The accompanying repository-level LICENSE contains GNU General Public License version 3. For covered material, section 4 permits unchanged source redistribution while preserving required copyright, licence and warranty notices and providing the licence. Modified-source distribution has additional requirements under section 5.

No separate licence for this folder or project-specific permission to use later GPL versions is supplied. The later-version wording in the licence's application example is a template, not an established project grant. Rights to external dictionary archives, libraries and services are not established by these selected files.

Licence source: [https://raw.githubusercontent.com/maxrave-dev/kotlin-footguns/2c391bc9c9f873580aa855d7a7b1c3a2ed9e68ae/LICENSE].

Freshness

The source snapshot identifies commit 2c391bc9c9f873580aa855d7a7b1c3a2ed9e68ae and a capture timestamp of 16 November 2026 at 14:49:25.765 UTC. That timestamp does not establish the author's last update, the commit's publication date or subsequent changes.

Version-sensitive details include a discussion of Glance 1.1.1 internals, Android API 31 corner rounding and desktop renderer and JDK workarounds. Their applicability to a different dependency set remains unknown.

Actions

Start with the symptom index, read the complete matching notes and trace the relevant writers, launch sites or scheduling calls in your own project. Resolve applicable sibling references and replace original-project paths before using the suggested searches.

Choose behavioral checks that match the change: restore a backup and inspect the newest data, repeat callbacks and watch update rates, re-add widgets and inspect duplicate collectors, or launch the packaged desktop app twice. Search matches alone cannot establish lifecycle or platform correctness.

For a build intended to exclude crash reporting, inspect the built dependency list as the note recommends. Matching function signatures or a disabled flag does not establish that the reporting library is absent.

Evidence for this report

LICENSEnotice · checked 2026-11-16
skills/state-and-background-footguns/SKILL.mdselected · checked 2026-11-16