component-new

component-new is a skill for Claude Code from MuhammadUsmanGM/claude-code-best-practices. It costs 45 tokens per session (521 once invoked), scanned A, original, MIT.

A task guide for creating a new React user-interface component together with its test file, using the project's existing folder and coding conventions.

In plain words
What is it for?
Use it when adding or scaffolding reusable or feature-specific React components, including their initial test and export file when appropriate.
Why use it?
It removes the repetitive setup work and helps new components fit the surrounding codebase consistently.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Good fit Use it when adding or scaffolding reusable or feature-specific React components, including their initial test and export file when appropriate.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/muhammadusmangm/claude-code-best-practices/component-new
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.

Any agent
npx skills add MuhammadUsmanGM/claude-code-best-practices --skill component-new
Clone the repo
git clone --depth 1 https://github.com/MuhammadUsmanGM/claude-code-best-practices

Made for: Claude Code.

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 component-new

README.md
[![agentmods](https://agentmods.dev/badge/skills/muhammadusmangm/claude-code-best-practices/component-new/github.svg)](https://agentmods.dev/skills/muhammadusmangm/claude-code-best-practices/component-new)
Your own site
<a href="https://agentmods.dev/skills/muhammadusmangm/claude-code-best-practices/component-new"><img src="https://agentmods.dev/badge/skills/muhammadusmangm/claude-code-best-practices/component-new/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 component-new

Your own site · 80×15
<a href="https://agentmods.dev/skills/muhammadusmangm/claude-code-best-practices/component-new"><img src="https://agentmods.dev/badge/skills/muhammadusmangm/claude-code-best-practices/component-new.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 45 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 521 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.00045 $0.00521
Opus 5.5 $0.00018 $0.00208
Sonnet 5.5 $0.00009 $0.00104
Haiku 4.5 $0.00005 $0.00052

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

Security

Grade A, and why

component-new 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.

starters/react/.claude/skills/component-new/SKILL.md · 65 lines

What it actually says

Component New

Scaffold a new component. Ask once for name and placement if ambiguous; then create the files without further prompting.

Steps

  1. Pick a location.
    • If the component is reusable and presentational → src/components/<Name>/.
    • If it belongs to a feature → src/features/<feature>/components/<Name>/.
    • If the project has neither folder, ask the user before creating new top-level structure.
  2. Read a sibling component in the target folder to match its style (props pattern, default vs. named export, test shape, hooks placement). If no sibling exists, use the shape below.
  3. Create three files:
    • <Name>.tsx — the component
    • <Name>.test.tsx — a failing-first test with one toBeInTheDocument assertion
    • index.ts — export * from './<Name>'; (only if the folder contains one)
  4. Do not add it to a barrel file in src/ unless one already exists.
  5. Report the paths created. Stop.

Default shape (if no sibling to mirror)

// src/components/<Name>/<Name>.tsx
import type { ReactNode } from 'react';

export interface <Name>Props {
  children?: ReactNode;
}

export function <Name>({ children }: <Name>Props) {
  return <div>{children}</div>;
}
// src/components/<Name>/<Name>.test.tsx
import { render, screen } from '@testing-library/react';
import { <Name> } from './<Name>';

describe('<Name>', () => {
  it('renders children', () => {
    render(<<Name>>hello</<Name>>);
    expect(screen.getByText('hello')).toBeInTheDocument();
  });
});

Rules

  • Never default-export. Named export only (per project convention).
  • No any. Use unknown or define the type.
  • Don't add third-party dependencies.
  • Don't wire the component into any routes or parent components — that's a follow-up prompt.
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 · 65 lines · 45 tokens per session scan A d47e55b0ce95

Subscribe to this mod's changes

component-new is a skill published in the GitHub repository MuhammadUsmanGM/claude-code-best-practices (98 stars, last pushed today), licensed MIT. It adds 45 tokens to every session and 521 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.