state-management
Skill0 starsChanged 4 days agoMITView on GitHub
How screens hold and refresh state with Riverpod 3 and code generation, and how they update after the assistant writes data. Use when adding a provider, reading data in a screen, or when a screen does not refresh after an action.
28 other projects use a version of this.
Adopted by
Most recently taken up by
- komluk/scaffoldingtheir own version, first seen Nov 7, 2026
- compozy/compozytheir own version, first seen Nov 7, 2026
- omspradippatil/Claude-Skillstheir own version, first seen Nov 1, 2026
- github/replicatheir own version, first seen Nov 1, 2026
- darknecrocities/SkillBuildertheir own version, first seen Nov 1, 2026
- TheBeardedBearSAS/claude-crafttheir own version, first seen Oct 29, 2026
Used with
Projects with it also use css-architecture, error-handling and 8 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
Piyush8296Skillcss-architecture
CSS architecture, Tailwind patterns, responsive design, design tokens, and styling best practices. Use when implementing designs, setting up styling infrastructure, or debugging layout issues.
Also in 3 projects that use this
MicrosoftSkillerror-handling
统一错误处理系统。在添加 API 端点、修改错误处理、添加前端 API 调用、编写错误相关测试时使用。
Also in 6 projects that use this
lbednerSkilli18n
Use when a code or template change introduces a new translation message key, in either the framework CLI (aegis/i18n/locales/) or a generated project's CLI (the app/i18n/locales/ template tree). Covers adding the real English string, stubbing the same key into every other locale for parity, and the separate translation PR that later replaces placeholders with reviewed native text.
Also in 4 projects that use this
mijunriSkilldatabase
数据库脚本与操作规范。脚本放在 db_scripts 目录,遵循查询优化、事务、安全等实践。
Also in 3 projects that use this
genomewalkerSkillresume
Resume a thread by loading its ~800-token context capsule
Also in 3 projects that use this
0xSeroSkillsecurity
Also in 4 projects that use this
Other versions28 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 28
- compozy/compozy★ 2.9ksame name
- github/replica★ 275same name
- conorluddy/xclaude-plugin★ 186same name
- cohen-liel/hivemind★ 108same name
- TheBeardedBearSAS/claude-craft★ 108same name
- EmeaAppGbb/spec2cloud★ 100same name
- statelyai/skills★ 48same name
- komluk/scaffolding★ 16same name
- darknecrocities/SkillBuilder★ 13same name
- PMDevSolutions/Aurelius★ 9same name
18 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository29 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- accessibilitySkill
- actionsSkill
- adding-a-featureSkill
- agent-workflowSkill
- app-contextSkill
- approval-and-safetySkill
- backend-proxySkill
- background-workSkill
- build-an-appSkill
- capture-learningsSkill
- clean-architectureSkill
- customizing-the-assistantSkill
- delegate-to-agentSkill
- edit-boundariesSkill
- i18n-and-rtlSkill
- model-providersSkill
- performanceSkill
- permissions-and-platformSkill
- read-the-docsSkill
- reliable-mutationsSkill
- routingSkill
- secretsSkill
- storing-dataSkill
- testingSkill
- ui-designSkill
- upgrade-the-frameworkSkill
- verifySkill
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 1 is distinctive, and 2 are very specific to this project.
0
Common
Most of the 22 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 8
Don't load this for where files and imports belong.
- Very specific: line 28
After editing a provider, run dart run build_runner build.
- Distinctive: line 41
Run an action through the registry in a test and assert the provider's new value.
“Common” is measured: kept by at least 6 in 10 of the 22 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
State management
Don't load this for where files and imports belong; see clean-architecture.
Rule
- Providers use Riverpod 3 with code generation:
@riverpodor@Riverpod(keepAlive: true), apart '<file>.g.dart';line, and a plainRefparameter. Never write or name a generated ref type;Refis the only one. - Screens read repositories through members named
watch…orget…and change data only withregistry.run(action, input). - Data that actions change comes from a stream (
watch…), so the screen follows the database. Data that is not in the database (settings) is refreshed by the change-event adapter.
Enforced by the lint rule ui_calls_actions for the read/write split. No automated check covers provider style; follow the files named below.
Why
The assistant writes through the same actions as the buttons. If a screen refreshes only because its own button was pressed, an assistant write leaves it stale. A database stream and the change-event adapter refresh the screen whoever made the change.
How
- Database data:
lib/presentation/providers/items_provider.dartexposesitems(Ref ref)asServiceLocator.getIt<ItemsRepository>().watchItems(). The Drift stream emits after every write, so nothing else is needed. The home screen reads it withref.watch(itemsProvider)and handlesloading,erroranddata. - Non-database data: theme, language and assistant settings are
keepAliveproviders (for examplelib/presentation/providers/theme_provider.dart).attachChangeEventsinlib/ai/change_event_adapter.dartlistens toregistry.changesfor resourcesettingsand callscontainer.invalidate(...)on each of them. Add a new settings provider to thatinvalidatechain. It also refreshes the saved notes (savedMemoriesProvider) for resourcememories. - A new resource that is not a stream: give its action a
resourcesentry, then filter on that resource name in the adapter and invalidate the provider. - Screen-only state: a notifier such as
SelectedItemIdsinlib/presentation/providers/items_provider.dart. When the assistant must know it, mirror it intoAppContext, as_reportdoes. - After editing a provider, run
dart run build_runner build. Never edit*.g.dart.
Anti-patterns
ref.invalidate(itemsProvider)after a button's write: it hides a missing stream and the assistant's writes still go stale.- Calling
repository.createItem(...)from a screen (blocked byui_calls_actions; useregistry.run). - Reading a
get…once ininitStatefor data that changes. - Holding a copy of the list in a
Statefield. - Hand-written
Provider/StateNotifiernext to the generated style.
Verification
test/presentation/providers/theme_provider_test.dartandtest/presentation/providers/language_provider_test.dartshow how provider tests are built;test/support/test_app.dartis the app harness.- Run an action through the registry in a test and assert the provider's new value.
tool/check.shruns the lint and tests; it ends withAll checks passed.
Related skills
clean-architecture— which layer a provider and a repository belong to.actions— the writes that trigger the refresh.app-context— what the assistant is told about the current screen and selection.performance— keeping rebuilds narrow.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

