Agent skill

Component Testing

by makifbaysal in makifbaysal/tasktrooper

A skill your agent uses when writing or changing any React component - React Testing Library tests are behavior-focused (byRole first), use user-event, assert on accessible output, one behavior per…

Apache-2.0Auto-check passedFrontend & Design

Install Component Testing

skills CLI
$ npx skills add makifbaysal/tasktrooper --skill component-testing -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install makifbaysal/tasktrooper component-testing --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/makifbaysal/tasktrooper.git skills-src && mkdir -p .claude/skills && cp -r skills-src/catalog/agents/frontend-developer/skills/component-testing .claude/skills/component-testing && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
component-testing
GitHub stars
109
Token cost
~1.2k tokens
SKILL.md length
540 words
Files
1
Skills in repo
99
Repo updated
First seen
Licence
Apache-2.0

At a glance

A skill your agent uses when writing or changing any React component - React Testing Library tests are behavior-focused (byRole first), use user-event, assert on accessible output, one behavior per…

  • Changing any React component - React Testing Library tests are behavior-focused (byRole first)
  • SKILL.md covers Overview, Rules, Worked Example and Common Mistakes, plus 1 more section
  • Calls npm
  • Assert on accessible output

What it does

Component Testing is an agent skill from makifbaysal/tasktrooper. Use when writing or changing any React component - React Testing Library tests are behavior-focused (byRole first), use user-event, assert on accessible output, one behavior per test, and run in npm test

Its SKILL.md is about 1.2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Frontend & Design, covering React components and Accessibility. It works with Testing Library and npm. The repository describes itself as: Local-first agent platform: board + role agents + agent CLI runs (Claude Code, Cursor, Antigravity, OpenCode) or local and API models (Ollama, LM Studio), all on your own Mac. The licence is Apache-2.0.

When your agent uses it

  • Changing any React component - React Testing Library tests are behavior-focused (byRole first)
  • Assert on accessible output
  • One behavior per test
  • Run in npm test

Example prompts

  • “/component-testing”

What it can do on your machine

Read from SKILL.md and the folder at commit 09f6258. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • npm

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use npm, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Component Testing loads about 1.2k tokens when it runs. Until then it costs about 55 tokens; SKILL.md has 540 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~55
When it runs · the whole SKILL.md, loaded when a task matches
~1.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from makifbaysal/tasktrooper at commit 09f6258, republished under its Apache-2.0 licence (© makifbaysal). 540 words, ~1,163 tokens.

Download SKILL.mdSave it as .claude/skills/component-testing/SKILL.md (or your agent's skills folder).
name
component-testing
description
Use when writing or changing any React component - React Testing Library tests are behavior-focused (byRole first), use user-event, assert on accessible output, one behavior per test, and run in npm test
category
testing
tech_stack
React

Component Testing (React Testing Library)

Overview

A component test that queries by data-testid or asserts on internal state proves the implementation didn't change, not that the component works for a user. React Testing Library tests must exercise the component the way a user (and a screen reader) does: find things by role/label/text, interact with them, and assert on what actually rendered.

Core principle: Test behavior, not implementation. If a refactor that keeps the same user-facing behavior breaks the test, the test is coupled to the wrong thing.

Rules

  • Query priority: byRole first. Prefer getByRole (with { name: ... }) over byLabelText/byText, and both over byTestId. byTestId is a last resort for a node with no accessible role or text — reach for it only when nothing else identifies the element, and treat its presence as a smell worth a follow-up (usually a missing label/role, per accessibility-basics).
  • user-event over fireEvent. fireEvent.click fires one DOM event; userEvent.click simulates the real sequence of events a browser produces (focus, pointer, keyboard) and catches bugs fireEvent cannot (e.g. a control that only works because it happens to be focused). Always await userEvent.setup() / await user.click(...).
  • Assert on accessible, user-visible output. Check rendered text, roles, aria-* state (aria-expanded, aria-invalid, aria-disabled), and focus — not component internals, prop values, or CSS class names.
  • One behavior per test. A test named for the behavior it proves ("shows a validation error when the field is left empty"), not "renders correctly". Multiple assertions are fine as long as they all check the same behavior; a second, unrelated behavior gets its own test.
  • No implementation-detail mocking. Mock the network/API boundary (MSW or the API client module), never a child component or a hook's internals just to make the test pass — that tests the mock, not the component.
  • Wire it into npm test. New component test files must run under the project's existing npm test script (Vitest/Jest) with no extra flags — a suite that only runs when invoked by hand is not part of the pipeline (see ci-cd-pipeline-authoring).
  • TDD still applies (see tdd-workflow): write the test against the intended behavior first, watch it fail, then implement.
Show full SKILL.md (192 more words)Show less

Worked Example

tsx
// ❌ implementation-coupled: breaks on any internal refactor, proves nothing
// about what the user sees
test("renders correctly", () => {
  render(<LoginForm />);
  expect(screen.getByTestId("submit-btn")).toBeInTheDocument();
});

// ✅ behavior-focused: fails only when the real user-facing behavior breaks
test("shows a validation error when submitting with an empty email", async () => {
  const user = userEvent.setup();
  render(<LoginForm />);

  await user.click(screen.getByRole("button", { name: /sign in/i }));

  expect(screen.getByRole("alert")).toHaveTextContent(/email is required/i);
  expect(screen.getByRole("textbox", { name: /email/i })).toHaveAttribute("aria-invalid", "true");
});

The second test finds the button and field the way a user would (by their accessible name), drives them with user-event, and asserts on what actually appears — it stays green through any internal rewrite that keeps this behavior.

Common Mistakes

  • Querying by data-testid when a role/label query would work — usually a sign the component is missing an accessible name in the first place.
  • Using fireEvent for anything a real user would do with a mouse or keyboard.
  • One giant test asserting the whole component "renders correctly" instead of named tests per behavior.
  • Snapshot tests as the only coverage — they fail on any markup change, meaningful or not, and don't document behavior.
  • Mocking a child component to isolate the parent, hiding real integration bugs.
  • A new *.test.tsx file that npm test never picks up (wrong glob, wrong location) — decoration, not a gate.

Red Flags

  • screen.getByTestId(...) with no comment on why no role/label query worked.
  • fireEvent anywhere a user-event equivalent exists.
  • A test file with only snapshot assertions.
  • Assertions on a component's props/state instead of its rendered output.
  • Test suite green locally but npm test in CI never runs the new file.

© makifbaysal, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in catalog/agents/frontend-developer/skills/component-testing of makifbaysal/tasktrooper.

Open the folder on GitHubat commit 09f6258

Compare with similar skills

Component Testing next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Component Testing compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Component Testing this skillmakifbaysal/tasktrooper109—~1.2kAutomated safety check: PassApache-2.0
GSAP for Reactgreensock/gsap-skills16k4 repos~1.6kAutomated safety check: PassMIT
Blog ChartAgriciDaniel/claude-blog2.3k1 repos~2.4kAutomated safety check: PassMIT
Connect Component To Figmadequelabs/cauldron129—~2kAutomated safety check: PassMPL-2.0
A11y Auditscaleway/ultraviolet127—~979Automated safety check: PassApache-2.0
Acarshub Design Languagesdr-enthusiasts/docker-acarshub117—~1.1kAutomated safety check: PassGPL-3.0

Similar skills

  • GSAP for React

    greensock/gsap-skills

    Shows how to run GSAP animations in React and Next.js with the useGSAP hook, refs, scoped selectors and automatic cleanup on unmount.

    16k GitHub starsUsed in 4 repos~1.6k tokens
    Frontend & DesignAuto-check passed
  • Blog Chart

    AgriciDaniel/claude-blog

    Generate dark-mode-compatible inline SVG data visualization charts for blog posts.

    2.3k GitHub starsUsed in 1 repo~2.4k tokens
    Frontend & DesignAuto-check passed
  • Connect Component To Figma

    dequelabs/cauldron

    Add a Figma Code Connect (.figma.tsx) file for a Cauldron React component.

    129 GitHub stars~2k tokensUpdated yesterday
    Frontend & DesignAuto-check passed
  • A11y Audit

    scaleway/ultraviolet

    Audit components for accessibility. An agent skill from scaleway/ultraviolet.

    127 GitHub stars~979 tokensUpdated yesterday
    Frontend & DesignAuto-check passed
  • Acarshub Design Language

    sdr-enthusiasts/docker-acarshub

    Use ONLY when working in the docker-acarshub repository AND building UI -- React components, SCSS modules, theme variables, accessibility, mobile responsiveness, Catppuccin color usage, Zustand…

    117 GitHub stars~1.1k tokensUpdated yesterday
    Frontend & DesignAuto-check passed
  • Best practices for building and improving React code components in Framer, a no-code website builder.

    138 GitHub stars~1.3k tokensUpdated 7 days ago
    Frontend & DesignAuto-check passed

More from makifbaysal/tasktrooper

All 99 skills in this repo
  • API Contract Testing

    makifbaysal/tasktrooper

    A skill your agent uses when a task adds or changes an HTTP endpoint, its request/response shape, status codes, auth or error format - the request matrix, curl templates and what counts as a…

    109 GitHub starsUsed in 1 repo~771 tokens
    Auto-check passed
  • Acceptance Criteria Gwt

    makifbaysal/tasktrooper

    A skill your agent uses when writing acceptance criteria for a task - express each as an observable Given/When/Then that QA can execute, including negative cases

    109 GitHub stars~1.7k tokensUpdated today
    Auto-check passed
  • Accessibility Check

    makifbaysal/tasktrooper

    A skill your agent uses when a task changes any screen, form, dialog, menu or control - Lighthouse/axe scan of the changed screens, a keyboard walk, and the thresholds that fail a task

    109 GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Analiz Gate

    makifbaysal/tasktrooper

    A skill your agent uses when deciding whether a request needs an analiz task before implementation - the conditions that require the architect's analysis versus going straight to implementation

    109 GitHub stars~641 tokensUpdated today
    Auto-check passed
  • Analiz HTML Report

    makifbaysal/tasktrooper

    A skill your agent uses when you write or revise the analiz deliverable - the ONE self-contained HTML report (spec and plan as sections) a human reviews passage by passage

    109 GitHub stars~3.9k tokensUpdated today
    Auto-check passed
  • Analiz Human Review Gate

    makifbaysal/tasktrooper

    A skill your agent uses when you finish an analiz report - the human must approve the analysis before any implementation task is created, via the analizreview column

    109 GitHub stars~2.2k tokensUpdated today
    Auto-check passed

Questions about Component Testing

What does Component Testing do?

A skill your agent uses when writing or changing any React component - React Testing Library tests are behavior-focused (byRole first), use user-event, assert on accessible output, one behavior per…. Component Testing is an agent skill from makifbaysal/tasktrooper.

When should I use Component Testing?

Component Testing fits situations like: changing any React component - React Testing Library tests are behavior-focused (byRole first); assert on accessible output; one behavior per test; run in npm test.

How do I install Component Testing in Claude Code?

Run `npx skills add makifbaysal/tasktrooper --skill component-testing -a claude-code`. Or copy the skill folder (catalog/agents/frontend-developer/skills/component-testing in makifbaysal/tasktrooper) into .claude/skills/component-testing in your project. Claude Code loads it when a task matches its description.

How do I install Component Testing in Codex?

Run `npx skills add makifbaysal/tasktrooper --skill component-testing -a codex`. Or copy the skill folder (catalog/agents/frontend-developer/skills/component-testing in makifbaysal/tasktrooper) into .agents/skills/component-testing in your project. Codex loads it when a task matches its description.

Can I use Component Testing in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add makifbaysal/tasktrooper --skill component-testing -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/component-testing, .gemini/skills/component-testing, .github/skills/component-testing and .opencode/skills/component-testing in your project.

What does Component Testing need to run?

Going by SKILL.md and its folder, Component Testing needs the command-line tools its instructions call (npm).

Does Component Testing access the network?

SKILL.md contains no URLs. Its commands use npm, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Component Testing safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Component Testing use?

Component Testing is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Component Testing use?

About 1.2k tokens (SKILL.md is roughly 4.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Component Testing?

Skills that share tags, products or a category with Component Testing: GSAP for React (greensock/gsap-skills, 16k stars), Blog Chart (AgriciDaniel/claude-blog, 2.3k stars), Connect Component To Figma (dequelabs/cauldron, 129 stars) and A11y Audit (scaleway/ultraviolet, 127 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Component Testing?

makifbaysal (a GitHub user) maintains it in makifbaysal/tasktrooper, which has 109 GitHub stars. The repository holds 99 skills in this directory. The repository was last updated on October 7, 2026.

Source: makifbaysal/tasktrooper on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.