fec-component-testing

fec-component-testing is a skill for Claude Code from bovinphang/frontend-craft. It costs 123 tokens per session (1,207 once invoked), scanned A, original, MIT.

A guide for writing and reviewing front-end unit, component, and lightweight integration tests. These tests check small pieces of code and UI behavior without running a full browser journey.

In plain words
What is it for?
Use it with React Testing Library, Vue Test Utils, hooks, composables, props, events, accessible queries, user actions, mocks, forms, and API-mocked integrations.
Why use it?
It helps catch regressions in component interactions, loading and error states, hooks, callbacks, and public behavior while keeping tests close to the code.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is vi.mock("../api/users", () => ({.

Part of the frontend-craft plugin — 56 skills, 11 commands, 14 agents, 5 hooks shipped together

Good fit Use it with React Testing Library, Vue Test Utils, hooks, composables, props, events, accessible queries, user actions, mocks, forms, and API-mocked integrations.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/bovinphang/frontend-craft
agentmods
npx agentmods add skills/bovinphang/frontend-craft/fec-component-testing

Made for: Claude Code.

Or install frontend-craft, the plugin that ships this one along with the rest of its 56 skills, 11 commands, 14 agents, 5 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for fec-component-testing

README.md
[![agentmods](https://agentmods.dev/badge/skills/bovinphang/frontend-craft/fec-component-testing/github.svg)](https://agentmods.dev/skills/bovinphang/frontend-craft/fec-component-testing)
Your own site
<a href="https://agentmods.dev/skills/bovinphang/frontend-craft/fec-component-testing"><img src="https://agentmods.dev/badge/skills/bovinphang/frontend-craft/fec-component-testing/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for fec-component-testing

Your own site · 80×15
<a href="https://agentmods.dev/skills/bovinphang/frontend-craft/fec-component-testing"><img src="https://agentmods.dev/badge/skills/bovinphang/frontend-craft/fec-component-testing.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 123 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,207 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00123 $0.01207
Opus 5.5 $0.00049 $0.00483
Sonnet 5.5 $0.00025 $0.00241
Haiku 4.5 $0.00012 $0.00121

Measured 1mo ago against content hash a086fc1675db, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

fec-component-testing scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

localized/zh-CN/skills/fec-component-testing/SKILL.md · 120 lines

How it starts

The opening of the file, as written. The whole thing — 120 lines — stays where its author put it; the contents beside it link to each section on GitHub.

组件测试

用途

用贴近代码和用户行为的测试验证纯逻辑、组件契约与轻量模块协作,减少重构和 UI 交互回归。

流程

1. 先确定测试层级

  • 单元测试:纯函数、hooks/composables、utils、状态逻辑、schema。
  • 组件测试:props/emits、回调、用户交互、loading/error/empty、mock 边界。
  • 轻量集成测试:表单 + API mock + Router/Store/Provider 上下文。

跨页面真实浏览器流程分流到 E2E workflow;测试层选择不清楚时先做测试分层规划。

2. 优先按用户可感知行为测试

每个测试保持 Arrange / Act / Assert 清晰分段:准备数据和渲染、执行用户动作、断言用户可见结果或公开契约。

import { render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { SearchBox } from "./SearchBox";

test("submits the entered keyword", async () => {
  const user = userEvent.setup();
  const onSearch = vi.fn();

  render(<SearchBox onSearch={onSearch} />);

  await user.type(screen.getByRole("searchbox", { name: /keyword/i }), "orders");
  await user.click(screen.getByRole("button", { name: /search/i }));

  expect(onSearch).toHaveBeenCalledWith("orders");
});

3. Vue 组件使用可访问查询或明确文本断言

import { mount } from "@vue/test-utils";
import UserMenu from "./UserMenu.vue";

test("emits logout when the logout item is clicked", async () => {
  const wrapper = mount(UserMenu, {
    props: { userName: "Ada" },
  });

  await wrapper.get('[data-testid="logout-button"]').trigger("click");

  expect(wrapper.emitted("logout")).toHaveLength(1);
});

优先使用角色、标签和可见文本;仅在没有稳定语义时使用 data-testid。

4. 控制 mock 边界

vi.mock("../api/users", () => ({
  fetchUsers: vi.fn(async () => [{ id: "1", name: "Ada" }]),
}));
  • mock 网络、时间、路由和浏览器 API。
  • 不 mock 被测组件的内部函数。
  • 对设计系统基础组件只做轻量 mock,保留可访问行为。
  • mock 数据应表达业务场景,不使用只有测试作者能理解的随意字符串。
  • 共享 fixture 应保持可读,复杂对象用 builder 补默认值;每个测试只覆盖与场景相关的字段。
  • mock 网络时优先模拟用户可见结果和错误形状,不复制后端实现细节。

5. 覆盖关键状态

每个复杂组件至少覆盖:

  • 默认渲染。
  • 用户交互和回调。
  • loading / empty / error。
  • 权限或禁用态。
  • 键盘交互和焦点行为(适用时)。

6. 保持测试可维护

function setup() {
  const user = userEvent.setup();
  const onSubmit = vi.fn();
  render(<ProfileForm onSubmit={onSubmit} />);
  return { user, onSubmit };
}

将重复渲染逻辑放入 setup,但不要隐藏测试的核心操作和断言。

Read the full file on GitHub · 120 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 120 lines · 123 tokens per session scan A a086fc1675db

Subscribe to this mod's changes

fec-component-testing is a skill published in the GitHub repository bovinphang/frontend-craft (22 stars, last pushed 29d ago), licensed MIT. It adds 123 tokens to every session and 1,207 once invoked, about $0.0005 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

codex-ab

Run an A/B codex review experiment — holistic codex review vs 3 focused dimension passes (security, ecto, liveview) on the branch diff, classify findings, report a panel-value verdict. Use when the branch is fresh, before any codex review runs.

oliver-kriska/claude-elixir-phoenix · 60 tokens

improve-code-quality

Guided journey from a working-but-untested vibe-coded prototype to a production-ready product with tests, clean structure, a business-rules boundary, and resilience at scale. Orchestrates nine skills phase by phase - working-with-legacy-code, clean-code, refactoring-patterns, software-design-philosophy…

wondelai/skills · 227 tokens

codex-loop

Fix Elixir/Phoenix code until Codex CLI review comes back clean — bounded review, fix, verify loop before opening a PR. Use when codex is installed and you want an external cross-model critic on your changes before pushing.

oliver-kriska/claude-elixir-phoenix · 52 tokens

test-strategy

Coverage-design method for qa-engineer — pyramid ratios per archetype, equivalence/boundary/property case selection, mutation score as the real coverage signal, and a flake-quarantine policy. Turns "coverage is 90%" (a number with no method) into a defensible test plan. Emits TEST-STRATEGY-{slug}.md, which the QA gate…

avelikiy/great_cto · 82 tokens

quant-validation

The methods a financial-ML result has to survive before it is evidence — purged cross-validation with an embargo, triple-barrier labelling, sample uniqueness under overlapping labels, fractional differentiation, meta-labelling, and multiple-testing correction. Written because the invariants were required of…

avelikiy/great_cto · 104 tokens

e2e-reviewer

Use when reviewing Playwright or Cypress E2E specs, Page Objects (POM), PRs, pull requests, patches, diffs, or changed test files — asked to review tests, audit test quality, or find weak, flaky, or silently-passing tests; when tests pass CI but prove nothing or miss bugs; when auditing missing awaits, vacuous or…

voidmatcha/e2e-skills · 131 tokens