model-redux-state/build-slices-and-selectors
Skill by reduxjs
Guides an AI assistant to write and refactor Redux Toolkit slices, selectors, async thunks, entity adapters and lazily injected reducers. Written for RTK 2 projects using @reduxjs/toolkit.
Install model-redux-state/build-slices-and-selectors
Built from the published package, never by AI.
git clone --depth 1 https://github.com/reduxjs/redux-toolkit /tmp/redux-toolkit && mkdir -p ~/.claude/skills && cp -r /tmp/redux-toolkit/packages/toolkit/skills/model-redux-state/build-slices-and-selectors ~/.claude/skills/model-redux-state-build-slices-and-selecRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
Step-by-step: install model-redux-state/build-slices-and-selectors in Claude Code
git clone --depth 1 https://github.com/reduxjs/redux-toolkit /tmp/redux-toolkit && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/redux-toolkit/packages/toolkit/skills/model-redux-state/build-slices-and-selectors ~/.gemini/antigravity-cli/skills/model-redux-state-build-slices-and-selecAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Step-by-step: install model-redux-state/build-slices-and-selectors in Antigravity CLI
Skills can run scripts on your machine. Some need an API key: check the README.
About
This skill guides an AI assistant when it writes or refactors Redux state code with Redux Toolkit 2, pinned to @reduxjs/toolkit 2.11.2. It covers createSlice with Immer-backed mutating reducers, slice selectors, create.asyncThunk through a buildCreateSlice setup, entity adapters, and lazy reducer injection with combineSlices, injectInto and withLazyLoadedSlices.
It also lists common mistakes to avoid, such as mutating state outside reducers, writing hand-written switch reducers by default, using RTK 1.x extraReducers object syntax, and omitting selectId for entities that do not use an id field. It is aimed at developers and coding agents that build or maintain Redux slices in apps using RTK 2.
Written from the project's SKILL.md and checked against it.
What it can do
- createSlice reducersWrite Immer-backed mutating reducers inside createSlice instead of hand-written switch reducers.
- Slice selectorsDefine selectors inside a slice and read them through slice.selectors.
- create.asyncThunkKeep async pending, fulfilled and rejected handlers together with the slice.
- Entity adaptersUse createEntityAdapter for normalized collections, with selectId for custom keys.
- getSelectorsBuild selectors from an entity adapter for a given state location.
- Lazy reducer injectionInject slices into a combineSlices root with injectInto and withLazyLoadedSlices.
- RTK 2 migrationReplace RTK 1.x extraReducers object syntax with the builder callback form.
Try asking
- Create a posts slice with an async fetch thunk and a selector for published posts.
- Refactor this switch reducer into a createSlice reducer.
- Set up an entity adapter for books keyed by bookId and lazy inject it.
Good to know
- Mutation syntax is only safe inside Immer-backed reducer contexts such as createSlice and createReducer.
- Hand-written reducers are described as an escape hatch for proven bottlenecks, not the default.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: packages/toolkit/skills/model-redux-state/build-slices-and-selectors/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
-
SKILL.md9 KB -
references/slice-patterns.md1 KB
Alternatives to model-redux-state/build-slices-and-selectors
All alternatives →Runs a 7-stage workflow for auditing, cleaning up and reviewing GitHub repositories, plus competitor analysis. Written for developers who want a repo checked for secrets, junk files and documentation gaps.
Teaches an AI assistant to build, debug and explain Gradio web UIs and ML demos in Python. It covers the core API, components, event listeners, layouts and the MCP server option. Aimed at Python developers who work with Gradio.
Recommends menus, buttons, toolbars and disclosure controls for Apple platforms using Human Interface Guidelines conventions. Built for developers and designers making iOS, iPadOS, macOS or visionOS interfaces. Checks existing project design context before asking questions.
Creates production-ready FastAPI project structures with async patterns, dependency injection, and error handling. It is for developers starting new FastAPI applications or backend API projects.
Analyzes Android apps to find user workflows to expose as AppFunctions, so AI agents and system shortcuts can run them without opening the app UI. Generates Kotlin code and refines KDoc for Android developers.
Creates, edits, validates and runs Agent QA tests, suites and hooks through MCP or CLI. It keeps canonical IDs and schema contracts intact, for developers and QA teams using Agent QA.
Compare with openclaw-github-repo-commander, gradio or hig-components-menus
model-redux-state/build-slices-and-selectors: common questions
Does this skill cover RTK 1.x code?
It targets current RTK 2 slice patterns. It flags RTK 1.x extraReducers object syntax as a mistake to avoid.
When should I use create.asyncThunk?
Use it when the async lifecycle handlers naturally belong to the slice. The source says regular createAsyncThunk is still fine otherwise.
Why does my entity adapter need selectId?
Adapters default to entity.id. Collections keyed by another field must provide selectId.
How do I install model-redux-state/build-slices-and-selectors?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is model-redux-state/build-slices-and-selectors free?
The code is published under the MIT licence. The service it connects to may have its own pricing.
Is model-redux-state/build-slices-and-selectors safe to use?
It scores 92 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to model-redux-state/build-slices-and-selectors?
Similar skills: openclaw-github-repo-commander, gradio, hig-components-menus, fastapi-templates.
