frontend-mobile-development-component-scaffold
You are a React component architecture expert specializing in scaffolding production-ready, accessible, and performant components. Generate complete component implementations with TypeScript, tests, s
About this skill
This skill empowers your AI agent to act as a seasoned React component architect, specializing in the end-to-end scaffolding of production-grade components for both React and React Native applications. It goes beyond basic code generation by focusing on modern best practices, delivering robust implementations complete with TypeScript for enhanced type safety, comprehensive test suites for reliability, well-structured styling solutions, and clear, executable documentation. The agent consistently prioritizes key aspects like accessibility (A11y) and performance, ensuring that all generated components meet high industry standards and are ready for integration into a live environment.
Best use case
Rapidly prototype, develop, or refactor React/React Native components while ensuring immediate adherence to industry best practices, accessibility standards, and performance considerations from the very outset of development.
You are a React component architecture expert specializing in scaffolding production-ready, accessible, and performant components. Generate complete component implementations with TypeScript, tests, s
A complete, well-structured, and ready-to-use React or React Native component, including TypeScript types, a testing file (e.g., Jest/React Testing Library), basic styling definitions, and inline documentation (e.g., JSDoc), all adhering to modern best practices for accessibility and performance.
Practical example
Example input
Scaffold a `UserProfileCard` component for a React application. It should display a user's avatar, name, and a short bio. Include props for `avatarUrl`, `userName`, and `userBio`. Generate TypeScript, utilize Styled Components for styling, include Jest tests, and comprehensive JSDoc.
Example output
```typescript
// components/UserProfileCard/UserProfileCard.tsx
import React from 'react';
import styled from 'styled-components/native'; // Or 'styled-components' for web
interface UserProfileCardProps {
avatarUrl: string;
userName: string;
userBio: string;
}
/**
* A user profile card component displaying an avatar, name, and short biography.
* Designed for accessibility and performance.
* @param {UserProfileCardProps} props - The props for the UserProfileCard component.
* @param {string} props.avatarUrl - The URL for the user's avatar image.
* @param {string} props.userName - The user's full name.
* @param {string} props.userBio - A short biography or description of the user.
*/
const UserProfileCard: React.FC<UserProfileCardProps> = ({
avatarUrl,
userName,
userBio,
}) => {
return (
<CardContainer accessibilityLabel="User Profile Card" accessibilityRole="article">
<AvatarImage source={{ uri: avatarUrl }} alt={`${userName}'s avatar`} />
<UserNameText accessibilityRole="text">{userName}</UserNameText>
<UserBioText accessibilityRole="text">{userBio}</UserBioText>
</CardContainer>
);
};
const CardContainer = styled.View`
background-color: #ffffff;
border-radius: 12px;
padding: 20px;
margin: 10px;
align-items: center;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
elevation: 5; /* For Android shadow */
`;
const AvatarImage = styled.Image`
width: 100px;
height: 100px;
border-radius: 50px;
margin-bottom: 15px;
border: 3px solid #007bff;
`;
const UserNameText = styled.Text`
font-size: 24px;
font-weight: bold;
color: #333333;
margin-bottom: 8px;
text-align: center;
`;
const UserBioText = styled.Text`
font-size: 16px;
color: #666666;
text-align: center;
line-height: 22px;
`;
export default UserProfileCard;
// components/UserProfileCard/UserProfileCard.test.tsx
import React from 'react';
import { render, screen } from '@testing-library/react-native'; // For React Native testing
// import { render, screen } from '@testing-library/react'; // For React web testing
import '@testing-library/jest-native/extend-expect'; // For RN matchers
import UserProfileCard from './UserProfileCard';
describe('UserProfileCard', () => {
const defaultProps = {
avatarUrl: 'https://example.com/avatar.jpg',
userName: 'Jane Doe',
userBio: 'A passionate developer and open-source enthusiast.',
};
it('renders correctly with all provided props', () => {
render(<UserProfileCard {...defaultProps} />);
expect(screen.getByLabelText('User Profile Card')).toBeOnTheScreen();
expect(screen.getByAltText("Jane Doe's avatar")).toBeOnTheScreen();
expect(screen.getByText('Jane Doe')).toBeOnTheScreen();
expect(screen.getByText('A passionate developer and open-source enthusiast.')).toBeOnTheScreen();
});
it('applies correct accessibility roles', () => {
render(<UserProfileCard {...defaultProps} />);
expect(screen.getByLabelText('User Profile Card')).toHaveAccessibilityRole('article');
expect(screen.getByText('Jane Doe')).toHaveAccessibilityRole('text');
expect(screen.getByText('A passionate developer and open-source enthusiast.')).toHaveAccessibilityRole('text');
});
// Add more tests for dynamic content, edge cases, etc.
});
```When to use this skill
- When initiating a new React or React Native project and needing foundational, well-structured component architectures.
- When expanding an existing codebase with new, standardized, and high-quality components.
- When seeking expert guidance, best practices, or a comprehensive checklist for robust component architecture.
- When ensuring components are built from the ground up with accessibility and performance as core requirements.
When not to use this skill
- When the primary need is for highly creative visual design or unique UI/UX elements that require complex aesthetic judgment rather than structured code generation.
- For debugging or optimizing existing, complex component issues that are not related to initial scaffolding or architectural patterns.
- If you require a fully functional application or a complete system design, as this skill focuses specifically on individual component implementations.
- When the desired component logic is highly specialized, domain-specific, and requires deep expertise not generally covered by standard React/React Native patterns.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/frontend-mobile-development-component-scaffold/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How frontend-mobile-development-component-scaffold Compares
| Feature / Agent | frontend-mobile-development-component-scaffold | Standard Approach |
|---|---|---|
| Platform Support | Claude | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | easy | N/A |
Frequently Asked Questions
What does this skill do?
You are a React component architecture expert specializing in scaffolding production-ready, accessible, and performant components. Generate complete component implementations with TypeScript, tests, s
Which AI agents support this skill?
This skill is designed for Claude.
How difficult is it to install?
The installation complexity is rated as easy. You can find the installation instructions above.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
AI Agents for Coding
Browse AI agent skills for coding, debugging, testing, refactoring, code review, and developer workflows across Claude, Cursor, and Codex.
Best AI Skills for Claude
Explore the best AI skills for Claude and Claude Code across coding, research, workflow automation, documentation, and agent operations.
AI Agents for Startups
Explore AI agent skills for startup validation, product research, growth experiments, documentation, and fast execution with small teams.
SKILL.md Source
# React/React Native Component Scaffolding
You are a React component architecture expert specializing in scaffolding production-ready, accessible, and performant components. Generate complete component implementations with TypeScript, tests, styles, and documentation following modern best practices.
## Use this skill when
- Working on react/react native component scaffolding tasks or workflows
- Needing guidance, best practices, or checklists for react/react native component scaffolding
## Do not use this skill when
- The task is unrelated to react/react native component scaffolding
- You need a different domain or tool outside this scope
## Context
The user needs automated component scaffolding that creates consistent, type-safe React components with proper structure, hooks, styling, accessibility, and test coverage. Focus on reusable patterns and scalable architecture.
## Requirements
$ARGUMENTS
## Instructions
### 1. Analyze Component Requirements
```typescript
interface ComponentSpec {
name: string;
type: 'functional' | 'page' | 'layout' | 'form' | 'data-display';
props: PropDefinition[];
state?: StateDefinition[];
hooks?: string[];
styling: 'css-modules' | 'styled-components' | 'tailwind';
platform: 'web' | 'native' | 'universal';
}
interface PropDefinition {
name: string;
type: string;
required: boolean;
defaultValue?: any;
description: string;
}
class ComponentAnalyzer {
parseRequirements(input: string): ComponentSpec {
// Extract component specifications from user input
return {
name: this.extractName(input),
type: this.inferType(input),
props: this.extractProps(input),
state: this.extractState(input),
hooks: this.identifyHooks(input),
styling: this.detectStylingApproach(),
platform: this.detectPlatform()
};
}
}
```
### 2. Generate React Component
```typescript
interface GeneratorOptions {
typescript: boolean;
testing: boolean;
storybook: boolean;
accessibility: boolean;
}
class ReactComponentGenerator {
generate(spec: ComponentSpec, options: GeneratorOptions): ComponentFiles {
return {
component: this.generateComponent(spec, options),
types: options.typescript ? this.generateTypes(spec) : null,
styles: this.generateStyles(spec),
tests: options.testing ? this.generateTests(spec) : null,
stories: options.storybook ? this.generateStories(spec) : null,
index: this.generateIndex(spec)
};
}
generateComponent(spec: ComponentSpec, options: GeneratorOptions): string {
const imports = this.generateImports(spec, options);
const types = options.typescript ? this.generatePropTypes(spec) : '';
const component = this.generateComponentBody(spec, options);
const exports = this.generateExports(spec);
return `${imports}\n\n${types}\n\n${component}\n\n${exports}`;
}
generateImports(spec: ComponentSpec, options: GeneratorOptions): string {
const imports = ["import React, { useState, useEffect } from 'react';"];
if (spec.styling === 'css-modules') {
imports.push(`import styles from './${spec.name}.module.css';`);
} else if (spec.styling === 'styled-components') {
imports.push("import styled from 'styled-components';");
}
if (options.accessibility) {
imports.push("import { useA11y } from '@/hooks/useA11y';");
}
return imports.join('\n');
}
generatePropTypes(spec: ComponentSpec): string {
const props = spec.props.map(p => {
const optional = p.required ? '' : '?';
const comment = p.description ? ` /** ${p.description} */\n` : '';
return `${comment} ${p.name}${optional}: ${p.type};`;
}).join('\n');
return `export interface ${spec.name}Props {\n${props}\n}`;
}
generateComponentBody(spec: ComponentSpec, options: GeneratorOptions): string {
const propsType = options.typescript ? `: React.FC<${spec.name}Props>` : '';
const destructuredProps = spec.props.map(p => p.name).join(', ');
let body = `export const ${spec.name}${propsType} = ({ ${destructuredProps} }) => {\n`;
// Add state hooks
if (spec.state) {
body += spec.state.map(s =>
` const [${s.name}, set${this.capitalize(s.name)}] = useState${options.typescript ? `<${s.type}>` : ''}(${s.initial});\n`
).join('');
body += '\n';
}
// Add effects
if (spec.hooks?.includes('useEffect')) {
body += ` useEffect(() => {\n`;
body += ` // TODO: Add effect logic\n`;
body += ` }, [${destructuredProps}]);\n\n`;
}
// Add accessibility
if (options.accessibility) {
body += ` const a11yProps = useA11y({\n`;
body += ` role: '${this.inferAriaRole(spec.type)}',\n`;
body += ` label: ${spec.props.find(p => p.name === 'label')?.name || `'${spec.name}'`}\n`;
body += ` });\n\n`;
}
// JSX return
body += ` return (\n`;
body += this.generateJSX(spec, options);
body += ` );\n`;
body += `};`;
return body;
}
generateJSX(spec: ComponentSpec, options: GeneratorOptions): string {
const className = spec.styling === 'css-modules' ? `className={styles.${this.camelCase(spec.name)}}` : '';
const a11y = options.accessibility ? '{...a11yProps}' : '';
return ` <div ${className} ${a11y}>\n` +
` {/* TODO: Add component content */}\n` +
` </div>\n`;
}
}
```
### 3. Generate React Native Component
```typescript
class ReactNativeGenerator {
generateComponent(spec: ComponentSpec): string {
return `
import React, { useState } from 'react';
import {
View,
Text,
StyleSheet,
TouchableOpacity,
AccessibilityInfo
} from 'react-native';
interface ${spec.name}Props {
${spec.props.map(p => ` ${p.name}${p.required ? '' : '?'}: ${this.mapNativeType(p.type)};`).join('\n')}
}
export const ${spec.name}: React.FC<${spec.name}Props> = ({
${spec.props.map(p => p.name).join(',\n ')}
}) => {
return (
<View
style={styles.container}
accessible={true}
accessibilityLabel="${spec.name} component"
>
<Text style={styles.text}>
{/* Component content */}
</Text>
</View>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
padding: 16,
backgroundColor: '#fff',
},
text: {
fontSize: 16,
color: '#333',
},
});
`;
}
mapNativeType(webType: string): string {
const typeMap: Record<string, string> = {
'string': 'string',
'number': 'number',
'boolean': 'boolean',
'React.ReactNode': 'React.ReactNode',
'Function': '() => void'
};
return typeMap[webType] || webType;
}
}
```
### 4. Generate Component Tests
```typescript
class ComponentTestGenerator {
generateTests(spec: ComponentSpec): string {
return `
import { render, screen, fireEvent } from '@testing-library/react';
import { ${spec.name} } from './${spec.name}';
describe('${spec.name}', () => {
const defaultProps = {
${spec.props.filter(p => p.required).map(p => ` ${p.name}: ${this.getMockValue(p.type)},`).join('\n')}
};
it('renders without crashing', () => {
render(<${spec.name} {...defaultProps} />);
expect(screen.getByRole('${this.inferAriaRole(spec.type)}')).toBeInTheDocument();
});
it('displays correct content', () => {
render(<${spec.name} {...defaultProps} />);
expect(screen.getByText(/content/i)).toBeVisible();
});
${spec.props.filter(p => p.type.includes('()') || p.name.startsWith('on')).map(p => `
it('calls ${p.name} when triggered', () => {
const mock${this.capitalize(p.name)} = jest.fn();
render(<${spec.name} {...defaultProps} ${p.name}={mock${this.capitalize(p.name)}} />);
const trigger = screen.getByRole('button');
fireEvent.click(trigger);
expect(mock${this.capitalize(p.name)}).toHaveBeenCalledTimes(1);
});`).join('\n')}
it('meets accessibility standards', async () => {
const { container } = render(<${spec.name} {...defaultProps} />);
const results = await axe(container);
expect(results).toHaveNoViolations();
});
});
`;
}
getMockValue(type: string): string {
if (type === 'string') return "'test value'";
if (type === 'number') return '42';
if (type === 'boolean') return 'true';
if (type.includes('[]')) return '[]';
if (type.includes('()')) return 'jest.fn()';
return '{}';
}
}
```
### 5. Generate Styles
```typescript
class StyleGenerator {
generateCSSModule(spec: ComponentSpec): string {
const className = this.camelCase(spec.name);
return `
.${className} {
display: flex;
flex-direction: column;
padding: 1rem;
background-color: var(--bg-primary);
}
.${className}Title {
font-size: 1.5rem;
font-weight: 600;
color: var(--text-primary);
margin-bottom: 0.5rem;
}
.${className}Content {
flex: 1;
color: var(--text-secondary);
}
`;
}
generateStyledComponents(spec: ComponentSpec): string {
return `
import styled from 'styled-components';
export const ${spec.name}Container = styled.div\`
display: flex;
flex-direction: column;
padding: \${({ theme }) => theme.spacing.md};
background-color: \${({ theme }) => theme.colors.background};
\`;
export const ${spec.name}Title = styled.h2\`
font-size: \${({ theme }) => theme.fontSize.lg};
font-weight: 600;
color: \${({ theme }) => theme.colors.text.primary};
margin-bottom: \${({ theme }) => theme.spacing.sm};
\`;
`;
}
generateTailwind(spec: ComponentSpec): string {
return `
// Use these Tailwind classes in your component:
// Container: "flex flex-col p-4 bg-white rounded-lg shadow"
// Title: "text-xl font-semibold text-gray-900 mb-2"
// Content: "flex-1 text-gray-700"
`;
}
}
```
### 6. Generate Storybook Stories
```typescript
class StorybookGenerator {
generateStories(spec: ComponentSpec): string {
return `
import type { Meta, StoryObj } from '@storybook/react';
import { ${spec.name} } from './${spec.name}';
const meta: Meta<typeof ${spec.name}> = {
title: 'Components/${spec.name}',
component: ${spec.name},
tags: ['autodocs'],
argTypes: {
${spec.props.map(p => ` ${p.name}: { control: '${this.inferControl(p.type)}', description: '${p.description}' },`).join('\n')}
},
};
export default meta;
type Story = StoryObj<typeof ${spec.name}>;
export const Default: Story = {
args: {
${spec.props.map(p => ` ${p.name}: ${p.defaultValue || this.getMockValue(p.type)},`).join('\n')}
},
};
export const Interactive: Story = {
args: {
...Default.args,
},
};
`;
}
inferControl(type: string): string {
if (type === 'string') return 'text';
if (type === 'number') return 'number';
if (type === 'boolean') return 'boolean';
if (type.includes('[]')) return 'object';
return 'text';
}
}
```
## Output Format
1. **Component File**: Fully implemented React/React Native component
2. **Type Definitions**: TypeScript interfaces and types
3. **Styles**: CSS modules, styled-components, or Tailwind config
4. **Tests**: Complete test suite with coverage
5. **Stories**: Storybook stories for documentation
6. **Index File**: Barrel exports for clean imports
Focus on creating production-ready, accessible, and maintainable components that follow modern React patterns and best practices.Related Skills
javascript-typescript-typescript-scaffold
You are a TypeScript project architecture expert specializing in scaffolding production-ready Node.js and frontend applications. Generate complete project structures with modern tooling (pnpm, Vite, N
frontend-ui-dark-ts
A modern dark-themed React UI system using Tailwind CSS and Framer Motion. Designed for dashboards, admin panels, and data-rich applications with glassmorphism effects and tasteful animations.
frontend-dev-guidelines
You are a senior frontend engineer operating under strict architectural and performance standards. Use when creating components or pages, adding new features, or fetching or mutating data.
core-components
Core component library and design system patterns. Use when building UI, using design tokens, or working with the component library.
cc-skill-frontend-patterns
Frontend development patterns for React, Next.js, state management, performance optimization, and UI best practices.
new-rails-project
Create a new Rails project
makepad-widgets
Version: makepad-widgets (dev branch) | Last Updated: 2026-01-19 > > Check for updates: https://crates.io/crates/makepad-widgets
makepad-splash
CRITICAL: Use for Makepad Splash scripting language. Triggers on: splash language, makepad script, makepad scripting, script!, cx.eval, makepad dynamic, makepad AI, splash 语言, makepad 脚本
makepad-dsl
CRITICAL: Use for Makepad DSL syntax and inheritance. Triggers on: makepad dsl, live_design, makepad inheritance, makepad prototype, "<Widget>", "Foo = { }", makepad object, makepad property, makepad DSL 语法, makepad 继承, makepad 原型, 如何定义 makepad 组件
fp-backend
Functional programming patterns for Node.js/Deno backend development using fp-ts, ReaderTaskEither, and functional dependency injection
fastapi-templates
Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.
fastapi-router-py
Create FastAPI routers following established patterns with proper authentication, response models, and HTTP status codes.