---
name: anilsoylu-find-state-machines
title: find state machines
kind: skill
description: >
  Find implicit state machines, where one lifecycle's state, transitions, and
  ownership are scattered across flags, effects, callbacks, and async work, and
  make them explicit. Use when auditing lifecycle coordination, async flows,
  impossible states, or a proposed stateful refactor.
updated: 2026-12-05
authored_by: anilsoylu
author_url: https://github.com/anilsoylu
source_url: https://github.com/anilsoylu/famiglia-agent-skills/tree/HEAD/skills/find-state-machines
brought_by: kt
license: Apache-2.0
---

# Find State Machines

1. Find the app's explicit and implicit state machines and document their states, invariants, and transition tables in
   one file.
2. Identify invalid states or transitions the code can actually reach, with evidence, including through retries and
   concurrency.
3. Prioritize confirmed bugs by impact and group related fixes into issues.
4. Fix them with regression tests and keep the document updated.

Label each check's result exhaustive or bounded, and replay any counterexample against the real code before calling it
a bug.

## If something fails

| Failure | Fix |
|---|---|
| No lifecycle with more than two states turns up | Report the areas searched and stop. Don't invent a machine. |
| An invalid transition can't be reproduced | Label it suspected, not confirmed, and don't fix it until you have evidence. |
| A race shows only under some timings | Force the interleaving in the test with controlled promises or fake timers, never sleeps. |
| The repo has no test setup | Report each bug with its reproduction steps and ask before adding a test framework. |
