agentleFS
aaziraniaazirani/flutter_agentify/.agents/skills/background-work/SKILL.md

background-work

Skill0 starsChanged 4 days agoMITView on GitHub

What the operating systems allow when the app is not in front, and how long-running work should report progress. Use when a feature needs to keep working after the screen closes, run on a schedule, show progress or send notifications.

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 2 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Don't load this for slow code that freezes the screen.

    line 8
  2. Very specific:

    Keep job state in the database (storing-data), not in memory, so the app can pick up after being closed.

    line 30
  3. Distinctive:

    Use a notification only to tell the person something finished or needs them, and only after a permission request that the person can refuse.

    line 32
  4. Very specific:

    If a real background mechanism is unavoidable, ask the person for the dependency first, then add its platform settings …

    line 33
  5. Distinctive:

    No automated check. Review by hand: can the person see it, stop it, and find it again after a restart?

    line 45
  6. Very specific:

    Test the job's steps as actions (testing) and run the app on a real device in the background for the platforms you support.

    line 46

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Background work

Don't load this for slow code that freezes the screen; see performance. For platform permissions, see permissions-and-platform.

Rule

Long work shows its progress in the UI and can be stopped. No hidden loop, timer or isolate keeps working on its own. Anything that needs a new dependency (background execution, notifications, scheduling) needs the person's approval first: say what it is for and what it costs, and wait. No automated check exists for this rule; the app today has no background work (lib/main.dart only starts the app), except the in-app model download in projects set up with --model both or on-device, which shows progress and can be cancelled.

Why

Mobile systems stop or kill background apps, so work that only runs "in the background" silently does not finish. Hidden work also cannot be approved, observed or cancelled by the person, which breaks the idea that the UI and assistant share one visible set of actions.

How

What each OS allows, in short:

  • iOS: almost nothing once the app is suspended; short grace time, then system-scheduled refreshes at the system's discretion. Exact timing is not available.
  • Android: background work must be scheduled through the system (and long work shown with a foreground-service notification); the system limits it further when battery is low.
  • Web: nothing runs when the tab is closed; throttled when hidden.
  • macOS, Windows, Linux: the app keeps running while it is open, even without focus; nothing runs after it quits unless the person sets up a login item or service.

So design for "work happens while the app is open", and make the rest resumable:

  1. Make the work an action (actions) that does one bounded piece and returns. A long job is many small calls, each recorded.
  2. Keep job state in the database (storing-data), not in memory, so the app can pick up after being closed.
  3. Show progress in a screen the person can open: a count, a status line, a stop button. Put the same facts in the screen summary (app-context) so the assistant can report them.
  4. Use a notification only to tell the person something finished or needs them, and only after a permission request that the person can refuse.
  5. If a real background mechanism is unavoidable, ask the person for the dependency first, then add its platform settings (permissions-and-platform).

Anti-patterns

  • A Timer.periodic or endless while loop started at launch.
  • Assuming a task will run on a schedule on iOS.
  • Adding a plugin because "it is only one package".
  • Progress kept only in a variable, lost when the app closes.
  • An action that runs for minutes with no way to cancel.

Verification

  • No automated check. Review by hand: can the person see it, stop it, and find it again after a restart?
  • Test the job's steps as actions (testing) and run the app on a real device in the background for the platforms you support.

Related skills

  • actions — one bounded step per call
  • storing-data — job state that survives restarts
  • reliable-mutations — safe retries of a step
  • permissions-and-platform — notification and background settings

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.