react-conventions
React and React Native coding conventions with TypeScript. Use this skill when creating components, writing hooks, or reviewing React/React Native code. Enforces naming conventions, component structure, typing patterns, accessibility, and performance best practices.
Security Assessment
About react-conventions
The 'react-conventions' skill provides a comprehensive set of best practices for coding in React and React Native with TypeScript. It helps developers maintain consistency, readability, and performance in their code by enforcing clear guidelines for naming conventions, component structure, typing patterns, and accessibility considerations. This skill ensures that developers follow standardized approaches to writing components, hooks, and props, which leads to more maintainable and scalable codebases. It is especially useful for teams working on large-scale projects where consistency is crucial for collaboration and efficient code review processes.
Key features of the 'react-conventions' skill include rules for naming conventions (e.g., using PascalCase for components, camelCase for hooks), proper typing with TypeScript (e.g., using FC<Props> for functional components), and suggestions for component structure (e.g., order of imports, types, hooks, and render logic). The skill also covers best practices for optimizing accessibility and performance, with guidelines for JSX readability, using default values in destructuring, and making props readonly by default. Additionally, it emphasizes testability by promoting clear separation of concerns within components.
The target users for this skill are React and React Native developers working with TypeScript, especially those who are creating reusable components, writing custom hooks, or reviewing code within teams. It is ideal for developers who want to adhere to industry best practices for code quality and maintainability, and it is particularly useful in team environments where standardized conventions are necessary for smooth collaboration and consistent code reviews.
FAQ
How do I enforce naming conventions with this skill?
This skill enforces naming conventions by requiring components to be named using PascalCase, props interfaces to use '[Component]Props', and hooks to follow camelCase with the 'use' prefix.
Can this skill be used with non-TypeScript React projects?
This skill is designed specifically for React and React Native projects that use TypeScript. For non-TypeScript projects, certain recommendations, such as typing components and props, may not apply.
What are the requirements for using this skill?
This skill requires a React or React Native project set up with TypeScript. It also assumes the use of libraries like Tailwind (or Uniwind) for styling and a general understanding of React and TypeScript.
Does the skill help with performance optimization?
Yes, the skill includes guidelines for performance optimization, such as JSX readability, efficient component structure, and accessibility best practices to ensure that your components are optimized for performance in both development and production environments.
How should I structure components with this skill?
The skill recommends a clear structure for components, starting with imports, followed by types, hooks, handlers, and then the render logic. This order ensures readability and maintainability, making it easier to manage complex components.
Install react-conventions
Quick Setup:
- Copy the skill folder to
.claude/skills/ - Claude will automatically detect and use the skill
Repository
benaor/claude-config