Token导航 LogoToken导航

Agent Skill · 研究检索

accelint-react-testing(accelint React 测试)

用于辅助前端页面、组件、样式和交互逻辑的开发与维护。它适合让 Agent 生成或审查 React、Next.js、Vue、Tailwind、CSS 等相关代码,整理组件结构,或定位布局和性能问题。使用时需要结合项目现有设计系统、路由和构建方式,避免只生成孤立片段;涉及页面改动时,应配合本地预览和构建检查确认视觉效果。

accelint-react-testing 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为需要联网;许可证信息还不明确,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 27,162。

总安装 3,436周安装 139GitHub Stars 10下载 1,079核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

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

请帮我安装这个 Agent Skill:accelint-react-testing(accelint React 测试)
来源仓库:https://github.com/gohypergiant/agent-skills
仓库路径:skills/accelint-react-testing
安装命令:
npx skills add https://github.com/gohypergiant/agent-skills --skill accelint-react-testing
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/gohypergiant/agent-skills --skill accelint-react-testing

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

accelint-react-testing 提供基于 Testing Library 的 React 组件测试最佳实践指导。适合在 Codex、Claude、Cursor、Gemini CLI 中编写可维护、无障碍优先的用户交互测试。强调查询选择、无障碍验证和避免实现细节,提升测试的可靠性和可用性。

安装命令为 npx skills add https://github.com/gohypergiant/agent-skills --skill accelint-react-testing。需确认是否涉及外部工具调用或自动执行,并注意维护状态与权限范围。

来源仓库内路径:skills/accelint-react-testing

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/gohypergiant/agent-skills --skill accelint-rea…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要需要联网,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

accelint-react-testing 怎么安装?

在终端执行 npx skills add https://github.com/gohypergiant/agent-skills --skill accelint-react-testing。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

accelint-react-testing 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

accelint-react-testing 需要什么权限?

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

accelint-react-testing 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

accelint-react-testing 用的人多吗?

公开数据是累计安装 3,436 次,近一周安装 139 次,下载 1,079 次,GitHub 10 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

accelint-react-testing 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
accelint-react-testing

accelint React 测试 · 本页

3,43610需要联网未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

React Testing Best Practices

Expert guidance for writing maintainable, user-centric React component tests with Testing Library. Focused on query selection, accessibility-first testing, and avoiding implementation details.

NEVER Do When Writing React Tests

  • NEVER query by test IDs before trying accessible queries - Test IDs bypass accessibility verification: a button with data-testid="submit" but no accessible name works in tests but fails for screen reader users. When tests pass with test IDs, you ship inaccessible UIs. Query hierarchy: getByRole > getByLabelText > getByText > getByTestId. Each step down this list means less confidence your UI is usable.
  • NEVER use fireEvent for user interactions when userEvent is available - fireEvent dispatches single DOM events, missing the event sequence real users trigger: fireEvent.click() fires one click event, but real users trigger focus → mousedown → mouseup → click. Components that work with fireEvent break in production when users interact normally. userEvent.click() simulates the full interaction sequence, catching bugs fireEvent misses.
  • NEVER test implementation details instead of user behavior - Tests that verify "state variable X equals Y" or "function Z was called" create false failures: you refactor from useState to useReducer, all tests fail, yet the UI works identically. Testing implementation details punishes refactoring and provides zero confidence the user experience works. Test what users see and do (rendered output, interaction results), not how your component achieves it internally.
  • NEVER query from container or use destructured queries after initial render - const {getByText} = render(<Component />) creates stale queries that miss updates: after state changes, destructured queries search the initial DOM snapshot, missing newly rendered elements. This causes "element not found" errors for elements that are actually present. Always use screen.getByText() which automatically queries the current DOM state. Using screen consistently also makes tests more maintainable - adding a new query doesn't require updating the destructuring.
  • NEVER add aria-label or role attributes solely for tests - If you're adding aria-label="submit-button" or role="button" just so tests can find elements, you're working backwards. Tests should verify the component is already accessible, not make it accessible for tests. Adding test-only ARIA pollutes production code and masks real accessibility problems. Fix the component's semantic HTML and existing ARIA first.
  • NEVER snapshot entire component trees without specific assertions - Massive snapshots with 500+ lines break on any change (updated classname, new prop, reordered elements), forcing reviewers to approve diffs they can't meaningfully evaluate. When test failures require "just update the snapshot" without understanding why, the test has zero value. Snapshot specific critical structures (error messages, data tables) with targeted assertions for everything else.
  • NEVER use waitFor for actions that return promises - waitFor(() => expect(element).toBeInTheDocument()) polls repeatedly until timeout when a promise-based findBy query solves it in one shot: await screen.findByText('loaded') waits for the element to appear without polling. Reserve waitFor for assertions that can't use findBy (checking element disappears, waiting for attribute changes).
  • NEVER perform side effects inside waitFor callback - waitFor(() => {fireEvent.click(button); expect(text).toBeInTheDocument();}) runs the click multiple times as waitFor retries, causing unpredictable behavior. waitFor is for waiting on assertions, not triggering actions. Perform all actions outside waitFor, then use waitFor only for the assertion: fireEvent.click(button); await waitFor(() => expect(text).toBeInTheDocument()); or better yet, await userEvent.click(button); expect(await screen.findByText(text)).toBeInTheDocument();.
  • NEVER create custom renders without documenting provider requirements - A custom renderWithRedux function with undocumented required store shape breaks for every developer: they call render(<Component />) instead of renderWithRedux(), tests fail with cryptic "Cannot read property of undefined", wasting 15 minutes debugging. Centralize provider setup in test utils with TypeScript types that enforce correct usage, or document required wrappers prominently.
  • NEVER mix queries from different Testing Library imports - Importing both @testing-library/react render and @testing-library/dom queries creates confusion: screen from react package doesn't work with getByRole from dom package, causing "screen.getByRole is not a function" errors. Import all queries from @testing-library/react for React components - it re-exports everything from dom with React-specific enhancements.

Before Writing Tests, Ask

Apply these thinking patterns before implementing React component tests:

Query Selection Strategy

  • Which query matches how users find this element? Real users don't look for test IDs or CSS classes - they look for labels, buttons, headings. If you can't query by role or label, your UI lacks accessibility. Query difficulty reveals UX problems before they reach production.
  • Does this element need to be found at all? Not every element needs a query assertion. Users don't verify "loading spinner exists" - they verify "data appears after loading". Test outcomes, not intermediate states.
  • Should I use getBy, queryBy, or findBy? Start with getBy for immediate presence - it gives the best error messages. Use queryBy only when asserting absence (.not.toBeInTheDocument()). Use findBy for async appearance. Never use queryBy + expect(...).toBeInTheDocument() - use getBy instead for better error messages when the element is missing.

User vs Implementation Testing

  • What would a user do to verify this works? Users click buttons and read text - they don't check state variables or mock function calls. If your test uses rerender() or accesses component internals, you're testing implementation. Refactor to test through user actions.
  • Will this test survive a refactoring that doesn't change behavior? If renaming a function or switching from useState to useReducer breaks the test, you're testing implementation details. These tests waste time blocking safe changes while providing no confidence the UI actually works.

Async and Timing

  • Is this query for something that loads asynchronously? Use findBy* for anything loaded via useEffect, API calls, or setTimeout. getBy* throws immediately if element is missing; findBy* waits for it to appear. Using getBy for async content creates race conditions that only fail in CI.
  • Am I waiting for an element to appear or disappear? Appearance = findBy* query. Disappearance = waitForElementToBeRemoved. State changes = waitFor with assertion. Each has different semantics; using the wrong one causes flaky tests or longer timeouts.

Test Isolation and Setup

  • Does this component need context providers to render? Components using useContext, Redux hooks, or React Router throw without providers. Create custom render utilities that wrap components in required providers automatically. Repeating provider setup in every test file is a maintenance disaster.
  • What's the minimal setup needed for this test case? Tests with excessive setup (mocking 10 functions for a button test) are fragile and slow. Mock only external dependencies (APIs, localStorage), never your own functions. If setup is complex, the component design might be the problem.

How to Use

This skill uses progressive disclosure to minimize context usage:

1. Start with the Overview (AGENTS.md)

Read AGENTS.md for a concise overview of all rules with one-line summaries.

2. Load Specific Rules as Needed

Use these explicit triggers to know when to load each reference file:

MANDATORY Loading (load entire file):

Load When You See These Patterns:

Do NOT Load Unless Specifically Needed:

3. Apply the Pattern

Each reference file contains:

  • ❌ Incorrect examples showing the anti-pattern
  • ✅ Correct examples showing the optimal implementation
  • Explanations of why the pattern matters

4. Audit Existing Tests (Optional)

Use the provided scripts to audit existing test suites:

# Check query priority (testId usage, container.querySelector)
./scripts/check-query-priority.sh

# Find fireEvent that should be userEvent
./scripts/find-fire-event.sh

# Detect deprecated wrapper/container patterns
./scripts/detect-wrapper-queries.sh

5. Use the Report Template

When this skill is invoked for test code review, use the standardized report format:

Template: assets/output-report-template.md

The report format provides:

  • Executive Summary with accessibility confidence and user-centric coverage assessment
  • Severity levels (Critical, High, Medium, Low) for prioritization
  • Impact analysis (accessibility confidence, user-centric confidence, test reliability, refactor safety)
  • Categorization (Query Priority, Query Variants, User Events, Async Testing, Custom Render, Accessibility, Anti-patterns)
  • Pattern references linking to detailed guidance in references/
  • Summary table for tracking all issues

When to use the report template:

  • Skill invoked directly via /accelint-react-testing <path>
  • User asks to "review test code" or "audit tests" across file(s), invoking skill implicitly

When NOT to use the report template:

  • User asks to "write a test for this function" (direct implementation)
  • User asks "what's wrong with this test?" (answer the question)
  • User requests specific test fixes (apply fixes directly without formal report)

What This Skill Covers

Expert guidance on React Testing Library patterns:

  1. Query Priority - Accessible query hierarchy from getByRole to getByTestId
  2. Query Variants - When to use getBy, findBy, queryBy for different scenarios
  3. User Events - userEvent vs fireEvent for realistic interaction testing
  4. Async Testing - Handling promises, waitFor, findBy queries, avoiding act warnings
  5. Custom Render - Setting up providers (Context, Redux, Router) for complex components
  6. Accessibility Queries - Testing with roles, labels, and ARIA attributes
  7. Anti-patterns - Avoiding implementation details, container usage, excessive snapshots
  8. Audit Scripts - Automated detection of suboptimal patterns in existing tests

Query Selection Decision Tree

Use this hierarchy when selecting queries - try options from top to bottom:

1. getByRole          ← Preferred: Accessible, reflects how users & ATs interact
   ↓ Can't find role?

2. getByLabelText     ← For form fields: matches how users read forms
   ↓ No label?

3. getByPlaceholderText  ← For inputs: less accessible than labels
   ↓ No placeholder?

4. getByText          ← For non-interactive content: headings, paragraphs
   ↓ Text not unique?

5. getByDisplayValue  ← For form inputs: current value
   ↓ No display value?

6. getByAltText       ← For images: alt attribute
   ↓ No alt text?

7. getByTitle         ← For title attribute: less accessible
   ↓ No title?

8. getByTestId        ← Last resort: no accessibility verification

Key principles:

  • Higher queries = more confidence in accessibility
  • If you can't query by role/label, fix the component's accessibility first
  • getByTestId means "I've verified accessibility is impossible here"

Important Notes

  • The screen export is not magic - It's just getQueriesForElement(document.body). Using screen.getByRole() is identical to destructured getByRole() from render, but screen never goes stale after re-renders.
  • Testing Library encourages accessibility by making accessible elements easiest to query - If queries are hard, your UI is hard to use. Query difficulty is a UX code smell.
  • Use screen.debug() or screen.logTestingPlaygroundURL() when queries fail - When getByRole fails, run screen.debug() to see the current DOM or screen.logTestingPlaygroundURL() to get an interactive tool showing what queries work. Don't guess at selectors - let Testing Library show you what's available.
  • queryBy returns null silently - use getBy for better errors - When an element should exist, getBy* throws with helpful suggestions about similar elements and available roles. queryBy* returns null, requiring you to add your own assertion with less helpful error output. Use queryBy only when asserting absence with.not.toBeInTheDocument().
  • Act warnings mean React state updates happened outside Testing Library's awareness - Usually caused by promises resolving after test completion or missing await on async queries. Not caused by correct use of findBy or waitFor.
  • userEvent methods are async (return promises), fireEvent methods are sync - Forgetting await userEvent.click() causes "act" warnings and flaky tests as state updates happen after assertions run.

平台分布

Codex

35.51%
按下载量换算383

Claude

30.33%
按下载量换算327

Cursor

20.28%
按下载量换算219

Gemini CLI

9.72%
按下载量换算105

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

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

安装前确认

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

继续浏览同类 Skills