codebelt-code-style

Enforces the CodeBelt TypeScript and React code style guide for project structure, naming conventions, component patterns, service patterns, testing, and TypeScript rules. Use when writing, reviewing, or refactoring TypeScript or React code, creating new files or components, organizing project directories, writing tests, defining Zod schemas, or when the user mentions code style, conventions, linting, file organization, or naming patterns.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "codebelt-code-style" with this command: npx skills add codebelt/codebelt-skills/codebelt-codebelt-skills-codebelt-code-style

CodeBelt Code Style Guide

Opinionated TypeScript and React code style for consistency, maintainability, and scalability. Apply these rules when writing new code, reviewing existing code, or refactoring.

Quick Reference

File Placement

Code TypeLocation
React componentcomponents/pages/, components/shared/, or components/ui/
API logicservices/{provider}/{service}/
Reusable functionutils/{utilName}/
React hookhooks/use{HookName}/
Third-party configlibs/{libraryName}/

File Extensions

ExtensionPurpose
.ts{x}Main code (.tsx only when file contains JSX)
.test.tsTests (placed next to the file being tested)
.types.tsTypeScript types
.utils.ts{x}Helper functions (components only — not in utils/ folders)
.utils.test.tsTests for component helper functions
.schemas.tsZod validation schemas
.schemas.test.tsTests for schemas
.constants.ts{x}Static objects and constants

Naming Conventions

ContextConventionExample
Component folderscamelCaseuserCard/
Component filesPascalCaseUserCard.tsx
Everything elsecamelCasehttpClient.ts
Variables/paramsDescriptive (no single chars)event not e
ConstantscamelCasemaxRetries not MAX_RETRIES
State updater argsprevious prefixpreviousData, previousState
Internal handlershandle prefixhandleSubmit, handleFilterChange
Callback propson prefixonSubmit, onFilterChange

Exports

All files use named exports only:

export function Component() {}

No default exports. No barrel files in application code.

Component Files

One component per .tsx file — no exceptions. Every component, no matter how small, gets its own subfolder and file.


Workflows

Creating a New Component

  1. Create folder: components/{pages|shared|ui}/{componentName}/
  2. Create component file: {ComponentName}.tsx with Props type and JSX only
  3. Extract types to {ComponentName}.types.ts (if needed beyond Props)
  4. Extract constants to {ComponentName}.constants.ts (if any)
  5. Extract helpers to {ComponentName}.utils.ts (if any)
  6. Verify: one component per file, Props not exported, named export

Creating a New Service

  1. Create folder: services/{provider}/{serviceName}/
  2. Create main file: {serviceName}Service.ts with fetch functions and query hooks
  3. Create schema file: {serviceName}Service.schemas.ts with Zod schemas
  4. Create constants file: {serviceName}Service.constants.ts with query keys
  5. Verify: schema and type share same name, comment with HTTP method and path

Creating a New Hook

  1. Create folder: hooks/use{HookName}/
  2. Create hook file: use{HookName}.ts
  3. Create test file: use{HookName}.test.ts

Creating a New Utility

  1. Create folder: utils/{utilName}/
  2. Create main utility file: {utilName}.ts — all helper functions go here (no .utils.ts file)
  3. Create constants file: {utilName}.constants.ts (if any)
  4. Create test file: {utilName}.test.ts

Note: Unlike components, utility folders do not use .utils.ts files. The main {utilName}.ts file itself is the utility — adding a .utils.ts beside it would be redundant.


Detailed References

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Web3

china-sportswear-outdoor-sourcing

Comprehensive sportswear and outdoor equipment sourcing guide for international buyers – provides detailed information about China's athletic apparel, footwear, outdoor gear, and accessories manufacturing clusters, supply chain structure, regional specializations, and industry trends (2026 updated).

Archived SourceRecently Updated
Web3

china-lighting-sourcing

Comprehensive lighting industry sourcing guide for international buyers – provides detailed information about China's LED, smart, outdoor, automotive, and specialty lighting manufacturing clusters, supply chain structure, regional specializations, and industry trends (2026 updated).

Archived SourceRecently Updated
Web3

china-furniture-sourcing

Comprehensive furniture industry sourcing guide for international buyers – provides detailed information about China's residential, office, hotel, outdoor, and custom furniture manufacturing clusters, supply chain structure, regional specializations, and industry trends (2026 updated).

Archived SourceRecently Updated
Web3

china-home-appliances-sourcing

Comprehensive home appliances industry sourcing guide for international buyers – provides detailed information about China's major appliances, kitchen appliances, and small appliances manufacturing clusters, supply chain structure, regional specializations, and industry trends (2026 updated).

Archived SourceRecently Updated