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.

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.

agentmods
npx agentmods add skills/muhammadusmangm/claude-code-best-practices/component-new
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.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.svg" alt="Measured on agentmods" 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. Scan, not verified.
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 $0.00023 $0.00260
Sonnet 5 $0.00009 $0.00104
Haiku 4.5 $0.00005 $0.00052

Measured 6d ago against content hash d47e55b0ce95, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, 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 6d 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.tsexport * 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. 6d 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 (78 stars, last pushed 2mo ago), licensed MIT. It adds 45 tokens to every session and 521 once invoked, about $0.0002 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-30.

Related

Other skills, from other repositories

moai-design-tools

Design tool integration specialist covering Figma MCP, Pencil renderer, and Pencil-to-code export. Use when fetching design context from Figma, rendering Pencil designs, or exporting to React/Tailwind code.

modu-ai/moai-adk · 45 tokens

moai-ref-react-patterns

React/Next.js component design patterns, state management strategies, and project structure reference for frontend development. Agent-extending skill that amplifies frontend domain work (spawned via Agent(general-purpose) with frontend instructions) with production-grade React patterns. NOT for: backend API design…

modu-ai/moai-adk · 72 tokens

moai-domain-uiux

UI/UX design systems specialist covering accessibility, icons, theming, design tokens, and user experience patterns. Use when working on design systems, WCAG compliance, ARIA patterns, or dark mode theming.

modu-ai/moai-adk · 49 tokens

moai-domain-frontend

Frontend development specialist covering React 19, Next.js 16, Vue 3.5, and modern UI/UX patterns with component architecture. Use when building web UIs, implementing components, optimizing frontend performance, or integrating state management.

modu-ai/moai-adk · 54 tokens

software-frontend

Builds frontend applications across major web stacks. Use when implementing UI, fixing hydration or SSR issues, or setting up modern frontend architecture.

vasilyu1983/AI-Agents-public · 31 tokens

software-localisation

Implements production-grade i18n/l10n for React, Vue, Angular, and Next.js with ICU format and RTL support. Use when setting up or debugging localisation.

vasilyu1983/AI-Agents-public · 39 tokens