Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add MuhammadUsmanGM/claude-code-best-practices --skill test-componentgit clone --depth 1 https://github.com/MuhammadUsmanGM/claude-code-best-practicesWrote 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.
[](https://agentmods.dev/skills/muhammadusmangm/claude-code-best-practices/test-component)<a href="https://agentmods.dev/skills/muhammadusmangm/claude-code-best-practices/test-component"><img src="https://agentmods.dev/badge/skills/muhammadusmangm/claude-code-best-practices/test-component/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.
<a href="https://agentmods.dev/skills/muhammadusmangm/claude-code-best-practices/test-component"><img src="https://agentmods.dev/badge/skills/muhammadusmangm/claude-code-best-practices/test-component.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00050 | $0.00501 |
| Opus 5.5 | $0.00020 | $0.00200 |
| Sonnet 5.5 | $0.00010 | $0.00100 |
| Haiku 4.5 | $0.00005 | $0.00050 |
Grade A, and why
test-component 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 3mo 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.
What it actually says
Test Component
Write tests for an existing component following the project's conventions.
Steps
- Read the component file. Note its props, any hooks it calls, and whether it fetches data.
- Read one existing test file in the same area and mirror its style — imports, render helpers, matcher choices, mock setup.
- Plan 3–5 assertions, in this priority order:
- Renders the expected role/label on mount.
- Responds to user interaction (click, type) with a visible result.
- Handles loading / empty / error states if the component has them.
- Calls the right callback with the right args (if props include callbacks).
- Mock at the network boundary. If the component fetches via a shared
client in
src/api/, add an MSW handler insrc/test/msw/— don't mock the component's internal hooks. - Write the test file next to the component. Name:
<Name>.test.tsx. - Run
npm test -- <Name>once and report pass/fail. Do not fix the component to make the test pass — if a test reveals a bug, stop and tell the user.
Query priority (enforced)
Use in this order, only falling back when the higher option genuinely doesn't apply:
getByRolewith an accessible namegetByLabelTextgetByPlaceholderTextgetByTextgetByTestId— last resort
Rules
- Never call
act()manually. If a test "needs" it, you're testing implementation — rewrite the assertion. - Never
await new Promise(...)to wait for state. UsefindBy*orwaitFor. - No snapshot tests unless the component has a stable, small render surface (icons, formatted strings). Component snapshots rot fast.
- Don't edit the component under test. This skill writes tests only.
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.
- 3mo ago First seen · 50 lines · 50 tokens per session scan A 092129a518ce
test-component is a skill published in the GitHub repository MuhammadUsmanGM/claude-code-best-practices (119 stars, last pushed 1mo ago), licensed MIT. It adds 50 tokens to every session and 501 once invoked, about $0.0002 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.
test-component compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| test-componentMuhammadUsmanGM/claude-code-best-practices | Skill | 119 | 1mo ago | MIT | A | 50 | Claude Code |
| web3-testingwshobson/agents | Skill | 43k | 3d ago | MIT | A | 46 | Claude Code |
| temporal-python-testingwshobson/agents | Skill | 43k | 3d ago | MIT | A | 45 | Claude Code |
| data-quality-frameworkswshobson/agents | Skill | 43k | 3d ago | MIT | A | 37 | Claude Code |
| dbt-transformation-patternswshobson/agents | Skill | 43k | 3d ago | MIT | A | 47 | Claude Code |
| verify-workHoangNguyen0403/agent-skills-standard | Skill | 597 | today | MIT | A | 23 | Codex |
| flutter-bloc-state-managementHoangNguyen0403/agent-skills-standard | Skill | 597 | today | MIT | A | 52 | Claude Code, Codex |