ワンクリックで
redux-slice
Redux Toolkit createSlice best practices
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Redux Toolkit createSlice best practices
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Enforce import boundaries inside the devtools scope. Use for any work in "devtools/**".
Official Ledger wallet-cli - USB-based CLI for Ledger hardware wallet flows (account discover, receive, balances, operations, send, swap quote/execute/status, genuine-check, assets token / token-by-id). Use for any wallet-cli command execution and for mapping informal requests to the right command.
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.
| 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";
});
},