riverpod-patterns

Standardize Riverpod provider patterns for Flutter state management.

Updated Feb 26, 2026
One-click install
npx skills add https://github.com/natslash/options-strategy-builder --skill riverpod-patterns-natslash
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: riverpod-patterns
Source: https://github.com/natslash/options-strategy-builder/tree/main/.claude/skills/riverpod-patterns
Command: npx skills add https://github.com/natslash/options-strategy-builder --skill riverpod-patterns-natslash

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Streamlines Riverpod state management by providing standardized patterns and best practices to help Flutter developers write correct, maintainable providers and widgets.

Core Features & Use Cases

  • Async patterns: guidance for AsyncNotifier, building with AsyncValue, and error handling.
  • Ref usage: proper use of ref.watch in build() and ref.read in callbacks, plus ref.listen for side effects.
  • Lifecycle & debugging: provider lifecycle tips (autoDispose, keepAlive, invalidate, onDispose) and practical reviews.
  • Code review & adoption: checklists and examples from reference files to audit existing code.

Quick Start

Review your Riverpod codebase and align it with the patterns documented in the reference files to improve correctness and maintainability.

Frequently Asked Questions about riverpod-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I use Riverpod AsyncValue to handle loading and error states in Flutter?

Proper Riverpod ref usage dictates using ref.watch inside build methods to subscribe to providers, and ref.read inside event callbacks or lifecycle methods to read values once without creating unwanted widget rebuilds or side effects.

What is the difference between ref.watch and ref.read in Riverpod providers?

Proper Riverpod ref usage dictates using ref.watch inside build methods to subscribe to providers, and ref.read inside event callbacks or lifecycle methods to read values once without creating unwanted widget rebuilds or side effects.

How do I manage provider lifecycle with autoDispose and keepAlive in Riverpod?

Riverpod provider lifecycle management relies on autoDispose for automatic cleanup when no listeners remain and keepAlive to prevent premature disposal. Proper use of invalidate and onDispose ensures resources are released and state resets correctly.

How do I audit existing Flutter code for correct Riverpod patterns?

Auditing Riverpod patterns involves checking existing Flutter code against standardized checklists for AsyncNotifier usage, ref handling, and provider lifecycle. This review process identifies boilerplate and incorrect state management implementations for correction.

When should I use ref.listen for side effects in Riverpod?

Riverpod ref.listen is used for side effects in Flutter state management, triggering actions like navigation or showing a snackbar when provider state changes. It should be placed inside build methods rather than callbacks to properly react to AsyncValue updates.