Create React Component

VerifiedSafe

Create a new React component following project conventions with PropTypes and test attributes for acceptance testing.

Sby Skills Guide Bot
DevelopmentBeginner
3/8/2026
Claude Code
#react#component-scaffolding#proptypes#frontend#acceptance-testing

Recommended for

Automated summary

Scaffolds a new functional React component under src/components with PropTypes, defaultProps, and data-testid attributes that follow project conventions.

Strengths

  • Enforces naming conventions automatically: PascalCase files, kebab-case test IDs, BEM CSS classes
  • Outputs a ready-to-edit skeleton using hooks, required PropTypes, and defaultProps
  • Adds data-testid hooks designed to be driven by acceptance tests such as WebdriverIO step definitions
  • Fits a BDD workflow where step definitions already reference the component's behavior

Limitations

  • The template is deliberately minimal: no business logic, no styling, and no index/barrel export updates
  • Assumes a JavaScript project using PropTypes rather than TypeScript
  • Does not confirm that the feature file or step definitions exist, and runs no tests after generating the component
When to use it

Use it when you need to spin up a convention-compliant, acceptance-test-friendly React component quickly while implementing a feature.

When not to use it

Avoid it when the project uses TypeScript, when the component already exists, or when you need logic, styles, or barrel exports that the template does not generate.

Security analysis

Safe
Quality score78/100

The skill only uses Read, Write, Edit, Grep, and Glob to create and modify source files. It contains no shell execution, network access, destructive commands, or data exfiltration. The template is declarative and limited to React component scaffolding.

No concerns found

How this analysis is made

Examples

Scaffold a component in a subdirectory
/new-component StepEditor steps
Create a dashboard component
Create a new React component called MetricsDashboard in the dashboard directory following our project conventions, with PropTypes and data-testid attributes for the acceptance tests.
Component for an existing feature
We have a feature file for editing steps. Use the new-component skill to create the StepEditor component it needs, with test IDs the step definitions can target.

name: new-component description: Create a new React component following project conventions with PropTypes and test attributes user-invocable: true allowed-tools: Read, Write, Edit, Grep, Glob

Skill: Create New Component

Create a new React component following project conventions.

Usage

/new-component <ComponentName> [directory]

Prerequisites

This should typically be done as part of implementing a feature. Ensure:

  • A feature file exists that requires this component
  • Step definitions reference the component's behavior

Steps

  1. Create the component file at src/components/{directory}/{ComponentName}.jsx
  2. Use functional component with hooks
  3. Define PropTypes for type checking
  4. Export the component as default
  5. Add data-testid attributes for acceptance testing

Template

// src/components/{directory}/{ComponentName}.jsx

import { useState } from 'react';
import PropTypes from 'prop-types';

function {ComponentName}({ prop1, prop2 }) {
  // Component logic here

  return (
    <div data-testid="{component-name}">
      {/* Component content */}
    </div>
  );
}

{ComponentName}.propTypes = {
  prop1: PropTypes.string.isRequired,
  prop2: PropTypes.number
};

{ComponentName}.defaultProps = {
  prop2: 0
};

export default {ComponentName};

Naming Conventions

  • Component files: PascalCase (StepEditor.jsx)
  • Test IDs: kebab-case (data-testid="step-editor")
  • CSS classes: kebab-case with BEM (step-editor__input)

Test ID Guidelines

Add data-testid attributes for elements that acceptance tests need to interact with:

<button data-testid="add-step-button">Add Step</button>
<input data-testid="step-name-input" />
<div data-testid="metrics-dashboard">...</div>

Integration with Acceptance Tests

Components should be designed to support acceptance testing:

// In step definitions
When('I click the add step button', async function () {
  const button = await this.page.$('[data-testid="add-step-button"]');
  await button.click();
});

Then('I should see the step editor', async function () {
  const editor = await this.page.$('[data-testid="step-editor"]');
  expect(editor).to.exist;
});

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/create-react-component-mmh8qr0t/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/create-react-component-mmh8qr0t' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/create-react-component-mmh8qr0t/download' --output '.skill-downloads/create-react-component-mmh8qr0t/SKILL.md.part' && mv '.skill-downloads/create-react-component-mmh8qr0t/SKILL.md.part' '.skill-downloads/create-react-component-mmh8qr0t/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

Tools declared by the author (check availability in your agent): Read, Write, Edit, Grep, Glob

Original excerpt: Prerequisites

This should typically be done as part of implementing a feature. Ensure:

  • A feature file exists that requires this component
  • Step definitions reference the component's behavior

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/create-react-component-mmh8qr0t/SKILL.md' && test -s '.skill-downloads/create-react-component-mmh8qr0t/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/new-component' && cp -R '.skill-downloads/create-react-component-mmh8qr0t' '.claude/skills/new-component'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/create-react-component-mmh8qr0t'

openskills read 'create-react-component-mmh8qr0t'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/create-react-component-mmh8qr0t/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills