skills/codebelt-code-style/SKILL.md
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.
npx skillsauth add codebelt/codebelt-skills codebelt-code-styleInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Opinionated TypeScript and React code style for consistency, maintainability, and scalability. Apply these rules when writing new code, reviewing existing code, or refactoring.
| Code Type | Location |
|-----------|----------|
| Page component | components/pages/{pageName}/ |
| Reusable domain component | components/shared/{componentName}/ |
| Pure presentational primitive | components/ui/{componentName}/ |
| API logic | services/{provider}/{service}/ or services/{service}/ |
| Reusable function | utils/{utilName}/ |
| React hook | hooks/use{HookName}/ |
| Global state store | stores/{storeName}/ |
| Global stylesheet | styles/ |
| Next.js route files | app/ |
| Third-party config | libs/{libraryName}/ |
See COMPONENTS.md for the decision tree between ui/, shared/, and pages/.
| Extension | Purpose |
|-----------|---------|
| .ts{x} | Main code (.tsx only when file contains JSX) |
| .test.ts | Tests (placed next to the file being tested) |
| .types.ts | TypeScript types |
| .utils.ts{x} | Helper functions (components only — not in utils/ folders) |
| .utils.test.ts | Tests for component helper functions |
| .schemas.ts | Zod validation schemas |
| .schemas.test.ts | Tests for schemas |
| .dynamic.tsx | Next.js dynamic import wrapper (ssr: false) |
| .constants.ts{x} | Static objects and constants |
| .store.ts | State store (see STORES.md) |
| .module.css | Co-located CSS Module (see STYLING.md) |
| Context | Convention | Example |
|---------|------------|---------|
| Component folders | camelCase | userCard/ |
| Component files | PascalCase | UserCard.tsx |
| Everything else | camelCase | httpClient.ts |
| Variables/params | Descriptive (no single chars) | event not e |
| Constants | camelCase | maxRetries not MAX_RETRIES |
| State updater args | previous prefix | previousData, previousState |
| Internal handlers | handle prefix | handleSubmit, handleFilterChange |
| Callback props | on prefix | onSubmit, onFilterChange |
All files use named exports only:
export function Component() {}
No default exports. No barrel files in application code.
Exception — Next.js special files: the Next.js app router requires export default for these route-segment files, and only these:
app/**/layout.tsxapp/**/page.tsxapp/**/loading.tsxapp/**/error.tsxapp/**/not-found.tsxapp/**/template.tsxapp/**/default.tsxapp/**/route.tsEverywhere else (components, services, hooks, utils, stores), named exports only.
One component per .tsx file — no exceptions. Every component, no matter how small, gets its own subfolder and file.
Before creating a component, decide where it lives:
components/ui/{componentName}/components/pages/{pageName}/{componentName}/components/shared/{componentName}/Default is page-local first. Promote to shared/ only when a second consumer appears — premature promotion creates components that try to serve everyone and fit no one.
See COMPONENTS.md for the full hierarchy.
components/{ui|shared|pages/{pageName}}/{componentName}/{ComponentName}.tsx with Props type and JSX only{ComponentName}.types.ts (if needed beyond Props){ComponentName}.constants.ts (if any){ComponentName}.utils.ts (if any){ComponentName}.dynamic.tsx if the component is client-only and needs lazy loading (see COMPONENTS.md)components/pages/{pageName}/{PageName}.tsx (the page component itself){PageName}.types.ts and import down — never re-export types from a child .types.ts{PageName}.utils.tscomponents/pages/{pageName}/{childName}/{Child}.tsxapp/ imports and renders the page component (see Exports exception above)services/{provider}/{serviceName}/ when the app talks to multiple backends; use services/{serviceName}/ when there is only one. See SERVICES.md.{serviceName}Service.ts with fetch functions and query hooks. Add 'use client' at the top when the file exports React Query hooks (see SERVICES.md).{serviceName}Service.schemas.ts with Zod schemas{serviceName}Service.constants.ts with query keyshooks/use{HookName}/use{HookName}.tsuse{HookName}.test.tsutils/{utilName}/{utilName}.ts — all helper functions go here (no .utils.ts file){utilName}.constants.ts (if any){utilName}.test.tsNote: Unlike components, utility folders do not use
.utils.tsfiles. The main{utilName}.tsfile itself is the utility — adding a.utils.tsbeside it would be redundant.
development
Maintainer-only workflow for handling GitHub Secret Scanning alerts on OpenClaw. Use when Codex needs to triage, redact, clean up, and resolve secret leakage found in issue comments, issue bodies, PR comments, or other GitHub content.
development
Maintainer workflow for OpenClaw releases, prereleases, changelog release notes, and publish validation. Use when Codex needs to prepare or verify stable or beta release steps, align version naming, assemble release notes, check release auth requirements, or validate publish-time commands and artifacts.
development
Run, watch, debug, and extend OpenClaw QA testing with qa-lab and qa-channel. Use when Codex needs to execute the repo-backed QA suite, inspect live QA artifacts, debug failing scenarios, add new QA scenarios, or explain the OpenClaw QA workflow. Prefer the live OpenAI lane with regular openai/gpt-5.4 in fast mode; do not use gpt-5.4-pro or gpt-5.4-mini unless the user explicitly overrides that policy.
development
End-to-end Parallels smoke, upgrade, and rerun workflow for OpenClaw across macOS, Windows, and Linux guests. Use when Codex needs to run, rerun, debug, or interpret VM-based install, onboarding, gateway smoke tests, latest-release-to-main upgrade checks, fresh snapshot retests, or optional Discord roundtrip verification under Parallels.