intense-visions/harness-engineering/redux-slice-pattern
Claude Code and agent skill by intense-visions/harness-engineering
- community
Checking that the SKILL.md file is still in the repository.
Install
npx vskill@latest install intense-visions/harness-engineering/redux-slice-patternSKILL.md
The same SKILL.md was published earlier as intense-visions/harness-engineering/redux-slice-pattern.
Redux Slice Pattern
Organize Redux state into self-contained slices using createSlice for co-located reducers, actions, and selectors
When to Use
- Creating a new domain of state in a Redux Toolkit application
- Refactoring legacy Redux code that uses separate action constants, action creators, and reducers
- Adding CRUD operations for a resource (users, posts, products)
- Needing Immer-powered immutable updates without boilerplate
Instructions
- One slice per domain concern. Name the file
<domain>.slice.tsand keep it inslices/orfeatures/<domain>/. - Define the interface for the slice state explicitly — never rely on inference from
initialStatealone. - Use
createSlicewith a uniquenamethat matches the store key. This name prefixes all generated action types. - Write reducers as mutating logic — Immer converts them to immutable updates. Never return and mutate in the same reducer.
- Export the generated action creators and the reducer separately. Export selectors from the same file.
- Use
preparecallbacks when actions need payload transformation (adding IDs, timestamps, normalization). - Handle related async actions from thunks via
extraReducersusing the builder callback pattern — never the object notation (it is deprecated).
Details
Immer rules: You can either mutate state directly or return a new value — never both. Returning undefined is not the same as not returning; if you need a no-op, just don't write a return statement.
Naming conventions: The name field in createSlice becomes the action type prefix (todos/addTodo). Keep it short, lowercase, and matching the store mount point.
extraReducers vs reducers: Use reducers for actions owned by this slice. Use extraReducers for actions owned elsewhere (thunks, other slices). The builder callback pattern provides full TypeScript inference:
Anti-patterns to avoid:
- Putting derived data in state (compute it in selectors instead)
- Giant slices that own unrelated concerns (split them)
- Using the deprecated object map notation for
extraReducers - Forgetting to export actions (leads to silent bugs where dispatches do nothing)
Source
https://redux-toolkit.js.org/api/createSlice
Process
- Read the instructions and examples in this document.
- Apply the patterns to your implementation, adapting to your specific context.
- Verify your implementation against the details and edge cases listed above.
Harness Integration
- Type: knowledge — this skill is a reference document, not a procedural workflow.
- No tools or state — consumed as context by other skills and agents.
Success Criteria
- The patterns described in this document are applied correctly in the implementation.
- Edge cases and anti-patterns listed in this document are avoided.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingagents/skills/gemini-cli/redux-slice-pattern/SKILL.md
Popularity
- Repository stars
- 14
- Repository forks
- 8
- 7-day trend score
- 14
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 7 Jun 2026, 5 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/intense-visions/harness-engineering/redux-slice-pattern)