procursorrules.com
RulesGenerateMCP ServersBlog
Sign In

Ready to enhance your cursor experience?

Join our community today and get access to exclusive cursor rules, resources, and connect with other cursor enthusiasts.

Get StartedLearn More
procursorrules.com

The home for Cursor enthusiasts where you can explore and generate rules, browse MCPs, post and follow the latest news, learn, connect, and discover jobs.

GitHubTwitter

Products

  • Cursor Rules
  • MCP Directory
  • Rule Generator

Resources

  • Cursor Documentation
  • Blog
  • Support

Frendlink

  • FluxKontext.biz
  • BG Remove Pro
  • Labubu Style Generator
  • LaunchVault
  • OG Generator
  • Just Simple Tools

Stay Updated

Subscribe to our newsletter to get the latest updates on cursor rules, tutorials, and community news.

By subscribing, you agree to our Terms and Privacy Policy.

  • Featured on findly.tools
  • Startup Benchmarks
  • Acid Tools
  • AIGC 160
  • AI Toolz
  • z-image.win
  • Launch Vault
  • Hunt for Tools
  • SaaS Field
  • SaaS Hub Directory
  • SaaS Roots
© 2026 Pro Cursor Rules. All rights reserved.
Terms of Service
Privacy Policy
About Us
Made withbySkyler Scofield
gatsby-development-best-practices | Cursor Rules | Pro Cursor Rules
Back to rules
Typescript

gatsby-development-best-practices

Rule Markdown


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 `any` or `unknown` unless absolutely necessary. Look for type definitions in the codebase instead.
- Avoid type assertions with `as` or `!`.

Syntax and Formatting

- Use the "function" keyword for pure functions.
- Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements.
- Use declarative JSX, keeping JSX minimal and readable.

UI and Styling

- Use Tailwind for utility-based styling
- Use a mobile-first approach

Gatsby Best Practices

- Use Gatsby's useStaticQuery for querying GraphQL data at build time.
- Use gatsby-node.js for programmatically creating pages based on static data.
- Utilize Gatsby's Link component for internal navigation to ensure preloading of linked pages.
- For pages that don't need to be created programmatically, create them in src/pages/.
- Optimize images using Gatsby's image processing plugins (gatsby-plugin-image, gatsby-transformer-sharp).
- Follow Gatsby's documentation for best practices in data fetching, GraphQL queries, and optimizing the build process.
- Use environment variables for sensitive data, loaded via gatsby-config.js.
- Utilize gatsby-browser.js and gatsby-ssr.js for handling browser and SSR-specific APIs.
- Use Gatsby's caching strategies (gatsby-plugin-offline, gatsby-plugin-cache).

Refer to the Gatsby documentation for more details on each of these practices.
    

Details

Author@Nathan Brachotte
CategoryTypescript
Downloads0
Stars0
SponsorsLaunch Vault
Launch VaultDiscover the best new startups
z-image.win
z-image.winFast & Free AI Image Generator