add-thunk

Add a typed Redux async thunk with loading and error states to a governance slice.

4|2|Updated Oct 26, 2025
One-click install
npx skills add https://github.com/nomos-guild/cgov --skill add-thunk
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: add-thunk
Source: https://github.com/nomos-guild/cgov/tree/main/.claude/skills/add-thunk
Command: npx skills add https://github.com/nomos-guild/cgov --skill add-thunk

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps frontend teams reliably extend the governance store by adding a Redux async thunk with built-in loading and error state management.

Core Features & Use Cases

  • Typed Async Thunk: Creates a Redux Toolkit async thunk for data fetching in governance flows.
  • State Synchronization: Automatically tracks loading and error states alongside data.
  • Guided Integration: Provides step-by-step instructions to update the state interface, initial state, imports, and extra reducers for pending/fulfilled/rejected.

Quick Start

Create a new thunk named loadVoterStats that calls a service function like fetchVoterStats and wire it into governanceSlice.

Frequently Asked Questions about add-thunk

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a Redux async thunk with loading and error states to a governance slice?

To add a Redux async thunk with loading and error states to a governance slice, you create a typed thunk that calls a service function and wire it into state using pending, fulfilled, and rejected reducers. This synchronizes fetched data with the UI.

What is the best way to manage loading state for data fetching in a Redux Toolkit governance dashboard?

Managing loading state for data fetching in a Redux Toolkit governance dashboard requires adding an async thunk with pending, fulfilled, and rejected handlers. This approach automatically tracks loading and error states alongside the fetched data.

How does a typed async thunk handle pending and rejected states in frontend governance flows?

A typed async thunk handles pending and rejected states in frontend governance flows by using extra reducers to update the state interface. It tracks loading status and captures errors when the imported service function fails or succeeds.

Can I use this async thunk pattern to wire new service functions into an existing governance store?

Yes, you can use this async thunk pattern to wire new service functions into an existing governance store. It provides step-by-step integration to update the state interface, initial state, and imports for the new data-fetch workflow.

Do I need to manually update the state interface when adding an async thunk to a governance slice?

Yes, you need to update the state interface when adding an async thunk to a governance slice. The guided integration enforces a matching state shape and requires adding setter reducers to properly reflect the fetched data in the UI.

Why use typed async thunks instead of regular reducers for governance state management?

Typed async thunks are used instead of regular reducers for governance state management because they enforce a matching state shape and handle asynchronous data fetching. They automatically add pending, fulfilled, and rejected handling for reliable UI synchronization.