AI Skill MartBrowse skillsPromptsProgramsLearnWhat is a Skill?
← Back to list

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 Cubit and Bloc with 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, plus context.read vs context.watch rules.
  • Locks in the three-layer architecture (Presentation → Business Logic → Data via Repository → DataProvider) and bans bloc-to-bloc calls.
  • Ships bloc_test + mocktail test 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

  1. "Create a Cubit and state for the login feature" → generates LoginState, LoginStatus, and copyWith per convention.
  2. "This BlocBuilder ignores loading and failure" → rewrites it as an exhaustive switch over all states.
  3. "Write tests for LoginCubit" → produces blocTest cases 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)
  1. Download the ZIP with the button below.
  2. In Claude, open Settings → Capabilities and turn on 'Code execution and file creation'. (one time)
  3. Go to Customize → Skills → + → 'Upload a skill' and upload the ZIP.
↓ Download 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.

  1. Open a terminal.
  2. Clone the repository: git clone https://github.com/evanca/flutter-ai-rules.git
  3. Create the skills directory: mkdir -p ~/.claude/skills
  4. Copy just this skill: cp -r flutter-ai-rules/skills/bloc ~/.claude/skills/
  5. Verify that ~/.claude/skills/bloc/SKILL.md exists.
  6. Restart Claude Code and try a prompt like "create a Cubit for login" to confirm the skill activates.
  7. Make sure your project's pubspec.yaml includes flutter_bloc, equatable, and bloc_test / mocktail for tests.