Optimize Flutter Codebase
Purpose
Use this skill to audit and improve an existing Flutter codebase with practical, high-impact optimizations.
Activation
Activate when user asks to optimize, improve, harden, refactor, or speed up a Flutter app or a specific module.
Input Collection
Capture minimum context first:
- Scope: whole app, feature folder, or specific files.
- Target: performance, architecture, code quality, app size, stability, testability, or all.
- Optimization mode: quick, standard, deep.
- Risk tolerance: low-risk only or allow medium refactors.
If scope is missing, default to project-level scan.
Optimization Modes
- Quick mode: fast audit + top 5 improvements.
- Standard mode: prioritized plan + key code changes.
- Deep mode: broader refactor roadmap with staged implementation plan.
Optimization Workflow
Follow this order:
- Baseline and hotspots
- Map project structure and critical execution paths.
- Identify hotspots in startup path, navigation, rendering-heavy screens,
network/data pipeline, and state updates.
- Architecture and boundaries
- Check separation of presentation, logic, and data layers.
- Detect coupling, duplicated logic, and module boundary leaks.
- Recommend consolidation where appropriate.
- State management efficiency
- Identify excessive rebuild patterns and state over-scoping.
- Ensure state ownership is close to consumers where possible.
- Recommend selector/listener granularity improvements.
- Rendering and UI performance
- Look for expensive build methods and unnecessary widget rebuilds.
- Prefer const constructors where safe.
- Suggest list virtualization patterns and image handling improvements.
- Network, caching, and persistence
- Evaluate API call strategy, retry behavior, and error handling.
- Recommend caching and offline-first patterns where relevant.
- Validate model parsing path and background processing suitability.
- Reliability and error handling
- Identify weak async error handling and null-safety risks.
- Ensure domain-level error mapping and user-safe fallbacks.
- App size and release readiness
- Recommend app-size analysis and dependency pruning.
- Flag large assets, redundant packages, and avoidable transitive bloat.
- Testing and maintainability
- Detect missing tests in critical modules.
- Recommend minimum unit/widget/integration coverage targets by risk.
Output Format
Return in this structure:
- Optimization Scope and Mode
- Findings (ordered by impact)
- Recommended Changes (ordered by effort and risk)
- Quick Wins (can do now)
- Medium Refactors (next)
- Validation Checklist (how to verify improvements)
- Optional Next Iteration Plan
Behavior Rules
- Prioritize evidence-backed findings from actual code.
- Avoid vague suggestions not tied to observed patterns.
- For each recommendation, include expected impact and risk level.
- Prefer incremental changes before large rewrites.
- Keep business behavior unchanged unless user explicitly asks otherwise.
Risk Labels
Use these labels for each recommendation:
- Low: safe local changes, minimal regression risk.
- Medium: structural changes with moderate validation required.
- High: broad refactors requiring staged rollout and tests.
Validation Checklist
Before final response, ensure:
- Findings are prioritized by impact.
- Each recommendation has risk label and expected result.
- Suggested changes are scoped to user-selected area.
- A practical verify plan is included (tests, profiling, runtime checks).
Completion Template
Use this response layout:
- Scope: <project/module/files>
- Mode: <quick/standard/deep>
- Top Findings: <3-7 items>
- Recommended Changes:
- Verification Steps: <commands/checks>
- Next Iteration:
Source: mdazadhossain95/flutter-agent-skills — distributed by TomeVault.
1---2name: flutter-optimize-codebase3description: Optimizes a Flutter codebase for performance, maintainability, architecture quality, and release readiness using a prioritized, evidence-driven improvement plan. Use when this capability is needed.4---5# Optimize Flutter Codebase67## Purpose8Use this skill to audit and improve an existing Flutter codebase with practical, high-impact optimizations.910## Activation11Activate when user asks to optimize, improve, harden, refactor, or speed up a Flutter app or a specific module.1213## Input Collection14Capture minimum context first:15- Scope: whole app, feature folder, or specific files.16- Target: performance, architecture, code quality, app size, stability, testability, or all.17- Optimization mode: quick, standard, deep.18- Risk tolerance: low-risk only or allow medium refactors.1920If scope is missing, default to project-level scan.2122## Optimization Modes23- Quick mode: fast audit + top 5 improvements.24- Standard mode: prioritized plan + key code changes.25- Deep mode: broader refactor roadmap with staged implementation plan.2627## Optimization Workflow28Follow this order:29301) Baseline and hotspots31- Map project structure and critical execution paths.32- Identify hotspots in startup path, navigation, rendering-heavy screens,33 network/data pipeline, and state updates.34352) Architecture and boundaries36- Check separation of presentation, logic, and data layers.37- Detect coupling, duplicated logic, and module boundary leaks.38- Recommend consolidation where appropriate.39403) State management efficiency41- Identify excessive rebuild patterns and state over-scoping.42- Ensure state ownership is close to consumers where possible.43- Recommend selector/listener granularity improvements.44454) Rendering and UI performance46- Look for expensive build methods and unnecessary widget rebuilds.47- Prefer const constructors where safe.48- Suggest list virtualization patterns and image handling improvements.49505) Network, caching, and persistence51- Evaluate API call strategy, retry behavior, and error handling.52- Recommend caching and offline-first patterns where relevant.53- Validate model parsing path and background processing suitability.54556) Reliability and error handling56- Identify weak async error handling and null-safety risks.57- Ensure domain-level error mapping and user-safe fallbacks.58597) App size and release readiness60- Recommend app-size analysis and dependency pruning.61- Flag large assets, redundant packages, and avoidable transitive bloat.62638) Testing and maintainability64- Detect missing tests in critical modules.65- Recommend minimum unit/widget/integration coverage targets by risk.6667## Output Format68Return in this structure:69701. Optimization Scope and Mode712. Findings (ordered by impact)723. Recommended Changes (ordered by effort and risk)734. Quick Wins (can do now)745. Medium Refactors (next)756. Validation Checklist (how to verify improvements)767. Optional Next Iteration Plan7778## Behavior Rules79- Prioritize evidence-backed findings from actual code.80- Avoid vague suggestions not tied to observed patterns.81- For each recommendation, include expected impact and risk level.82- Prefer incremental changes before large rewrites.83- Keep business behavior unchanged unless user explicitly asks otherwise.8485## Risk Labels86Use these labels for each recommendation:87- Low: safe local changes, minimal regression risk.88- Medium: structural changes with moderate validation required.89- High: broad refactors requiring staged rollout and tests.9091## Validation Checklist92Before final response, ensure:93- Findings are prioritized by impact.94- Each recommendation has risk label and expected result.95- Suggested changes are scoped to user-selected area.96- A practical verify plan is included (tests, profiling, runtime checks).9798## Completion Template99Use this response layout:1001. Scope: <project/module/files>1012. Mode: <quick/standard/deep>1023. Top Findings: <3-7 items>1034. Recommended Changes: <prioritized list with risk>1045. Verification Steps: <commands/checks>1056. Next Iteration: <optional follow-up optimization track>106107---108> Source: [mdazadhossain95/flutter-agent-skills](https://github.com/mdazadhossain95/flutter-agent-skills) — distributed by [TomeVault](https://tomevault.io).109<!-- tomevault:4.0:skill_md:2026-06-16 -->