agentleFS
AaqibhafeezkhanAaqibhafeezkhan/skillself/skills/react-component-spec/SKILL.md

react-component-spec

Skill0 starsChanged 4 days agoMITView on GitHub

The skill specifies accessible React components with typed props, keyboard support, ARIA behavior, a props table, tests and explicit interaction states; use it when asking to build or review a reusable React component.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

11 rules. About 0 are common, 9 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈9

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill when asked to build a React component, write a component specification, improve accessibility, define typed props, or add a …

    line 13
  2. Very specific:

    Read references/a11y-checklist.md and choose native HTML semantics before custom roles.

    line 27
  3. Distinctive:

    Add associated labels, accessible names, descriptions and ARIA state only where semantic HTML is insufficient.

    line 31
  4. Distinctive:

    Document every public prop in a table with type, required status and behavior.

    line 32
  5. Distinctive:

    Write tests for rendering, prop combinations, keyboard operation, focus, accessible queries and boundary states.

    line 33
  6. Distinctive:

    Run the repository's type-check, lint and test commands and report exact outcomes.

    line 34
  7. Distinctive:

    Ask for the design or behavior when a visual component cannot be inferred from supplied requirements.

    line 44
  8. Distinctive:

    Avoid focus traps unless the component is explicitly a modal dialog.

    line 47
  9. Very specific:

    Do not use clickable div elements when a button or link is appropriate.

    line 52
  10. Distinctive:

    Do not add ARIA roles that contradict native element semantics.

    line 53
  11. Distinctive:

    Do not omit keyboard and disabled-state tests for interactive controls.

    line 54

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Purpose

Specify a complete accessible React component with typed props, keyboard interaction, ARIA semantics, documentation and tests.

When to use

Use this skill when asked to build a React component, write a component specification, improve accessibility, define typed props, or add a component test file.

Inputs needed

  • Component purpose and visible content.
  • Required and optional props with expected behavior.
  • Interaction model and state ownership.
  • Existing React version, styling system and test framework when repository context is available.

Step-by-step procedure

  1. Inspect the existing component conventions, TypeScript settings, styling approach and test runner.
  2. Read references/a11y-checklist.md and choose native HTML semantics before custom roles.
  3. Define a TypeScript props interface with required, optional and callback fields.
  4. Specify default behavior, controlled versus uncontrolled state, disabled state and invalid input handling.
  5. Implement keyboard behavior and focus handling without overriding native browser interactions unnecessarily.
  6. Add associated labels, accessible names, descriptions and ARIA state only where semantic HTML is insufficient.
  7. Document every public prop in a table with type, required status and behavior.
  8. Write tests for rendering, prop combinations, keyboard operation, focus, accessible queries and boundary states.
  9. Run the repository's type-check, lint and test commands and report exact outcomes.

Exact output format

Return: Component purpose, Props table (prop, type, required, description), Implementation with a complete TSX file, Accessibility behavior, and Tests with a complete test file. Include no prose after the test file.

Edge cases

  • Ask for the design or behavior when a visual component cannot be inferred from supplied requirements.
  • Preserve native semantics for buttons, links, inputs and form controls.
  • State updates must not be duplicated between internal state and controlled props.
  • Avoid focus traps unless the component is explicitly a modal dialog.

Do not

  • Do not use clickable div elements when a button or link is appropriate.
  • Do not add ARIA roles that contradict native element semantics.
  • Do not omit keyboard and disabled-state tests for interactive controls.

Worked example summary

A dismissible alert accepts title, message, variant, onDismiss and dismissible. The implementation uses role="alert", a labeled native button and a test covering keyboard dismissal and non-dismissible state.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.