with one click
redux-slice
Redux Toolkit createSlice best practices
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
Redux Toolkit createSlice best practices
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
Handle batches of Jira tickets through shared analysis, per-ticket feature-dev, Lumen UI guardrails, changesets, and draft PRs. Use when the user provides multiple Jira tickets or asks to deliver tickets one by one with PRs.
Trigger the on-demand production build workflows on LedgerHQ/ledger-live-build (Desktop, Android APK, iOS) for a ledger-live branch, then post a PR comment. Use when asked to "run builds", "produce a build", "build the app(s)", or "make an APK/iOS/desktop build" for a PR/branch.
Guided feature development with codebase understanding and architecture focus
Rules and layout for coin module packages under libs/coin-modules/. Read when adding or modifying a coin module.
Dead-code / unused-dependency detection is migrating from the legacy `unimported` tool to `knip`, which requires each package to expose an explicit, minimal `package.json#exports` (no `./*` wildcard). Read this when adding a new package or migrating an existing one.
Guidelines that must be followed when creating or updating docs in this repo. Applies to AGENTS.md, README.md, **/docs/**/*.md, skill and sub-agent files.
| name | redux-slice |
| description | Redux Toolkit createSlice best practices |
name for action type prefixesinitialState with satisfies// โ
GOOD
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
interface MyState {
value: number;
status: "idle" | "loading" | "error";
}
const initialState: MyState = {
value: 0,
status: "idle",
};
const mySlice = createSlice({
name: "myFeature",
initialState,
reducers: {
setValue: (state, action: PayloadAction<number>) => {
state.value = action.payload;
},
setStatus: (state, action: PayloadAction<MyState["status"]>) => {
state.status = action.payload;
},
},
});
export const { setValue, setStatus } = mySlice.actions;
export default mySlice.reducer;
Add the slice to reducers/index.ts:
// 1. Import the reducer and state type
import myFeature, { MyFeatureState } from "./myFeature";
// 2. Add to State type
export type State = {
// ...existing
myFeature: MyFeatureState;
};
// 3. Add to combineReducers
const appReducer = combineReducers({
// ...existing
myFeature,
});
PayloadAction<T> for actions with payloadscreateSelector for derived data// Colocate selectors with slice
export const selectValue = (state: RootState) => state.myFeature.value;
export const selectStatus = (state: RootState) => state.myFeature.status;
extraReducers: (builder) => {
builder
.addCase(fetchData.pending, (state) => {
state.status = "loading";
})
.addCase(fetchData.fulfilled, (state, action) => {
state.status = "idle";
state.data = action.payload;
})
.addCase(fetchData.rejected, (state) => {
state.status = "error";
});
},