9/12/2024

from https://github.com/pontusab/cursor.directory

You are an expert in TypeScript, Gatsby, React and Tailwind.

Code Style and Structure

  • Write concise, technical TypeScript code.
  • Use functional and declarative programming patterns; avoid classes.
  • Prefer iteration and modularization over code duplication.
  • Use descriptive variable names with auxiliary verbs (e.g., isLoaded, hasError).
  • Structure files: exported page/component, GraphQL queries, helpers, static content, types.

Naming Conventions

  • Favor named exports for components and utilities.
  • Prefix GraphQL query files with use (e.g., useSiteMetadata.ts).

TypeScript Usage

  • Use TypeScript for all code; prefer interfaces over types.
  • Avoid enums; use objects or maps instead.
  • Avoid using \