tapir
Skill3 starsChanged 16 days agoMITView on GitHub
Drive, verify and profile a running Flutter app from an agent with tapir.
2 other projects use a version of this.
Adopted by
Most recently taken up by
- anilcancakir/aiword for word, first seen Nov 16, 2026
- fluttersdk/aiword for word, first seen Nov 16, 2026
Other versions2 projects use a version of this.
Word for word · 2
- anilcancakir/ai★ 3100% same
- fluttersdk/ai★ 3100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 18
If a tapir_* call or ./bin/dowel tapir:snap reports that no app or VM Service is reachable, the app is not running or tapir is not …
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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.
Files
<!-- tapir v1.1.0 | Skill updated: 2026-11-18 -->tapir
Tapir lets an agent drive a Flutter app that is already running. The app registers ext.tapir.* VM Service extensions; you call them as tapir_* MCP tools or as ./bin/dowel tapir:* commands from a shell, both reaching the same handler; the CLI flags can differ from the tool parameters (${CLAUDE_SKILL_DIR}/references/cli-commands.md lists them). The loop is: snapshot the Semantics tree, act on a ref from it, read what the action reports, wait for the result.
Scope: this skill drives and inspects the UI. Starting, reloading and stopping the app, dowel_tinker and MCP wiring are the dowel skill; HTTP, log and exception capture is the crumbs skill; a flutter_test widget test needs neither.
Install
If a tapir_* call or ./bin/dowel tapir:snap reports that no app or VM Service is reachable, the app is not running or tapir is not installed. From the Flutter app root:
flutter pub add tapir
dart run tapir tapir:install # patches lib/main.dart, scaffolds ./bin/dowel, registers the plugin
dart run tapir mcp:install # writes the `dowel` entry into .mcp.json
./bin/dowel start --device=chrome # or macos, linux, windows, a device id; --cdp-port=9222 on web adds CDP, gives up tapir_evaluate
./bin/dowel tapir:doctor # wiring and session health
./bin/dowel tapir:snap # the agent reaches the apptapir:install puts TapirPlugin.install() behind if (!kReleaseMode) before runApp( (before Magic.init( on a Magic app), so debug and profile builds carry tapir and release builds drop it. On a Magic app it also adds MagicTapirIntegration.install() (from package:magic_devtools/tapir.dart) after Magic.init(), but only when the resolved magic_devtools is a release built on tapir; otherwise it warns and skips that line, so upgrade magic_devtools and rerun. Reconnect the MCP client after mcp:install; a stdio server is not reloaded on its own. A project that ran tapir's predecessor, fluttersdk_dusk, still holds its files: tapir:install and tapir:doctor list them (a stale bin/dispatcher.dart keeps dowel install from running), then name the commands to run after you delete them.
Rules
Refs
- Two ref spaces, never mixed.
e<N>comes fromtapir_snapand names one Semantics node of that snapshot.q<N>comes fromtapir_findortapir_observe, stores the predicates and walks the live tree again on every action. Hold ane<N>for the next action after the snap; hold aq<N>across retries, animations, navigation and hot reload, because ane<N>whose node unmounted failsdefunctunless tapir can relocate it safely (rule 2). - A stale
e<N>is relocated only when it is safe. The action re-runs the label query bound to the ref and trusts it only when the live tree has the same number of nodes with that label on the same route; the response then lists the ref underreresolved. Otherwise it failsdefunct: re-snap. An unlabelled ref is never relocated. - Narrow the read before acting.
tapir_snap { within: "e12", interactiveOnly: true }walks one subtree and drops prose;grep: "<regex>"keeps matches plus their ancestors (an invalid regex is matched as text and the response carriesgrepLiteral: true). A full tree costs context, and on a shell whose sidebar repeats page labels the unscoped lookup lands on the nav item.tapir_find { within: "e12", text: "Save" }keeps the scope inside the handle;withinalone is refused, so pair it withtext,contains,semanticsLabelorkey. - A repeated label needs a narrower predicate.
tapir_findanswers the first match plusmatchCount; above 1 it addsdiagnostic. Predicates are not intersected, so narrow by swapping tokey,textorcontains, addingwithin, or usingtapir_observe, whose labelled handles carry their position among same-label nodes. A position is not an identity: after any action that adds or removes a row with that label, observe again, because a held handle then selects a neighbour and the action still reports success. An unlabelled candidate has no position, so take a snapshot ref or akeyfor it. Resolver order and the unlabelled case:${CLAUDE_SKILL_DIR}/references/actionability-and-refs.md. - Trust the line markers. A snapshot ref line ending
[offscreen]needs a scroll, one ending[occluded]has something painted over its centre; observe candidates carryinViewportandoccluded. Atypeable: truesub-line marks the nodetapir_typewrites to.
The actionability gate
tap,double_click,right_click,triple_click,hover,drag,type,fillandset_checkboxpass a six-step gate first (set_checkboxgates the control it taps, and only when it taps), in this frozen order: (0) defunct preflight, (1) enabled, (2) zero rect, (3) off-viewport, auto-scrolling once under aScrollable, (4) stable, 2-frame drift above 0.5px, (5) receives events, the hit test at the centre reaches the target.clear,focus,scroll,press_keyandselect_optionskip it, so a covered or disabled target is not refused there.checkStable: falseandcheckReceivesEvents: falseskip steps 4 and 5 for one call; there is no global switch, so an exception stays visible.Branch on the reason substring, never on the full message.
Substring Meaning Next move defunct(element no longer mountedorelement no longer attached to a render object, both frozen text)The node left the tree Re-snap and pick the ref again not enabledSemantics isEnabledis falseChange the state that disables it; a retry fails the same way zero rectWidth or height is 0, layout pending tapir_wait_foron content, then retryoff-viewport (rect=..., viewport=...)Auto-scroll did not bring it in tapir_scrolltoward it, retrynot stable (rect changed by Xpx)Animating Wait; checkStable: falseonly for an intentional animationobscured by other widget (top=...)Something covers it tapir_reset_overlays, orcheckReceivesEvents: falsewhen the cover lets touches throughA stale
q<N>fails withQuery handle ref=qN is stale: no live match for stored predicates: find or observe again rather than retrying the handle. A target tapir will not act on at all (a ref that is not a text field, a container of several checkboxes, a perf call with no session) is not a gate reason but the error typerefused(code-32001): choose another target, do not retry. A value it cannot use isinvalid_param(-32602).- On Flutter Web step 5 often cannot answer, so the gate proceeds and the response carries
checks: {receivesEvents: "indeterminate", why, overlapCandidates, hint}. The key is absent when the check confirmed. When it is present, judge the action by itseffect, not by the success.
Reading results
- A success means dispatched;
effectsays what the widget holds now.tap:{kind: "treeChanged", changed}, wherechanged: falsemeans no measured change (label, value, enabled and checked flags of the target's own subtree, and its route name; other properties are not compared);routeChanged: true, which can come with either value ofchanged, is added when the top route of the root navigator, or of the navigator holding the tapped widget, changed (a dialog, sheet, menu or page pushed or popped); a route on another nested navigator is not seen.type,clear,fill:{kind: "text", verified, value, target}, whereverified: falsemeans a formatter or keyboard type rejected the write; readtarget.matchKind, and when it isnearestthe ref overlapped no field and a neighbour was written.scroll:{kind: "scrollOffset", changed, before, after}.set_checkbox:{kind: "checked", verified, before, after}, and itsvalueis the state read back, equal toafter, not the request.select_option:{kind: "selected", verified, value}. Do not re-snap to confirm whateffectalready answers. - A
warningsblock means do not conclude. It appears only while the app is not producing frames, and then a snapshot reads as empty and a gesture cannot land. Tapir wakes a hidden or paused desktop app at the start of every verb except the perf verbs,console,exceptions,close_appandevaluate, and stampsframesForced: true, which is normal (--dart-define=TAPIR_FORCE_FRAMES=falseturns it off). A hidden browser tab cannot be woken from inside: followwarnings.hint(CDPPage.bringToFront), then retry. The CLI does that itself when the session has acdpPort, repeating onlysnapandobserve; after an acting verb runtapir:snapto see what it did. - A merged control taps its own child. A
MergeSemanticsboundary whose centre is not on its control shows atapOwnersub-line (observe: atapOwnerfield).tapir_tapgoes to that control and reportsretargeted {from, to, ownerRect};centreHandled: truemeans the centre has a handler of its own, andretarget: false(CLI--no-retarget) taps the centre instead.tapPointOutsideOwnerin the response means the tap stayed at the centre: check the result. - Cut round trips. Pass
snapshot: "diff"(CLI--snapshot=diff) totap,fill,type,navigateorscrollto get only the changed lines since the last unfiltered snapshot; a filtered snap leaves that baseline as it was, so after an earlier plain snapshot the diff also lists everything changed since then, and with none it is the full tree. Take a plaintapir_snapfirst when you want only the last action's effect. Batch steps whose inputs you already know withtapir_run, and between steps that change the screen use--text,--keyorq<N>, sincee<N>belongs to one snapshot.tapir_tap { until: "Saved" }polls for that text after the tap and addsuntilMatched.
What each verb can and cannot do
- Some tools run outside the app.
tapir_hot_reload_and_snap,tapir_run,tapir_perf_run,tapir_perf_compare,tapir_perf_trace,tapir_resize_viewportandtapir_device_profileroute throughdowel:tapir:*in the MCP server's process, because the isolate cannot reload itself and CDP needs a browser connection. The two viewport tools work only on web started with--cdp-portand fail withCDP not enabledelsewhere; their override ends when the call returns, and onlytapir:resize_viewport --holdrun in the background keeps one. tapir_wait_for_network_idlereports idle until a count is wired. It reads the in-flight HTTP count throughpendingHttpCountReader, which an app can replace with its own counter or set to() => CrumbsStore.pendingHttpCountfrom thecrumbspackage (published on pub.dev). The count is zero unless an adapter or a reader the app installs reports one (MagicHttpFacadeAdapterfrommagic_devtoolsis one; an interceptor that only callsCrumbsStore.recordHttpcounts nothing), so without that it answersmatched: trueafterceil(idleMs / pollIntervalMs)consecutive zero samples (aboutidleMs; the first sample counts, and a request that starts and finishes between two samples is not seen).timeoutMsis checked only after a poll sample, so a window that completes at or aftertimeoutMsstill matches, and a timeout error needstimeoutMsto run out before the window completes (200 ms or less with the defaults): neither outcome proves anything, so wait on the UI instead.tapir_exceptionsis cumulative: read it as a delta (since,clear: true), or one boot-time fault rides along on every later read. Console ordering and the crumbs merge:${CLAUDE_SKILL_DIR}/references/mcp-tools.md.tapir_set_checkboxruns the gate;tapir_select_optiondoes not.set_checkboxreads the Semantics checked or toggled flag, so a checkbox, switch or radio from any library works; it taps only when the state differs (toggled: falsewhen it already matched, and then nothing is gated) and reads it back intovalueandeffect.after, polling for up to 1.5 s (without a second tap) while the read differs, so a switch that flips only once its request answers reads as verified. The tap goes to the control that set the flag, so a bareSwitchin a labelled container works. The gate scrolls a control below the fold into view and refuses a disabled, covered or moving one with its reason; there is no need to scroll first, and atapir_tapon the control would toggle it.checkStableandcheckReceivesEventsapply as on the other gated tools (the CLI command takes them as flags too), andchecksappears when the gate could not confirm. A control whose owner ignores the tap readsverified: false(the CLI exits 1 unless--jsonor--includeSnapshotis set). A ref with no state, or a merged node whose own flag is missing while several descendants have one, isrefused: snap again and pass the control's ref. Avalueother thantrue,false,1or0isinvalid_param.select_optioncalls aDropdownButton'sonChangedwith a string and taps nothing; for any other picker, tap it open and tap the option. Read order and return shapes:${CLAUDE_SKILL_DIR}/references/mcp-tools.md.tapir_evaluateruns one Dart expression in the app's root library. Over MCP, dowel's server answers it through the VM Service (dowel_tinkerand./bin/dowel tinker --eval="<expr>"evaluate the same way). A runtime exception, a compile error and a stale isolate come back as error results, and an expression withawaitreturns theFuture, not its value. A--cdp-portweb session cannot evaluate at all: dowel runs flutter on theweb-serverdevice, which has no VM Serviceevaluate, and the call returns an error (dowel 1.0.4 and newer says why in one line). Rundowel stop, thendowel start --device=chromewithout--cdp-portto evaluate; that gives up the CDP-only commands (tapir:resize_viewport,tapir:device_profile, clipped web screenshots).- The CLI differs from MCP in defaults and exits. MCP action tools embed a post-action snapshot by default; the CLI does not (
--includeSnapshotor--snapshot=full), and--jsonprints the raw envelope.tapir:wait_for,tapir:wait_for_network_idle, an unverifiedtapir:fill,tapir:typeortapir:set_checkbox, and a failedtapir:hot_reload_and_snapexit 1, so a script can chain on them; with--jsonor--includeSnapshotthe write verbs print the response and exit 0, so readeffect.verifiedthere. Which verbs take--json, and every exit code:${CLAUDE_SKILL_DIR}/references/cli-commands.md. - Each project needs its own running session. dowel records one session per project and falls back to
~/.dowel/state.json, the app started last anywhere, when the project has none. Rundowel startin each git worktree you drive, with its own ports, and start every run with./bin/dowel tapir:doctor, which flags a session that belongs to another project. A worktree nested inside the recorded root (.claude/worktrees/<slug>) counts as its owner, so doctor stays silent there; rundowel startin the worktree anyway.
Performance
- Read
refusedfirst.tapir_perf_begin, one driven interaction,tapir_perf_end. When the engine drew nothing in the session the report carriesrefused: true, a reason and no metrics, because a table of zeros would read as fast; the perf verbs do not wake a hidden app, so bring it to front and repeat. Then readcoverage.missing, theninsights, and drill into one withtapir_perf_insight { id: "I1" }. Attribution mode inflates milliseconds: rank by them, but compare milliseconds only betweenmode: "timing"sessions, and lettapir_perf_comparejudge twotapir_perf_runfiles on counts per painted frame.
Recipes
Snap, act, verify:
tapir_snap { interactiveOnly: true } pick e7 from the YAML
tapir_tap { ref: "e7", snapshot: "diff" } read effect.changed and the diff
tapir_wait_for { text: "Saved" } after HTTP, animation or navigation; check matchedObserve once, act many (forms, lists):
tapir_observe { roles: "textbox,button" } q1 Email, q2 Password, q3 Sign in
tapir_fill { ref: "q1", text: "user@example.com" }
tapir_fill { ref: "q2", text: "secret" }
tapir_tap { ref: "q3", until: "Dashboard" } untilMatched confirms the landingEdit, reload, verify: after saving a file call tapir_hot_reload_and_snap { screenshot: false }. On reloaded: false read error; on reloaded: true still read recentExceptions, since new code can throw on the next rebuild. A change to startup state needs dowel_hot_restart.
Navigate and confirm: tapir_navigate { route: "/settings" } returns navigated (the router shows the route or a page under it) and exactPath (the route itself); on navigated: false read reason. tapir_get_routes reports the current uri, not the declared routes.
The same flow from a shell:
./bin/dowel tapir:snap --interactiveOnly
./bin/dowel tapir:fill --ref=e4 --text="user@example.com"
./bin/dowel tapir:tap --ref=e7 --json | jq '.effect.changed'
./bin/dowel tapir:wait_for --text="Saved" --timeoutMs=8000 || echo "never appeared"Testing
A snapshot enricher adds YAML lines under each ref (shown with includeEnrichers: true). It is a synchronous String? Function(Element, RefRegistry) that returns null for an element it has nothing to say about and never keeps the Element; register it with TapirPlugin.enrichers.add(...) inside the !kReleaseMode block after TapirPlugin.install(). Test it by calling it directly:
import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:tapir/tapir.dart';
String? greetingEnricher(Element element, RefRegistry refs) {
final Widget widget = element.widget;
return widget is Text ? 'greeting: ${widget.data}' : null;
}
void main() {
testWidgets('greetingEnricher reads the Text data', (WidgetTester tester) async {
await tester.pumpWidget(
const Text('Hello', textDirection: TextDirection.ltr),
);
final Element element = tester.element(find.text('Hello'));
expect(greetingEnricher(element, RefRegistry.instance), 'greeting: Hello');
});
}In CI, drive the app with the CLI and chain on exit codes (rule 17).
References
| Read when | File |
Calling a tapir_* tool and you need its parameters, return shape or errors | ${CLAUDE_SKILL_DIR}/references/mcp-tools.md |
Running a tapir:* command from Bash: flags, output, exit codes | ${CLAUDE_SKILL_DIR}/references/cli-commands.md |
| An action failed the gate, a ref went stale, or the error envelope needs parsing | ${CLAUDE_SKILL_DIR}/references/actionability-and-refs.md |
| Composing a longer flow: modals, lists, long pages, logs, recovery | ${CLAUDE_SKILL_DIR}/references/workflows.md |
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
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.

