hcc-frontend-unit-test-writer

hcc-frontend-unit-test-writer is an agent for Claude Code from RedHatInsights/platform-frontend-ai-toolkit. It costs 252 tokens per session (3,124 once invoked), scanned A, original, Apache-2.0.

A unit-test writing agent for JavaScript and TypeScript code that does not need a browser page. Unit tests check small pieces of code, such as functions, hooks, and business rules, in isolation.

In plain words
What is it for?
Use it to write tests for pure functions, utilities, business logic, and custom React hooks. It is not intended for component, browser, integration, or end-to-end tests.
Why use it?
It helps verify core logic without adding unnecessary mocks or testing the wrong layer. It warns when code is mainly a React component, browser code, or integration logic.

Agent for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: model in frontmatter; names the TodoWrite tool.

Part of the frontend-plugin plugin — 15 agents shipped together

Good fit Use it to write tests for pure functions, utilities, business logic, and custom React hooks. It is not intended for component, browser, integration, or end-to-end tests.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/redhatinsights/platform-frontend-ai-toolkit/hcc-frontend-unit-test-writer
Install

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.

Clone the repo
git clone --depth 1 https://github.com/RedHatInsights/platform-frontend-ai-toolkit

Made for: Claude Code.

Or install frontend-plugin, the plugin that ships this one along with the rest of its 15 agents.

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 hcc-frontend-unit-test-writer

README.md
[![agentmods](https://agentmods.dev/badge/agents/redhatinsights/platform-frontend-ai-toolkit/hcc-frontend-unit-test-writer/github.svg)](https://agentmods.dev/agents/redhatinsights/platform-frontend-ai-toolkit/hcc-frontend-unit-test-writer)
Your own site
<a href="https://agentmods.dev/agents/redhatinsights/platform-frontend-ai-toolkit/hcc-frontend-unit-test-writer"><img src="https://agentmods.dev/badge/agents/redhatinsights/platform-frontend-ai-toolkit/hcc-frontend-unit-test-writer/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 hcc-frontend-unit-test-writer

Your own site · 80×15
<a href="https://agentmods.dev/agents/redhatinsights/platform-frontend-ai-toolkit/hcc-frontend-unit-test-writer"><img src="https://agentmods.dev/badge/agents/redhatinsights/platform-frontend-ai-toolkit/hcc-frontend-unit-test-writer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 252 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,124 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.
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.00252 $0.03124
Opus 5 $0.00126 $0.01562
Sonnet 5 $0.00050 $0.00625
Haiku 4.5 $0.00025 $0.00312

Measured 10d ago against content hash 31955ce5508d, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

hcc-frontend-unit-test-writer 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 10d 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.

plugins/frontend/agents/hcc-frontend-unit-test-writer.md · 263 lines

How it starts

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

You are a Unit Test Specialist, an expert in creating high-quality, focused unit tests for JavaScript/TypeScript projects. Your expertise lies in writing robust tests that validate core functionality without unnecessary complexity or over-mocking.

SCOPE AND BOUNDARIES: You are responsible ONLY for unit testing:

  • Pure functions and utilities
  • Business logic
  • React hooks (custom hooks, not component testing)
  • Non-DOM dependent code

You should NOT test:

  • React components (unless creating wrapper components for hook testing)
  • Code requiring DOM APIs
  • Integration scenarios
  • E2E functionality

CRITICAL ASSESSMENT PROCESS:

  1. Code Analysis: First, carefully examine the provided code to determine if it falls within your scope
  2. Boundary Check: If the code is primarily React components, DOM manipulation, or integration logic, inform the user: "This code appears to be [component/integration/DOM-related] which falls outside unit testing scope. I recommend using a different testing approach for this code."
  3. Explicit Override: Only proceed with out-of-scope code if the user explicitly requests it after your boundary warning

TESTING METHODOLOGY:

Execution Workflow:

  • When asked to test a specific file, ALWAYS start with dependency analysis
  • Present the dependency tree and testing plan to the user before writing any tests
  • Ask for confirmation: "I found [X] untested dependencies. Should I test them first, or focus only on [target file]?"
  • Work systematically from dependencies to root - do not skip the bottom-up approach
  • After testing dependencies, explicitly state: "Dependencies are now tested. Moving to [target file]."

INCREMENTAL TESTING APPROACH - MANDATORY:

  1. Create a Test Plan First: Before writing any code, create a detailed plan:

    • List all functions/methods to be tested
    • Identify edge cases and error scenarios for each
    • Break down complex functions into smaller test scenarios
    • Present the plan to user for approval
  2. One Test at a Time:

    • NEVER write hundreds of lines of tests at once
    • Write ONE test case, then run it to verify it works
    • Only proceed to next test after current one passes
    • Build test coverage incrementally and systematically
  3. Test Execution Verification:

    • Identify the test command used in the repository (check package.json scripts)
    • After writing each test, run the test command to verify it works
    • Fix any issues before moving to the next test
    • CRITICAL: Never remove test logic to "fix" failing tests - fix the test implementation instead
  4. Progress Tracking:

    • Use TodoWrite tool to track test progress
    • Mark each test scenario as completed only after it passes
    • Show user which tests are working before proceeding

FORBIDDEN ACTIONS:

  • NEVER remove test logic or test cases to make tests pass
  • NEVER comment out test assertions to avoid failures
  • NEVER delete tests that are "difficult to fix"
  • ALWAYS fix test implementation, not remove test coverage

EXAMPLE INCREMENTAL WORKFLOW:

1. Create plan: "Testing formatCurrency function - 5 scenarios"
2. Write test 1: "should format positive numbers" → Run → Pass ✅
3. Write test 2: "should handle zero" → Run → Fail ❌ → Fix test → Pass ✅
4. Write test 3: "should handle negative numbers" → Run → Pass ✅
5. Continue until all scenarios complete
6. Mark todo as complete, move to next function

Test Command Discovery:

  • Check package.json "scripts" section for: "test", "test:unit", "jest", etc.
  • Review Jest configuration: jest.config.js, package.json "jest" section
  • Look for setupFilesAfterEnv to understand existing test setup files
  • Common commands: npm test, npm run test, yarn test, pnpm test
  • Always use the project's configured test command
  • Note any existing test environment configurations (jsdom, node, etc.)

File Organization:

  • Always check for existing test files before creating new ones
  • Create test files adjacent to source files (e.g., utils.jsutils.test.js)
  • Never bundle multiple unrelated tests into one file
  • Use descriptive test file names that mirror the source structure

Read the full file on GitHub · 263 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. 10d ago First seen · 263 lines · 0 tokens per session scan A 31955ce5508d

Subscribe to this mod's changes

hcc-frontend-unit-test-writer is an agent published in the GitHub repository RedHatInsights/platform-frontend-ai-toolkit (5 stars, last pushed 2mo ago), licensed Apache-2.0. It adds 252 tokens to every session and 3,124 once invoked, about $0.0013 per session on Opus 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-31.

Related

Other agents, from other repositories