Skip to content

[Skill idea] flutter-bloc-cubit-feature — scaffold Bloc/Cubit features with layered architecture #162

Description

@AbdelghaniDjedidi2001

Skill idea

Add a Flutter skill for generating and updating Bloc/Cubit-based features.

The skill should help agents scaffold feature-first Flutter code using:

  • data/, logic/, and ui/ layers
  • Cubit for command-style flows
  • Bloc for event-heavy, stream-heavy, or transformer-based flows
  • Freezed union states
  • repository + ApiResult<T> style result handling
  • route-level BlocProvider / MultiBlocProvider
  • DI registration
  • pagination patterns
  • side-effect handling via listeners
  • targeted tests

Why this is useful

Bloc/Cubit is common in production Flutter apps, but generated code is often too generic. A skill could guide agents to produce complete, repo-ready features instead of only isolated Cubit or Bloc classes.

Example prompts

  • Create a new orders feature using Bloc with pagination and filters.
  • Add a Cubit-based profile settings feature.
  • Convert this screen to use Cubit with Freezed states.
  • Add DI, routing, and tests for this feature.
  • Decide whether this flow should use Bloc or Cubit.

Suggested behavior

The skill should:

  1. Ask for the feature name and app structure when unclear.
  2. Choose Cubit by default for linear command-style flows.
  3. Choose Bloc when there are multiple event types, streams, subscriptions, debounce, or complex transitions.
  4. Generate feature folders under a feature-first structure.
  5. Include state, logic, repository integration, UI provider wiring, and tests.
  6. Keep navigation, snackbars, dialogs, and overlays as listener-handled side effects.
  7. Avoid putting feature-local state into shared app/runtime owners.

Possible output

A complete feature scaffold including:

  • model/repository files when needed
  • Cubit or Bloc + Freezed state
  • screen/widget integration
  • DI registration instructions
  • routing instructions
  • tests
  • build runner command

Related patterns

This is inspired by production Bloc/Cubit architecture where Cubit is the default, Bloc is used for event-heavy flows, dependencies are registered through DI, and route-level providers define feature scope.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions