Token导航 LogoToken导航TokenDH.com
开发规范需要联网github未标认证来源可访问许可证需确认审计通过

riverpod-best-practicesRiverpod 最佳实践

Agent Skill

riverpod-best-practices 用于记录任务执行中的错误、用户纠正、经验和能力缺口,适合在 Codex、Claude、Cursor、Gemini CLI 中希望让 Agent 持续沉淀问题、修正和最佳实践时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

259

周安装

11

GitHub Stars

公开资料未说明

下载量

91
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:riverpod-best-practices(Riverpod 最佳实践)
来源仓库:https://github.com/wahyubucil/agents
仓库路径:skills/riverpod-best-practices
安装命令:
npx skills add https://github.com/wahyubucil/agents --skill riverpod-best-practices
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/wahyubucil/agents --skill riverpod-best-practices

简介

用于记录任务执行中的错误、用户纠正、经验和能力缺口,适合在 Codex、Claude、Cursor、Gemini CLI 中希望让 Agent 持续沉淀问题、修正和最佳实践时使用。

  • 适用于错误记录、经验积累和最佳实践沉淀场景。
  • 通过 GitHub 仓库安装,使用 npx skills add 命令添加指定技能。
  • 需确认权限范围和维护状态,注意是否会触发联网、命令执行或文件读写操作。
  • riverpod-best-practices 属于开发规范类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Riverpod Best Practices (v3)

This skill outlines the standard operating procedures for using Riverpod v3 in this project. Adherence to these practices ensures maintainability, testability, and consistency.

Core Principles

  1. Code Generation (@riverpod): ALWAYS use the @riverpod annotation and riverpod_generator. Do NOT define providers manually (e.g., Provider((ref) =>...)).

- *Why:* Reduces boilerplate, handles autoDispose logic automatically, ensures type safety, and enables easier refactoring.

  1. Modular Architecture: Organize code by feature, not by layer.

- *Structure:* lib/modules/[feature]/providers/ for providers, lib/modules/[feature]/screens/ for UI.

  1. Unified Ref: Use Ref for all provider interactions. Avoid legacy types like WidgetRef inside providers (use Ref instead).
  2. AsyncValue First: Always handle Loading/Error/Data states explicitly in the UI using switch expressions.

Implementation Guidelines

1. Defining Providers

  • Class-Based (Notifier): Use for complex state requiring methods (mutations). @riverpod class MyNotifier extends _$MyNotifier {...}
  • Functional (Future/Stream): Use for simple data fetching or read-only values. @riverpod Future<Data> myData(Ref ref) async {...}
  • KeepAlive: Use @Riverpod(keepAlive: true) ONLY for global state (User, Auth, Settings). Default is autoDispose.

2. State Management

  • Side Effects: Perform side effects (API calls, navigation logic) in methods within the Notifier, NOT in the build() method.
  • Ref.mounted: Always check ref.mounted after an await before setting state to prevent exceptions on disposed providers. if (ref.mounted) state = AsyncData(data);
  • Mutations: To update lists/data, prefer fetching fresh data or optimistically updating state.

3. Consuming Providers

  • ConsumerWidget: Extend ConsumerWidget instead of StatelessWidget.
  • ConsumerStatefulWidget: Extend ConsumerStatefulWidget if you need initState/dispose.
  • Ref.watch: Use ref.watch inside build() to rebuild on changes.
  • Ref.read: Use ref.read inside callbacks (e.g., onPressed) to trigger actions. NEVER use ref.read inside build().

4. Naming Conventions

  • File Name: snake_case (e.g., user_controller.dart).
  • Class Name: PascalCase (e.g., UserController).
  • Provider Name (Generated): camelCase (e.g., userControllerProvider).

Resources

Migration (from v2/Manual)

If you encounter manual providers (StateNotifierProvider, ChangeNotifierProvider, etc.):

  1. Identify: Locate the logic.
  2. Convert: Rewrite as a @riverpod class or function.
  3. Replace: Update consumers to use the generated provider (e.g., myProvider instead of myProvider.notifier for watching state).

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

32.87%
按下载量换算30

Claude

28.63%
按下载量换算26

Cursor

20.43%
按下载量换算19

Gemini CLI

8.66%
按下载量换算8

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills