Bloc State Management Rules
A convention skill for designing, implementing, and testing Cubits and Blocs with bloc/flutter_bloc in Flutter.
Dev & CodingIntermediate★ 675⑂ 67AI score 8/10Last updated: Nov 12, 2026
What it does
- Decides between
CubitandBlocwith a situation table (default to Cubit; use Bloc for event traceability or transformers). - Enforces naming conventions (past-tense events, noun states) and shows when to pick sealed-class states vs a single state with a status enum.
- Provides a widget cheat sheet for
BlocProvider,BlocBuilder,BlocListener,BlocConsumer,BlocSelector, pluscontext.readvscontext.watchrules. - Locks in the three-layer architecture (Presentation → Business Logic → Data via Repository → DataProvider) and bans bloc-to-bloc calls.
- Ships
bloc_test+mocktailtest templates and a common-pitfalls table with fixes.
Who it's for
- Flutter developers and teams standardizing on the bloc pattern.
- Teams whose code reviews keep re-litigating state management style.
- Developers refactoring setState/Provider code into blocs.
Examples
- "Create a Cubit and state for the login feature" → generates
LoginState,LoginStatus, andcopyWithper convention. - "This BlocBuilder ignores loading and failure" → rewrites it as an exhaustive switch over all states.
- "Write tests for LoginCubit" → produces
blocTestcases asserting [loading, success] and [loading, failure] emissions.
· · · Install guide · · ·
Try it now, no install
Paste this into Claude to use the skill without installing anything.
Read the instructions in this file and follow them to help me: https://raw.githubusercontent.com/evanca/flutter-ai-rules/HEAD/skills/bloc/SKILL.md What I want: (describe your task here)
If Claude can't open the link, open it yourself and paste the contents instead.
↓ If it works for you, download the ZIP below and install it. Then it runs on its own — no pasting each time.
Install in the Claude app (no terminal)
- Download the ZIP with the button below.
- In Claude, open Settings → Capabilities and turn on 'Code execution and file creation'. (one time)
- Go to Customize → Skills → + → 'Upload a skill' and upload the ZIP.
Install in Claude Code
Let Claude do it — paste this into Claude Code
Install the skill I found on AI Skill Mart. Copy the skills/bloc folder from the GitHub repo evanca/flutter-ai-rules into my ~/.claude/skills/bloc/. When it's done, tell me in one line what this skill can do.
Install with a command instead
git clone https://github.com/evanca/flutter-ai-rules.git /tmp/flutter-ai-rules && mkdir -p ~/.claude/skills && cp -r /tmp/flutter-ai-rules/skills/bloc ~/.claude/skills/⚠ This is a third-party skill. Check the source repository before installing.
- Open a terminal.
- Clone the repository:
git clone https://github.com/evanca/flutter-ai-rules.git - Create the skills directory:
mkdir -p ~/.claude/skills - Copy just this skill:
cp -r flutter-ai-rules/skills/bloc ~/.claude/skills/ - Verify that
~/.claude/skills/bloc/SKILL.mdexists. - Restart Claude Code and try a prompt like "create a Cubit for login" to confirm the skill activates.
- Make sure your project's
pubspec.yamlincludesflutter_bloc,equatable, andbloc_test/mocktailfor tests.
View source on GitHub ↗License: MIT