agentleFS
aaziraniaazirani/flutter_agentify/.agents/skills/app-context/SKILL.md

app-context

Skill0 starsChanged 4 days agoMITView on GitHub

How the assistant knows what is on screen, through the screen-context table keyed by route, bounded summaries, selection reporting, and navigation only through the navigate action. Use when adding a route, changing what a screen shows, or making the assistant aware of a selection.

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 1 is distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    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 the actions themselves or for what the assistant may do without asking.

    line 8
  2. Very specific:

    Every route has one entry in buildScreenContexts in lib/ai/screen_contexts.dart, keyed by its route pattern (/, /settings).

    line 12
  3. Very specific:

    Every message carries a <current-screen> block: {"navigation": {"route", "location", "params", "selectedIds"}, "screen": {...}}.

    line 21
  4. Very specific:

    Add the entry next to the others.

    line 25
  5. Distinctive:

    Run the app, open the screen and ask the assistant what it sees.

    line 51

≈ “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

App context

Don't load this for the actions themselves or for what the assistant may do without asking; see actions and approval-and-safety.

Rule

  • Every route has one entry in buildScreenContexts in lib/ai/screen_contexts.dart, keyed by its route pattern (/, /settings).
  • An entry returns a short summary of what the screen shows: counts plus the first rows, ids always, never a key or secret.
  • A screen with a selection reports it through AppContext.setSelection.
  • The assistant moves between screens only with the navigate action.

Enforced by test/ai/parity_test.dart (a route without an entry, or an entry matching no route, fails it). Summary size and content are not checked.

Why

Every message carries a <current-screen> block: {"navigation": {"route", "location", "params", "selectedIds"}, "screen": {...}}. The screen part comes from your entry. Small models have little context, so a summary has to be short; ids let the model act on rows with update_item instead of guessing.

How

Add the entry next to the others. ScreenContext takes a function from the navigation state to a map, sync or async:

<!-- @example:begin -->
  • / in lib/ai/screen_contexts.dart reads getItems(limit: _visibleRows) (10) and getItemCount(), and returns total, a list of {id, title, description} (cut short), a note and selectedIds. The total shows what the list leaves out.
<!-- @example:end -->
  • /settings reads providers, not the database, and reports the model preset and whether it is configured, never the key.
  • A screen with nothing to report uses const ScreenContext.nothing().

Selection. The home screen's provider in lib/presentation/providers/items_provider.dart calls getIt<AppContext>().setSelection(...) on every change. Do the same wherever a person can pick rows, so "delete these" works.

Navigation. lib/ai/go_router_adapter.dart keeps the route, location and params in step with GoRouter and connects the navigate action to router.go. The assistant never calls context.go or setNavigation; navigate fails with unknown_route for a location that matches no table key. List the screens in assets/assistant/instructions.md.

A view that takes longer than AppContext.viewTimeout (2 s) is cut off, so read local data only.

Anti-patterns

  • Dumping a whole table into the summary.
  • Rows without ids.
  • Putting an API key, token or setting's secret value in a summary.
  • A route added to lib/utils/routes/app_router.dart with no table entry.
  • Calling setNavigation from a screen.
  • Letting the assistant reach a screen by any path other than navigate.

Verification

  • test/ai/parity_test.dart for route coverage; test/ai/screen_contexts_test.dart for the entries; test/ai/go_router_adapter_test.dart for the adapter.
  • Run the app, open the screen and ask the assistant what it sees.
  • tool/check.sh ends with All checks passed.

Related skills

  • adding-a-feature — the whole checklist this entry is part of.
  • actions — the actions a model uses with the ids you report.
  • approval-and-safety — keeping secrets out of what the model sees.
  • routing — adding the route the entry belongs to.
  • performance — keeping screen summaries small.

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.