iamantoniodinuzzo/flutter-toolkit/audit-presentation-layer
Claude Code and agent skill by iamantoniodinuzzo/flutter-toolkit
- community
Checking that the SKILL.md file is still in the repository.
Audit a Flutter presentation-layer file or folder (screens, widgets, pages, related widget tests) against the project''s documented UI guidelines — Riverpod v3 widget rules, rebuild isolation (const subtrees, scoped MediaQuery, builder child caching, setState blast radius), widget extraction and cohesion/coupling (oversized builds, function widgets, Law of Demeter params, layer/cross-feature imports), Robot Testing pattern, GoRouter conventions, layout antipatterns, side-effect handling, respon…
Install
npx vskill@latest install iamantoniodinuzzo/flutter-toolkit/audit-presentation-layerSKILL.md
The same SKILL.md was published earlier as iamantoniodinuzzo/claude-flutter/audit-presentation-layer.
Audit Presentation Layer
Runtime and resources
Use the current agent's native file, search, shell, and question tools; plain-text questions and direct sequential scans are valid fallbacks. Subagents are optional and require host permission. Bundled paths below are relative to this installed skill directory; application paths are relative to the target Flutter project. Resolve sibling skills through the installed skill registry (or sibling directories), never by assuming a skills/ folder in the application. If a required dependency is absent, name it and report the affected step as unavailable; never invent its rules or claim complete coverage.
Statically scans Flutter presentation-layer source and test files against bundled rule docs. Emits a violations table, then offers targeted fixes.
Rule source
Rules are bundled locally in rules. This skill does not delegate to ai_toolkit/ — it is self-contained.
Phase 0 — Resolve input and platform
Step 1 — Resolve path
Read the user's request and extract one of:
- Single file: a path ending in
.dart - Feature folder: a path containing a
presentation/directory - App root or `lib/`: a directory containing
pubspec.yaml, or alib/whose parent has one (enables app-level checks such as WEB-02 and ROUTER-03; arouting/folder or the router file itself also enables ROUTER-03)
If neither is clear, ask exactly one question:
"Provide a widget file path, a feature folder path containing apresentation/directory, or an app root."
Do not proceed until a path is confirmed.
Step 2 — Resolve target platforms
- Check the user's request for a
--platform=<value>argument.
- Accepted values:
web,android,ios,mobile,all. mobileexpands to{android, ios}.allexpands to{web, android, ios}.
- If no
--platformargument, readpubspec.yamlfrom the project root.
Look for the flutter: { platforms: { ... } } map (present after flutter create --platforms). Extract the declared platform keys (web, android, ios, linux, macos, windows). Use only web, android, ios from this set.
- If
pubspec.yamlhas noplatformsmap (or cannot be read), fall back toall.
Precedence: --platform arg > pubspec flutter.platforms > all (fallback).
State the resolved target at the start of Phase 4 output, e.g.:
Target platforms: android, ios (from pubspec)Target platforms: web (from --platform=web)Target platforms: all (fallback — no platforms map in pubspec)
Step 3 — Rule gating
Before applying any rule in Phase 3, check the rule's Platforms: tag in rules/CATALOG.md. Skip the rule if its platform set does not intersect the resolved target set. Rules tagged all always run.
Phase 1 — Load rule catalog
Read rules/CATALOG.md in full before scanning.
Do not read individual rule doc files yet — the catalog contains all heuristics needed for Phase 3. Open a specific rule doc only if you need to clarify a borderline case or produce a more detailed fix explanation.
Phase 2 — Discover files
Single-file mode
Target file = the provided .dart path.
Check whether a mirrored *_test.dart exists under test/src/:
Include the test file in the scan if it exists.
If the provided file is NOT under presentation/, classify it as domain-file (skip the test mirror check) and apply only UI-STR-01 to it.
Folder mode
Discover files with a permitted read-only subagent, otherwise scan directly. Use this prompt:
Also check for the mirrored test/src/ path of the given lib/ folder and include all *_test.dart files found there.
Also collect non-presentation/ dart files under the same feature root (e.g. application/, domain/, data/ siblings of presentation/).
Classify each file:
widget— non-test dart file underpresentation/widget-test—*_test.dartfile mirroring a presentation widgetdomain-file— dart file outsidepresentation/in the same feature treeweb-entry—web/index.html,web/flutter_bootstrap.js,web/*.css(app-root/`lib/` mode only, web target only)router— a.dartfile underlib/containingGoRouter(orpageBuilder:(app-root/`lib/` mode, a `routing/` folder, or the router file passed directly; mobile target only)
App-root mode
When the input is an app root or lib/, discover Dart files as in folder mode (all presentation/ trees under lib/) and additionally collect the web-entry and router files. For a feature folder or other single file, skip web-entry and router silently.
Phase 3 — Scan
For each file:
- Read the full file contents.
- Apply every heuristic in
rules/CATALOG.mdrelevant to the file type and
not gated out by the platform target (see Phase 0 Step 3):
widgetfiles → apply: RIV-WIDGET-, REBUILD-, EXTRACT-, COHESION-01, COUPLING-, LAYOUT-, SIDE-FX-01, ROBOT-04, ROUTER-, RESPONSIVE-, ASSET-, AUTOFILL-*, WEB-01widget-testfiles → apply: ROBOT-01, ROBOT-02, ROBOT-03, ROBOT-05domain-filefiles → apply: UI-STR-01 onlyweb-entryfiles → apply: WEB-02 onlyrouterfiles → apply: ROUTER-03 only
- For each match: record
{file, line_number, rule_id, severity, message, fix_hint, autofix_safe}.
Heuristic application notes:
- RIV-WIDGET-01: flag
ref.watch(lines where the enclosing method is NOT namedbuild. Look at method declarations above the line to determine context. - RIV-WIDGET-02: flag
ref.watch(someProvider)result where the return value is immediately accessed with.fieldName(within 3 lines) and no.select(appears on the watch call. - RIV-WIDGET-03: flag
Consumer(blocks where thebuilder:body exceeds 50 lines. - RIV-WIDGET-04: flag
ref.read(lines inside abuild(BuildContextmethod span. - REBUILD-01: inside
buildspans, flag all-literal constructor calls (SizedBox(,EdgeInsets.*(,Icon(Icons., literal-onlyText(,Divider() not preceded byconstand not covered by an enclosingconst(check ~3 lines above). - REBUILD-02: flag
MediaQuery.of(context).<prop>single-property accesses (size,padding,viewInsets,platformBrightness,textScaler); fix is the scopedMediaQuery.<prop>Of(context)accessor. - REBUILD-03: flag
AnimatedBuilder(/ListenableBuilder(/ValueListenableBuilder(spans with nochild:argument and abuilder:body > ~10 lines. - REBUILD-04: in files with
setState(, measure the enclosing class'sbuild(span; flag eachsetState(call when that span > 50 lines. - EXTRACT-01: flag
build(method declarations whose span (signature to matching brace) exceeds 80 lines. - EXTRACT-02: flag top-level
Widget name(declarations (column 0) andstatic Widget name(anywhere in widget files. - COHESION-01: for widget classes with one non-Key constructor field of a non-primitive project type, count distinct
<field>.<member>accesses in the class body; flag the field when ≤ 2 distinct members are read. - COUPLING-01: in
presentation/files, flagimportlines whose path contains/data/. - COUPLING-02: in
features/<name>/presentation/files, flag imports matchingfeatures/<other>/presentation/where<other>≠ own feature. - ROBOT-01: flag any
find.text(in*_test.dartfiles. - ROBOT-02: flag any
find.byTooltip(in*_test.dartfiles. - ROBOT-03: flag all
pumpAndSettle(lines in test files that also containCircularProgressIndicatororLinearProgressIndicator. - ROBOT-04: for each interactive widget found (see catalog for list), check if the same file declares a Key for it; flag if missing.
- ROBOT-05: flag public
find…()methods in Robot classes (method name starts withfindbut no leading_). - ROUTER-01: flag
context.push(andGoRouter.of(context).push(inpresentation/source files. - ROUTER-02: flag
AppBar(in*_screen.dartfiles whereleading:is not present in the sameAppBar(…)span. - ROUTER-03 _(mobile target, router file, app-root/
lib//routing/input only)_: flag a ≤ 3-line helper returningNoTransitionPage(/NoTransitionPage<...>((or inlinepageBuilder: ... => NoTransitionPage() used by ≥ 50% ofGoRoutepage builders and ≥ 3 routes; one-offs below the threshold never fire. Severity is warning when android/ios is explicitly targeted, info on theallfallback. Greplib/forpageTransitionsTheme:to pick the message — theme set but bypassed vs no transition strategy — and note a light/dark mismatch. Fix text: adaptivePageTransitionsThemeon both themes +MaterialPage; seeflutter-go-router§ Page Transitions, or run/page-transitions-init. - LAYOUT-01: flag any file with more than one
Scaffold(occurrence. - LAYOUT-02: flag
Widget _methods inside widget class bodies. - SIDE-FX-01: flag
showDialog(,Navigator.push(,ScaffoldMessenger.of(context).show,addPostFrameCallback(insidebuild(BuildContextmethod spans. - UI-STR-01: flag long string literals (> ~20 chars, > 3 words) in files outside
presentation/. - RESPONSIVE-01: flag
MediaQuery.of(context).sizeorMediaQuery.sizeOf(context)used in anif/ternary branch for layout decisions; also flagwidth:/height:values ≥ 100 onContainer(/SizedBox(constructor spans (proxy for hard-coded structural sizing, not small decorative values). - RESPONSIVE-02: flag width-like expressions (
constraints.maxWidth,size.width,width) compared against 3–4 digit numeric literals inif/ternary/switchconditions; skip when the value comes from a named constant (e.g.AppBreakpoints.compact). - RESPONSIVE-03: within
Row(spans, flag theRow(line when ≥ 2 children carrywidth: <num>and noFlexible(/Expanded(appears in the span. - RESPONSIVE-04: flag literal
crossAxisCount: <num>inSliverGridDelegateWithFixedCrossAxisCount(andGridView.count(spans, unless computed from constraints/width. - ASSET-01: flag
SvgPicture.asset(/Image.asset(/AssetImage(in first-route/shell widgets whose path has noSvgAssetLoader(/precacheImage(warm-up in startup code; skip engine-registry androotBundle-only assets. Warning for SVG, info for raster. - ASSET-02: needs project root. Flag raster assets whose pixels exceed display logical px × 3 × 1.5, or (display size unknown) decoded
w × h × 4> 4 MB. Report only. - ASSET-03: needs project root. Flag pubspec-declared assets with no reference; follow
flutter_genaccessors and runtime-built paths first. Report only — never delete. - ASSET-04: flag warm-ups with no error handler at the creation expression, a cache key that cannot match the widget's (
theme/colorMapper/bundle/DefaultSvgTheme), orprecacheImageon engine-managed assets. - AUTOFILL-01: flag a password field (
obscureText: trueorPassword\w*Field) alongside an email/username field (TextInputType.emailAddressor label/controller matchingemail|user(name)?|login) with noAutofillGroup(enclosing both in thebuildspan. - AUTOFILL-02: flag password/email/name/phone fields lacking
autofillHints:, and hint/keyboard mismatches (AutofillHints.emailwithoutTextInputType.emailAddress;AutofillHints.passwordon a new-password field inregister|sign_?up|reset|change_?passwordfiles). Skip non-personal fields (e.g. organisation name). - AUTOFILL-03: (a) flag
AutofillGroup(spans without `onDispo
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/audit-presentation-layer/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/iamantoniodinuzzo/flutter-toolkit/audit-presentation-layer)