用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/LedgerHQ/ledger-live --skill redux-slice命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Place and organize Ledger Wallet code in the DDD monorepo. Use when creating, moving, or reviewing code under apps, features, domain, shared, or support; deciding which layer owns a concern; structuring packages and flow steps; or checking package names, dependency boundaries, platform variants, and legacy imports.
A new-architecture package (shared/, domain/, features/) exposes its API through barrels that contain nothing but `export *`, and keeps its private code in an internals location. Read this when creating a package under shared/, domain/ or features/, when editing any `index.*` file, or when a `lint:structure` check fails.
A new-architecture package (shared/, domain/, features/) exposes its API through barrels that contain nothing but `export *`, and keeps its private code in an internals location. Read this when creating a package under shared/, domain/ or features/, when editing any `index.*` file, or when a `lint:structure` check fails.
基于 SOC 职业分类
正在显示 SKILL.md
| 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";
});
},