Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add skills/zakariaf/flutter-skills/widget-compositionnpx skills add zakariaf/Flutter-Skills --skill widget-compositiongit clone --depth 1 https://github.com/zakariaf/Flutter-SkillsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/zakariaf/flutter-skills/widget-composition)<a href="https://agentmods.dev/skills/zakariaf/flutter-skills/widget-composition"><img src="https://agentmods.dev/badge/skills/zakariaf/flutter-skills/widget-composition.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00211 | $0.04107 |
| Opus 5 | $0.00105 | $0.02054 |
| Sonnet 5 | $0.00042 | $0.00821 |
| Haiku 4.5 | $0.00021 | $0.00411 |
Grade A, and why
widget-composition scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 209 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Widget Composition
Build every screen from many small, const, single-purpose widget classes. A widget that does one thing rebuilds cheaply, reads clearly, tests in isolation, and can be lifted into a shared component library. The View is dumb: it watches one ViewModel and renders; logic lives in the Notifier, state in immutable value objects, layout in directional structural primitives. Applies to any screen, list, card, or shared component.
Read the reference for the task at hand:
references/rebuild-mechanics.md— why a class beats a method (Element.updateChild),constcanonicalization, the full key policy, and.selectfor narrowed rebuilds.references/structural-layout.md— edge-to-edge background vsSafeAreacontent, computed cell sizing, theGridViewcross/main-axis trap, directional insets, and IME/resizeToAvoidBottomInset.references/widget-and-data-selection.md— cheapest-widget table, data-class decision table (drift row vs record vs hand-written vs freezed), and gesture→fallback rules.
Run scripts/check-widget-composition.sh before a PR.
Non-negotiable rules
- Extract a
Widgetclass, never aWidget-returning method.Widget _buildHeader()is not a widget — its subtree has noElementof its own, soElement.updateChildnever gets to compare old vs. new and short-circuit; it rebuilds with the parent, cannot beconst, cannot take aKey, andfind.byTypecannot reach it in a test. consteverywhere it is legal, every fieldfinal.constconstructors canonicalize identical widgets to the same object, letting Flutter prune the subtree rebuild. Turn onprefer_const_constructors+prefer_const_constructors_in_immutables. Budget zero minutes hand-tuning const — letdart fix --applywrite it; never restructure a tree to make something const-able.- Keep
build()small and shallow. Past the complexity limits owned bydart3-idioms-and-coding-standards(build()≤ 80 lines; widget build nesting ≤ 5 — the deeper-nesting exception that table states for widget trees vs. logic ≤ 3), extract child widget classes. Abuild()you must scroll to read is too big. - One responsibility per widget. A component renders one thing; it does not also fetch data, format values, read a clock, hold app state, or schedule side effects.
- No I/O, formatting, or domain math in
build().build()can run 60×/second — no repository/DAO call, noDateTime.now(), noNumberFormat, no sorting. The Notifier precomputes a ready-to-render UI-state value; the widget only paints it. - The View is dumb and watches exactly one ViewModel. A
ConsumerWidgetdoesref.watch(oneNotifierProvider)and renders; intents go back viaref.read(...notifier). It never reaches a repository or DAO directly and never mutates persisted state. StatelessWidget/ConsumerWidgetby default. UseStatefulWidget/ConsumerStatefulWidgetonly for genuinely local, ephemeral UI state (AnimationController,TextEditingController,ScrollController,FocusNode). App/domain/session state lives in the Notifier.- Always
dispose()controllers created inState. LeakedAnimationController/TextEditingController/ScrollController/FocusNode/subscriptions retain memory and fire after teardown.cancel_subscriptions/close_sinksare errors. - Lists are lazy. Use
ListView.builder/SliverListfor variable/long lists. NeverListView(children: items.map(...).toList())for unbounded data — it builds every row eagerly. - Resolve identity, not content, in callbacks. A tap closure captures the stable id (
onTap: () => onSelect(item.id)), never a captured content value — a re-tap after an edit must not act on a stale capture. - Every gesture needs a visible, focusable fallback. Any behaviour reachable by touch must also be reachable by a labelled focusable control. A drag-only or long-press-only action is unreachable to switch-access and screen-reader users.
- Style from theme/tokens and logical directions. Colors/text styles come from
Theme.of(context)or aThemeExtension, never literal hex. UseEdgeInsetsDirectional/AlignmentDirectional(start/end), never hardcoded left/right, so RTL mirrors by construction.
What ships with it
6 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 5d ago First seen · 209 lines · 211 tokens per session scan A 9e68d2175904
widget-composition is a skill published in the GitHub repository zakariaf/Flutter-Skills (2 stars, last pushed 7d ago), licensed MIT. It adds 211 tokens to every session and 4,107 once invoked, about $0.0011 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other skills, from other repositories
common-store-changelog
Generate user-facing release notes for the App Store and Google Play from git history (App Store <=4000 chars, Google Play <=500). Use when generating release notes, app store changelog, play store release, or "what's new" text for a mobile app.
android-navigation-3
Install and migrate to Jetpack Navigation 3. Use when implementing Navigation 3 patterns including NavDisplay, NavKey routes, deep links, multiple backstacks, scenes (dialogs, bottom sheets), or migrating from Navigation 2.
flutter-auto-route-navigation
Implement typed routing, nested routes, and auth guards using autoroute in Flutter. Use when the task explicitly uses autoroute or its generated router; defer generic deep-link setup and other routing libraries.
flutter-dependency-injection
Configure service locator setup using injectable and getit in Flutter. Use when wiring dependency injection with getit or injectable.
flutter-getx-state-management
Implement reactive state with GetX controllers, bindings, and observables in Flutter. Use when managing app state with GetxController, Obx, GetBuilder, or dependency lifecycle—not unit tests for existing controllers.
accessibility
Audit or remediate Flutter widgets against WCAG 2.2 accessibility conformance levels A, AA, or AAA across iOS, Android, Web, macOS, Windows, and Linux.