Guide · Agent skill
How to use the Flutter Bloc/Cubit State Guide agent skill
Updated · written with AI from the project's own documentation and checked against our catalogue data
The bloc-cubit skill is a written guide that teaches an AI agent how to structure state management in Flutter and Dart apps using the bloc and flutter_bloc packages. Once it is installed, your agent can decide whether a feature should use a simple Cubit or a full Bloc, which package to add, and how to handle widget binding, disposal and tests. This page explains what the skill does, how to install it, how to ask for it, and where its limits are.
Quick start
- 1Download and unzip. Download the ZIP file from this page and unzip it to get the bloc-cubit folder with SKILL.md.
- 2Choose the install location. Place the folder in ~/.claude/skills/ for all projects, or in your project's .claude/skills/ folder for one project.
- 3Or upload in the Claude apps. In the Claude apps, go to Settings, then Capabilities, then Skills, and upload the skill.
- 4Describe your Flutter state task. Ask in plain language about Bloc, Cubit, flutter_bloc, state management, lifecycle or testing.
- 5Review the choice. Check the agent's Cubit vs Bloc decision and the package it recommends, bloc or flutter_bloc.
- 6Check lifecycle and tests. Confirm that manually created instances are closed, provider-owned ones are not, and tests cover the states or transitions.
What is an agent skill, and what does this one make the agent do?
An agent skill is a folder containing a SKILL.md file. An agent runtime that loads SKILL.md files reads the instructions when a request matches the skill's description. This skill only changes the advice and code the agent writes. It does not run anything by itself.
The skill covers four things: choosing between Cubit and Bloc, setting up bloc and flutter_bloc correctly, following lifecycle and UI binding rules, and writing tests for both kinds of state holder.
- Cubit for simple, direct state updates such as counters, toggles, filters, form flags and theme mode.
- Bloc for event-driven flows with loading, success and failure transitions, such as auth, pagination, checkout, sync and multi-step workflows.
- Architecture rule: the repository or service owns I/O, the bloc or cubit owns state, and the UI only dispatches actions and renders state.
- Testing rule: test a Cubit by calling methods and asserting emitted states; test a Bloc by adding events and asserting the transition sequence.
How do you install the bloc-cubit skill?
Download the ZIP file from this page and unzip it. The skill is delivered as a single file, SKILL.md. You can install it in one of two places:
- For all your projects: unzip it into ~/.claude/skills/ so the bloc-cubit folder containing SKILL.md sits inside that directory.
- For one project: unzip it into your project's .claude/skills/ folder.
- In the Claude apps: go to Settings, then Capabilities, then Skills, and upload the skill there.
How do you trigger the skill with natural requests?
You do not need a special command. Describe the Flutter state work you are doing, and mention Bloc, Cubit, flutter_bloc or state management. The skill's description covers choosing Bloc vs Cubit, using bloc and flutter_bloc together, lifecycle, testing and safe defaults, so requests about those topics are the ones it is meant to match.
- Should this login flow be a Bloc or a Cubit?
- Set up state management for my settings screen with flutter_bloc.
- Add a BlocProvider for my cart feature and make sure it gets disposed correctly.
- Write bloc tests for my checkout events and their state transitions.
- Why is my widget rebuilding too often? Should I use buildWhen or BlocSelector?
What examples of good output should you expect?
The guide asks the agent to show the smallest working Bloc or Cubit first, explain why it chose Bloc or Cubit, and state whether the dependency should be bloc or flutter_bloc. If lifecycle is manual, the agent should also include cleanup and testing notes.
For a Dart-only package, the skill says to add bloc. For a Flutter UI, it says to add flutter_bloc and let it bring bloc in as a dependency, so you do not need to add both.
What does the skill need, and what about scripts and network?
The skill needs a Flutter or Dart project, because the guidance targets the bloc and flutter_bloc packages, and an agent runtime that loads SKILL.md files. It runs no scripts and uses no network. The file contains no code samples or version numbers to check against, so the agent is told to follow the current Flutter state management docs and the bloc package docs rather than the skill itself.
Because the skill runs nothing, the main safety point is to review the code the agent writes, especially lifecycle handling and any network calls, before you commit it.
- Runs scripts: no.
- Uses network: no.
- Licence: MIT.
What are the common mistakes the skill warns about?
The skill lists pitfalls it expects the agent to avoid. These are useful checks for you as well.
- Do not put network calls directly in widgets.
- Do not use Bloc for trivial local state.
- Do not add both bloc and flutter_bloc in a Flutter app when only flutter_bloc is needed.
- Do not forget close() on instances you create manually.
- Do not manually close instances owned by BlocProvider.
- Do not emit duplicate states unless the transition is meaningful.
- Do not let one bloc grow into an app-wide dumping ground.
Tips for getting the best results
State the feature and its complexity in your request, for example whether it has events, async loading or only simple toggles. That is the main input the Cubit vs Bloc decision depends on.
Check the agent's package versions and API calls against the official docs, since the skill does not contain a reference to verify against.
- Name the feature boundary, so the agent knows where to place BlocProvider.
- Ask for tests alongside the code, so the transition sequence is covered from the start.
- Mention if you already use another state library, so the agent does not mix patterns.
What people use it for
- Deciding whether a settings toggle should be a Cubit or a login flow should be a Bloc.
- Setting up a feature with BlocProvider, BlocBuilder and BlocListener in a Flutter app.
- Refactoring a widget that calls the network directly so that a repository owns the I/O and a bloc owns the state.
- Writing Cubit or Bloc unit tests that assert emitted states or event transition sequences.
- Reviewing an existing bloc for duplicate emits, missing close() calls or an overgrown single bloc.
Frequently asked questions
Is the bloc-cubit skill free?
The skill is licensed under MIT, as stated on this page. The source file contains no pricing information, so check the licence file in the repository for the full terms.
What do I need to use the bloc-cubit skill?
You need a Flutter or Dart project, since the guidance targets the bloc and flutter_bloc packages, and an agent runtime that loads SKILL.md files. The skill runs no scripts and uses no network.
Where do I put the bloc-cubit skill?
Unzip it into ~/.claude/skills/ to make it available across projects, or into a project's .claude/skills/ folder to limit it to one project. In the Claude apps you can instead upload it under Settings, then Capabilities, then Skills.
Does the skill work with Riverpod, Provider or GetX?
No. The guidance is specific to bloc and flutter_bloc, and the agent may mix patterns incorrectly if you use another state management library. Pick a skill written for that library instead.
Does the skill run code or check my bloc package versions?
No. The skill only changes the advice and code the agent writes. It contains no code samples or version numbers, and it tells the agent to follow the current Flutter and bloc docs, so verify the API details yourself.
Should I use Cubit or Bloc for my feature?
Use Cubit for simple method-call updates like counters, toggles and filters. Use Bloc when user actions should be explicit events with loading, success and failure transitions, such as auth or checkout.
New agent skills, repos and AI tools — every week
The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.
Our verdict
Use this skill if you are building or refactoring Flutter state with bloc or flutter_bloc and want an agent that applies consistent rules for Cubit vs Bloc, widget binding, disposal and tests. Pick something else if you use Riverpod, Provider, GetX or a non-Flutter stack, or if you need an authoritative, version-checked API reference.
Download the skill