Token导航 LogoToken导航TokenDH.com
开发需要联网github未标认证来源可访问许可证需确认审计未展示

evolve-and-diagnose-redux-apps%2fdebug-redux-toolkit-apps发展和诊断 redux 应用程序%2fdebug redux 工具包应用程序

Agent Skill

evolve-and-diagnose-redux-apps%2fdebug-redux-toolkit-apps 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

441

周安装

18

GitHub Stars

11,214

下载量

141
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:evolve-and-diagnose-redux-apps%2fdebug-redux-toolkit-apps(发展和诊断 redux 应用程序%2fdebug redux 工具包应用程序)
来源仓库:https://github.com/reduxjs/redux-toolkit
仓库路径:skills/evolve-and-diagnose-redux-apps%2Fdebug-redux-toolkit-apps
安装命令:
npx skills add https://github.com/reduxjs/redux-toolkit --skill evolve-and-diagnose-redux-apps/debug-redux-toolkit-apps
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/reduxjs/redux-toolkit --skill evolve-and-diagnose-redux-apps/debug-redux-toolkit-apps

简介

用于诊断 Redux Toolkit 应用状态管理问题,提供异步 thunk 与 slice 调试模板。

  • 适用于 Codex、Claude、Cursor、Gemini CLI 中 React 应用状态流分析与错误排查。
  • 包含条件加载与状态机可视化建议,帮助识别 pending 或 rejected 状态异常。
  • 建议结合 Redux DevTools 使用,确保输入格式与现有 store 结构兼容。
  • evolve-and-diagnose-redux-apps%2fdebug-redux-toolkit-apps 属于开发类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Debug Redux Toolkit Apps

Setup

import { configureStore, createAsyncThunk, createSlice } from '@reduxjs/toolkit'

type Post = { id: string; title: string }

export const fetchPosts = createAsyncThunk(
  'posts/fetchPosts',
  async () => {
    const response = await fetch('/api/posts')
    return (await response.json()) as Post[]
  },
  {
    condition(_arg, { getState }) {
      const state = getState() as RootState
      return state.posts.status === 'idle'
    },
  },
)

const postsSlice = createSlice({
  name: 'posts',
  initialState: {
    items: [] as Post[],
    status: 'idle' as 'idle' | 'pending' | 'succeeded' | 'failed',
  },
  reducers: {},
  extraReducers: (builder) => {
    builder
      .addCase(fetchPosts.pending, (state) => {
        state.status = 'pending'
      })
      .addCase(fetchPosts.fulfilled, (state, action) => {
        state.status = 'succeeded'
        state.items = action.payload
      })
  },
})

export const store = configureStore({
  reducer: {
    posts: postsSlice.reducer,
  },
})

type RootState = ReturnType<typeof store.getState>

Core Patterns

Debug in order: action -> reducer -> selector -> render

const selectPosts = (state: RootState) => state.posts.items
const selectPostsStatus = (state: RootState) => state.posts.status

store.dispatch(fetchPosts())

console.log(selectPostsStatus(store.getState()))
console.log(selectPosts(store.getState()))

If a component looks wrong, first verify the action fired, then the reducer state, then the selector result, then the render boundary.

Narrow subscriptions at the usage site

import { useAppSelector } from '../../app/hooks'

export function PostsList() {
  const posts = useAppSelector((state) => state.posts.items)
  const status = useAppSelector((state) => state.posts.status)

  return (
    <div>
      <div>{status}</div>
      <div>{posts.length}</div>
    </div>
  )
}

React-Redux behaves best when components select only the values they render and do it as close to usage as possible.

Interpret RTK Query invalidation correctly

import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'

type Post = { id: string; title: string }

const api = createApi({
  reducerPath: 'api',
  baseQuery: fetchBaseQuery({ baseUrl: '/api/' }),
  tagTypes: ['Post'],
  endpoints: (build) => ({
    getPosts: build.query<Post[], void>({
      query: () => 'posts',
      providesTags: ['Post'],
    }),
    updatePost: build.mutation<Post, Pick<Post, 'id' | 'title'>>({
      query: ({ id, title }) => ({
        url: `posts/${id}`,
        method: 'PATCH',
        body: { title },
      }),
      invalidatesTags: ['Post'],
    }),
  }),
})

If invalidation did not visibly refetch, check whether anything was still subscribed to that cache entry.

Common Mistakes

HIGH Dispatching fetch thunks from effects without a thunk-level guard

Wrong:

import { useEffect } from 'react'
import { useAppDispatch, useAppSelector } from '../../app/hooks'

function PostsPage() {
  const dispatch = useAppDispatch()
  const postStatus = useAppSelector((state) => state.posts.status)

  useEffect(() => {
    if (postStatus === 'idle') {
      dispatch(fetchPosts())
    }
  }, [dispatch, postStatus])

  return null
}

Correct:

export const fetchPosts = createAsyncThunk(
  'posts/fetchPosts',
  async () => {
    const response = await fetch('/api/posts')
    return (await response.json()) as Post[]
  },
  {
    condition(_arg, { getState }) {
      const state = getState() as RootState
      return state.posts.status === 'idle'
    },
  },
)

React StrictMode can run effects twice in development, so the guard belongs in the thunk as well as the component.

Source: reduxjs/redux:docs/tutorials/essentials/part-5-async-logic.md

HIGH Ignoring serializable-state warnings

Wrong:

const initialState = {
  lastSeen: new Date(),
  pendingIds: new Set<string>(),
}

Correct:

const initialState = {
  lastSeenIso: new Date().toISOString(),
  pendingIds: [] as string[],
}

Non-serializable values break DevTools, replay, persistence, and equality assumptions in subtle ways.

Source: reduxjs/redux:docs/style-guide/style-guide.md

HIGH Selecting broad state in parents and threading props

Wrong:

import { useAppSelector } from '../../app/hooks'

function PostsPage() {
  const postsState = useAppSelector((state) => state.posts)
  return <PostsList items={postsState.items} status={postsState.status} />
}

Correct:

import { useAppSelector } from '../../app/hooks'

function PostsList() {
  const items = useAppSelector((state) => state.posts.items)
  const status = useAppSelector((state) => state.posts.status)
  return (
    <div>
      <div>{status}</div>
      <div>{items.length}</div>
    </div>
  )
}

Selecting whole slices high in the tree widens the subscription surface and pushes rerenders through props.

Source: reduxjs/redux:docs/style-guide/style-guide.md

MEDIUM Returning unstable objects from query selection logic

Wrong:

import { api } from '../../services/api'

const result = api.useGetPostsQuery(undefined, {
  selectFromResult: ({ data = [] }) => ({
    posts: [...data],
  }),
})

Correct:

import { api } from '../../services/api'

const result = api.useGetPostsQuery(undefined, {
  selectFromResult: ({ data = [] }) => ({
    posts: data,
  }),
})

New object and array references defeat memoization and make components rerender even when the underlying cached data did not change.

Source: reduxjs/redux:docs/tutorials/essentials/part-8-rtk-query-advanced.md

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

34.49%
按下载量换算49

Claude

30.04%
按下载量换算42

Cursor

18.03%
按下载量换算25

Gemini CLI

9.27%
按下载量换算13

安全审计

暂无安全审计结果可展示。

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills