원클릭으로
add-thunk
Add a Redux async thunk with loading/error states to governanceSlice. Use when adding new async data fetching.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Add a Redux async thunk with loading/error states to governanceSlice. Use when adding new async data fetching.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Scaffold a new dashboard chart component with registry, types, and proper theme integration.
Create a new customizable dashboard with its own chart registry, provider, and page. Use when adding dashboards like DRep or SPO dashboard.
Context window conservation rules. Invoke when approaching context limits or before large tasks.
Deep reflection on the skill learning system itself. Analyzes what's working, what's stale, and proposes structural improvements. The meta-skill.
End-of-session automation. Creates a journey and evolves skills based on session learnings.
Run the build and intelligently fix TypeScript errors with guardrails. Stops if fixes introduce more errors or the same error persists after 3 attempts.
| name | add-thunk |
| description | Add a Redux async thunk with loading/error states to governanceSlice. Use when adding new async data fetching. |
Add a new async thunk to the governance slice with proper loading/error state management.
$0 - Thunk name in camelCase (e.g., loadVoterStats)$1 - Service function name (e.g., fetchVoterStats)Edit src/store/governanceSlice.ts - add to GovernanceState interface:
// Data
${dataPropertyName}: ${DataType} | null;
// Loading state
isLoading${PascalCaseName}: boolean;
// Error state
${camelCaseName}Error: string | null;
Add to initialState:
${dataPropertyName}: null,
isLoading${PascalCaseName}: false,
${camelCaseName}Error: null,
Add the service function import at the top:
import { ${$1} } from "@/services/api";
Add after existing thunks (before const governanceSlice = createSlice):
export const ${$0} = createAsyncThunk(
"governance/${$0}",
async (${paramIfNeeded}, { rejectWithValue }) => {
try {
const data = await ${$1}(${paramIfNeeded});
if (!data) {
return rejectWithValue("${Human readable name} not found");
}
return data;
} catch (error) {
return rejectWithValue(
error instanceof Error ? error.message : "Failed to load ${human readable name}"
);
}
}
);
If you need a setter action, add to reducers:
set${PascalCaseName}: (state, action: PayloadAction<${DataType} | null>) => {
state.${dataPropertyName} = action.payload;
state.${camelCaseName}Error = null;
},
Add to extraReducers builder:
// Load ${human readable name}
builder
.addCase(${$0}.pending, (state) => {
state.isLoading${PascalCaseName} = true;
state.${camelCaseName}Error = null;
})
.addCase(${$0}.fulfilled, (state, action) => {
state.isLoading${PascalCaseName} = false;
state.${dataPropertyName} = action.payload;
})
.addCase(${$0}.rejected, (state, action) => {
state.isLoading${PascalCaseName} = false;
state.${camelCaseName}Error = action.payload as string;
});
Add to exports:
export const {
// ... existing exports
set${PascalCaseName},
} = governanceSlice.actions;
export const loadStats = createAsyncThunk(
"governance/loadStats",
async (_, { rejectWithValue }) => {
// ...
}
);
export const loadDetail = createAsyncThunk(
"governance/loadDetail",
async (id: string, { rejectWithValue }) => {
// ...
}
);
export const loadFiltered = createAsyncThunk(
"governance/loadFiltered",
async ({ type, status }: { type: string; status: string }, { rejectWithValue }) => {
// ...
}
);
| Thunk Name | State Property | Loading State | Error State |
|---|---|---|---|
loadVoterStats | voterStats | isLoadingVoterStats | voterStatsError |
loadDRepDetails | drepDetails | isLoadingDRepDetails | drepDetailsError |
Import and dispatch the thunk in your component:
import { ${$0} } from "@/store/governanceSlice";
const dispatch = useAppDispatch();
useEffect(() => {
dispatch(${$0}());
}, [dispatch]);
Select data and loading state:
const { ${dataPropertyName}, isLoading${PascalCaseName} } = useAppSelector(
(state) => state.governance
);