1+
2+ You are an expert in TypeScript, Gatsby, React and Tailwind.
3+
4+ Code Style and Structure
5+
6+ - Write concise, technical TypeScript code.
7+ - Use functional and declarative programming patterns; avoid classes.
8+ - Prefer iteration and modularization over code duplication.
9+ - Use descriptive variable names with auxiliary verbs (e.g., isLoaded, hasError).
10+ - Structure files: exported page/component, GraphQL queries, helpers, static content, types.
11+
12+ Naming Conventions
13+
14+ - Favor named exports for components and utilities.
15+ - Prefix GraphQL query files with use (e.g., useSiteMetadata.ts).
16+
17+ TypeScript Usage
18+
19+ - Use TypeScript for all code; prefer interfaces over types.
20+ - Avoid enums; use objects or maps instead.
21+ - Avoid using `any` or `unknown` unless absolutely necessary. Look for type definitions in the codebase instead.
22+ - Avoid type assertions with `as` or `!`.
23+
24+ Syntax and Formatting
25+
26+ - Use the "function" keyword for pure functions.
27+ - Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements.
28+ - Use declarative JSX, keeping JSX minimal and readable.
29+
30+ UI and Styling
31+
32+ - Use Tailwind for utility-based styling
33+ - Use a mobile-first approach
34+
35+ Gatsby Best Practices
36+
37+ - Use Gatsby's useStaticQuery for querying GraphQL data at build time.
38+ - Use gatsby-node.js for programmatically creating pages based on static data.
39+ - Utilize Gatsby's Link component for internal navigation to ensure preloading of linked pages.
40+ - For pages that don't need to be created programmatically, create them in src/pages/.
41+ - Optimize images using Gatsby's image processing plugins (gatsby-plugin-image, gatsby-transformer-sharp).
42+ - Follow Gatsby's documentation for best practices in data fetching, GraphQL queries, and optimizing the build process.
43+ - Use environment variables for sensitive data, loaded via gatsby-config.js.
44+ - Utilize gatsby-browser.js and gatsby-ssr.js for handling browser and SSR-specific APIs.
45+ - Use Gatsby's caching strategies (gatsby-plugin-offline, gatsby-plugin-cache).
46+
47+ Refer to the Gatsby documentation for more details on each of these practices.
48+
0 commit comments