Flutter Widget Refactorer skill for Claude and Codex
Refactors a long, deeply nested Flutter build method into small, const-friendly widgets, with the same behaviour and a short list of what changed.
Install it once and Claude or Codex runs it for you. When your request matches, your AI loads the skill, asks for anything it is missing, and works through the template itself. Prefer to fill it in by hand? See the full prompt template.
Download the skill (.zip) · View SKILL.md
When it is used
Use when a Flutter developer has a long nested build method and wants it split into small reusable widgets without changing behaviour. Do not use for creating a new screen or writing tests for a widget. Related topics: flutter, dart, coding.
What it will ask you for
- Flutter code (longer free text)
- State management used (choose one: None or StatefulWidget, Provider, Riverpod, Bloc, GetX)
- Main issue (choose one: Too long and nested, Performance issues, Hard to read, Reusability)
- Specific targets (choose any: Extract sub-widgets, Use const constructors, Improve naming, Separate logic from UI)
- Add documentation comments (choose one: Yes, No)
How it works
- Read the code and mark the sections that can stand alone as widgets.
- Extract each section into its own widget class and pass only the data it needs.
- Move logic out of build using the existing state management and add const constructors where possible.
- Rename unclear identifiers, add doc comments if requested, then list every change and risk.
What you get
The refactored Dart code with each extracted widget as its own class, followed by a bullet list of changes and any behaviour risks.
What it watches out for
- Replacing nested widgets with helper methods, which keeps rebuilding the whole tree.
- Changing state management or adding a package during a refactor.
- Passing the whole model to every child, which defeats the benefit of const and narrow rebuilds.
How to install
Claude.ai and the Claude desktop app
- Download the skill .zip.
- Open Settings, then Capabilities, and find Skills.
- Choose Upload skill and select the .zip.
- Ask Claude for help with the task. It loads the skill when your request matches.
Claude Code
- Download the skill .zip.
- Unzip it into ~/.claude/skills/ (or .claude/skills/ inside a project).
- Start a new session. Claude Code loads the skill when your request matches.
Codex
- Download the skill .zip.
- Unzip it into ~/.agents/skills/ (or .agents/skills/ inside a project).
- Codex picks it up on its own. Type $ and the skill name to use it, or just ask for the task.
Cursor
- Download the Cursor rule (.mdc).
- Save it in .cursor/rules/ inside your project.
- Cursor's agent applies the rule when your request matches its description.
AGENTS.md (Codex, Cursor, and other coding agents)
- Copy the AGENTS.md section.
- Paste it into AGENTS.md at the root of your repository, creating the file if needed.
- Coding agents that read AGENTS.md follow it when your request fits.