원클릭으로
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";
});
},