Agent skill

Riverpod

by evanca in evanca/flutter-ai-rules

A skill your agent uses when setting up providers, combining requests, managing state disposal, passing arguments, performing side effects, or testing providers (Riverpod).

MITAuto-check passedMobile

Install Riverpod

skills CLI
$ npx skills add evanca/flutter-ai-rules --skill riverpod -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install evanca/flutter-ai-rules riverpod --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/evanca/flutter-ai-rules.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/riverpod .claude/skills/riverpod && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
riverpod
GitHub stars
649
Token cost
~1.8k tokens
SKILL.md length
488 words
Files
1
Skills in repo
37
Repo updated
First seen
Licence
MIT

At a glance

A skill your agent uses when setting up providers, combining requests, managing state disposal, passing arguments, performing side effects, or testing providers (Riverpod).

  • Works in 10 steps: Setup → Defining Providers → Using Ref → …
  • Setting up providers
  • SKILL.md covers 1. Setup, 2. Defining Providers, 3. Using Ref and 4. Combining Providers, plus 7 more sections
  • Calls dart

What it does

Riverpod is an agent skill from evanca/flutter-ai-rules. Use when setting up providers, combining requests, managing state disposal, passing arguments, performing side effects, or testing providers (Riverpod).

Its SKILL.md is about 1.8k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Mobile. The repository describes itself as: Flutter AI Skills and Rules for Claude, Codex, Cursor, and Other AI-Powered IDEs. The licence is MIT.

When your agent uses it

  • Setting up providers
  • Combining requests
  • Managing state disposal
  • Passing arguments

Example prompts

  • “/riverpod”

Workflow steps

10 steps, taken from the step headings in SKILL.md.

  1. Setup
  2. Defining Providers
  3. Using Ref
  4. Combining Providers
  5. Passing Arguments (Families)
  6. Auto Dispose & State Lifecycle
  7. Eager Initialization
  8. Performing Side Effects
  9. Provider Observers
  10. Testing

What it can do on your machine

Read from SKILL.md and the folder at commit 7b9cce2. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • dart

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • github.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Riverpod loads about 1.8k tokens when it runs. Until then it costs about 40 tokens; SKILL.md has 488 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~40
When it runs · the whole SKILL.md, loaded when a task matches
~1.8k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from evanca/flutter-ai-rules at commit 7b9cce2, republished under its MIT licence (© evanca). 488 words, ~1,759 tokens.

Download SKILL.mdSave it as .claude/skills/riverpod/SKILL.md (or your agent's skills folder).
name
riverpod
description
Use when setting up providers, combining requests, managing state disposal, passing arguments, performing side effects, or testing providers (Riverpod).
license
MIT

Riverpod Skill

This skill defines how to correctly use Riverpod for state management in Flutter and Dart applications.


1. Setup

dart
void main() {
  runApp(const ProviderScope(child: MyApp()));
}
  • Wrap your app with ProviderScope directly in runApp — never inside MyApp.
  • Install and use riverpod_lint to enable IDE refactoring and enforce best practices.

2. Defining Providers

dart
// Functional provider (codegen)
@riverpod
int example(Ref ref) => 0;

// FutureProvider (codegen)
@riverpod
Future<List<Todo>> todos(Ref ref) async {
  return ref.watch(repositoryProvider).fetchTodos();
}

// Notifier (codegen)
@riverpod
class TodosNotifier extends _$TodosNotifier {
  @override
  Future<List<Todo>> build() async {
    return ref.watch(repositoryProvider).fetchTodos();
  }

  Future<void> addTodo(Todo todo) async { ... }
}
  • Define all providers as final top-level variables.
  • Use Provider, FutureProvider, or StreamProvider based on the return type.
  • Use ConsumerWidget or ConsumerStatefulWidget instead of StatelessWidget/StatefulWidget when accessing providers.

3. Using Ref

MethodUse for
ref.watchReactively listen — rebuilds when value changes. Use during build phase only.
ref.readOne-time access — use in callbacks/Notifier methods, not in build.
ref.listenImperative subscription — prefer ref.watch where possible.
ref.onDisposeCleanup when provider state is destroyed.
dart
// In a widget
class MyWidget extends ConsumerWidget {
  @override
  Widget build(BuildContext context, WidgetRef ref) {
    final value = ref.watch(myProvider);
    return Text('$value');
  }
}

// Cleanup in a provider
final provider = StreamProvider<int>((ref) {
  final controller = StreamController<int>();
  ref.onDispose(controller.close);
  return controller.stream;
});
  • Never call ref.watch inside callbacks, listeners, or Notifier methods.
  • Use ref.read(yourNotifierProvider.notifier).method() to call Notifier methods from the UI.
  • Check context.mounted before using ref after an await in async callbacks.

4. Combining Providers

dart
@riverpod
Future<String> userGreeting(Ref ref) async {
  final user = await ref.watch(userProvider.future);
  return 'Hello, ${user.name}!';
}
  • Use ref.watch(asyncProvider.future) to await an async provider's resolved value.
  • Providers only execute once and cache the result — multiple widgets listening to the same provider share one computation.

5. Passing Arguments (Families)

dart
@riverpod
Future<Todo> todo(Ref ref, String id) async {
  return ref.watch(repositoryProvider).fetchTodo(id);
}

// Usage
final todo = ref.watch(todoProvider('some-id'));
  • Always enable autoDispose for parameterized providers to prevent memory leaks.
  • Use Dart 3 records or code generation for multiple parameters — they naturally override ==.
  • Avoid passing plain List or Map as parameters (no == override); use const collections, records, or classes with proper equality.
  • Use the provider_parameters lint rule from riverpod_lint to catch equality mistakes.

6. Auto Dispose & State Lifecycle

  • With codegen: state is destroyed by default when no longer listened to. Opt out with keepAlive: true.
  • Without codegen: state is kept alive by default. Use .autoDispose to enable disposal.
  • State is always destroyed when a provider is recomputed.
dart
// keepAlive with timer
ref.onCancel(() {
  final link = ref.keepAlive();
  Timer(const Duration(minutes: 5), link.close);
});
  • Use ref.onDispose for cleanup; do not trigger side effects or modify providers inside it.
  • Use ref.invalidate(provider) to force destruction; use ref.invalidateSelf() from within the provider.
  • Use ref.refresh(provider) to invalidate and immediately read the new value — always use the return value.

Show full SKILL.md (173 more words)Show less

7. Eager Initialization

Providers are lazy by default. To eagerly initialize:

dart
// In MyApp or a dedicated widget under ProviderScope:
Consumer(
  builder: (context, ref, _) {
    ref.watch(myEagerProvider); // forces initialization
    return const MyApp();
  },
)
  • Place eager initialization in a public widget (not main()) for consistent test behavior.
  • Use AsyncValue.requireValue to read data directly and throw clearly if not ready.

8. Performing Side Effects

dart
@riverpod
class TodosNotifier extends _$TodosNotifier {
  Future<void> addTodo(Todo todo) async {
    state = const AsyncLoading();
    state = await AsyncValue.guard(() async {
      await ref.read(repositoryProvider).addTodo(todo);
      return [...?state.value, todo];
    });
  }
}

// In UI:
ElevatedButton(
  onPressed: () => ref.read(todosNotifierProvider.notifier).addTodo(todo),
  child: const Text('Add'),
)
  • Use ref.read (not ref.watch) in event handlers.
  • After a side effect, update state by: setting it directly, calling ref.invalidateSelf(), or manually updating the cache.
  • Always handle loading and error states in the UI.
  • Do not perform side effects in provider constructors or build methods.

9. Provider Observers

dart
class MyObserver extends ProviderObserver {
  @override
  void didUpdateProvider(ProviderObserverContext context, Object? previousValue, Object? newValue) {
    print('[${context.provider}] updated: $previousValue → $newValue');
  }

  @override
  void providerDidFail(ProviderObserverContext context, Object error, StackTrace stackTrace) {
    // Report to error service
  }
}

runApp(ProviderScope(observers: [MyObserver()], child: MyApp()));

10. Testing

dart
// Unit test
final container = ProviderContainer(
  overrides: [repositoryProvider.overrideWith((_) => FakeRepository())],
);
addTearDown(container.dispose);

expect(await container.read(todosProvider.future), isNotEmpty);

// Widget test
await tester.pumpWidget(
  ProviderScope(
    overrides: [repositoryProvider.overrideWith((_) => FakeRepository())],
    child: const MyApp(),
  ),
);
  • Create a new ProviderContainer or ProviderScope for each test — never share state between tests.
  • Use container.listen over container.read for autoDispose providers to keep state alive during the test.
  • Use overrides to inject mocks or fakes.
  • Prefer mocking dependencies (repositories) rather than Notifiers directly.
  • If you must mock a Notifier, subclass the original — don't use implements or with Mock.
  • Place Notifier mocks in the same file as the Notifier if using code generation.
  • Obtain the container in widget tests with ProviderScope.containerOf(tester.element(...)).

References

© evanca, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/riverpod of evanca/flutter-ai-rules.

Open the folder on GitHubat commit 7b9cce2

Compare with similar skills

Riverpod next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Riverpod compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Riverpod this skillevanca/flutter-ai-rules649—~1.8kAutomated safety check: PassMIT
Compose UIMoustachauve/WLED-Android1693 repos~676Automated safety check: PassApache-2.0
Use Vishotmoeru-ai/airi50k—~867Automated safety check: PassMIT
Code Reviewecency/vision-mobile262—~2kAutomated safety check: PassMIT
Pypi Maintaineragentculture/culture113—~711Automated safety check: PassApache-2.0
Flutter Dart Code Reviewaffaan-m/ECC275k2 repos~5.8kAutomated safety check: NotesMIT

Similar skills

  • Compose UI

    Moustachauve/WLED-Android

    Best practices for building UI with Jetpack Compose, focusing on state hoisting, detailed performance optimizations, and theming.

    169 GitHub starsUsed in 3 repos~676 tokens
    MobileAuto-check passed
  • Use Vishot

    moeru-ai/airi

    Capture deterministic screenshots with Vishot and return a structured manifest of the generated images.

    50k GitHub stars~867 tokensUpdated today
    MobileAuto-check passed
  • Code Review

    ecency/vision-mobile

    Review a vision-mobile React Native change (diff, branch, PR or file) against this repo's own traps and conventions: action sheet return values, setNativeProps caret, safe-area edges, editor…

    262 GitHub stars~2k tokensUpdated 2 days ago
    MobileAuto-check passed
  • Pypi Maintainer

    agentculture/culture

    Switch a PyPI package install between the production index, TestPyPI pre-release builds, and a local editable checkout.

    113 GitHub stars~711 tokensUpdated 1 mo ago
    MobileAuto-check passed
  • Library-agnostic Flutter/Dart code review checklist covering widget best practices, state management patterns (BLoC, Riverpod, Provider, GetX, MobX, Signals), Dart idioms, performance…

    275k GitHub starsUsed in 2 repos~5.8k tokens
    MobileAuto-check: notes
  • Pull Screenshots

    stormpanda/megingiard

    Capture screenshots from both AYN Thor screens (TOP = display 0, BOTTOM = display 4) via ADB and save them to the screenshots/ folder.

    154 GitHub stars~223 tokensUpdated yesterday
    MobileAuto-check passed

More from evanca/flutter-ai-rules

All 37 skills in this repo
  • Code Review

    evanca/flutter-ai-rules

    A skill your agent uses when asked to review a PR, MR, branch, or diff, audit changed files, or check code quality.

    649 GitHub stars~2.4k tokensUpdated 24 days ago
    Auto-check passed
  • Developing Genkit Dart

    evanca/flutter-ai-rules

    A skill your agent uses when building AI agents in Dart, implementing Genkit flows or tools, integrating LLMs into Dart or Flutter applications, or using Genkit Dart plugins.

    649 GitHub stars~961 tokensUpdated 24 days ago
    Auto-check passed
  • Generate Images With Firebase AI

    evanca/flutter-ai-rules

    A skill your agent uses when generating or editing images from Flutter/Dart with Firebase AI Logic and a Gemini image model (Nano Banana), making the first call work, choosing Gemini Developer API…

    649 GitHub stars~2.3k tokensUpdated 24 days ago
    Auto-check passed
  • Flutter Use Column Row First

    evanca/flutter-ai-rules

    A skill your agent uses when building any Flutter screen or component to choose responsive Row, Column, Expanded, Flexible, and Spacer layouts before fixed-size or coordinate-based alternatives.

    649 GitHub stars~1.3k tokensUpdated 24 days ago
    Auto-check passed
  • Architecture Feature First

    evanca/flutter-ai-rules

    A skill your agent uses when creating a feature, designing folder structure, adding repositories/services/view models, wiring dependency injection, or deciding which layer owns logic.

    649 GitHub stars~1.9k tokensUpdated 24 days ago
    Auto-check passed
  • Bloc

    evanca/flutter-ai-rules

    A skill your agent uses when creating a Cubit or Bloc, modeling state with sealed classes or status enums, wiring BlocBuilder/BlocListener/BlocProvider, writing bloc tests, or choosing between Cubit…

    649 GitHub stars~2.8k tokensUpdated 24 days ago
    Auto-check passed

Questions about Riverpod

What does Riverpod do?

A skill your agent uses when setting up providers, combining requests, managing state disposal, passing arguments, performing side effects, or testing providers (Riverpod). Riverpod is an agent skill from evanca/flutter-ai-rules. Use when setting up providers, combining requests, managing state disposal, passing arguments, performing side effects, or testing providers (Riverpod).

When should I use Riverpod?

Riverpod fits situations like: setting up providers; combining requests; managing state disposal; passing arguments.

How do I install Riverpod in Claude Code?

Run `npx skills add evanca/flutter-ai-rules --skill riverpod -a claude-code`. Or copy the skill folder (skills/riverpod in evanca/flutter-ai-rules) into .claude/skills/riverpod in your project. Claude Code loads it when a task matches its description.

How do I install Riverpod in Codex?

Run `npx skills add evanca/flutter-ai-rules --skill riverpod -a codex`. Or copy the skill folder (skills/riverpod in evanca/flutter-ai-rules) into .agents/skills/riverpod in your project. Codex loads it when a task matches its description.

Can I use Riverpod in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add evanca/flutter-ai-rules --skill riverpod -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/riverpod, .gemini/skills/riverpod, .github/skills/riverpod and .opencode/skills/riverpod in your project.

What does Riverpod need to run?

Going by SKILL.md and its folder, Riverpod needs the command-line tools its instructions call (dart).

Does Riverpod access the network?

SKILL.md names 1 domain. As links in the text: github.com. This is read from the text; nothing was executed.

Is Riverpod safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Riverpod use?

Riverpod is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Riverpod use?

About 1.8k tokens (SKILL.md is roughly 7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Riverpod?

Skills that share tags, products or a category with Riverpod: Compose UI (Moustachauve/WLED-Android, 169 stars), Use Vishot (moeru-ai/airi, 50k stars), Code Review (ecency/vision-mobile, 262 stars) and Pypi Maintainer (agentculture/culture, 113 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Riverpod?

evanca (a GitHub user) maintains it in evanca/flutter-ai-rules, which has 649 GitHub stars. The repository holds 37 skills in this directory. The repository was last updated on September 14, 2026.

Source: evanca/flutter-ai-rules on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.