Skip to content

greenprojecttechnologies/cursor-setup-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Cursor Setup Example

Note: This README was generated by AI to provide an overview of the Cursor rules and commands in this repository.

This repository contains examples of Cursor rules and commands actively used by the Green Project product team. These examples demonstrate best practices for creating AI-optimized development workflows using Cursor's rule system.

Overview

Cursor rules and commands enable teams to codify their development standards, coding patterns, and workflows in a way that AI assistants can understand and apply consistently. This collection showcases real-world implementations that have proven effective in production environments.

Repository Structure

.cursor/
├── rules/                    # Cursor rules for automated guidance
│   ├── cursor-rule-format.mdc
│   ├── react-general-rules.mdc
│   ├── typescript-rules.mdc
│   └── use-cursor-rules-not-memories.mdc
└── commands/                 # Cursor commands for complex workflows
    ├── create-component.md
    └── pre-pr-checks.md

Rules

Core Rules

cursor-rule-format.mdc

Purpose: Establishes standards for creating consistent, AI-optimized rule documentation.

Key Features:

  • Defines the 4 types of Cursor rules (Always, File-Specific, Agent Requested, Manual)
  • Provides templates and examples for proper rule structure
  • Optimizes for AI context efficiency with token-conscious formatting
  • Includes comprehensive glob pattern examples

When Applied: Used when creating or modifying other Cursor rules to ensure consistency.

use-cursor-rules-not-memories.mdc

Purpose: Enforces the principle of using Cursor rules instead of AI memories for persistent guidance.

Key Features:

  • Always applied (alwaysApply: true) to ensure consistent behavior
  • Prevents creation of AI memories in favor of discoverable, maintainable rules
  • Establishes clear guidelines for when to use rules vs. TODO functionality
  • Promotes team-wide visibility of coding standards

When Applied: Always active to guide AI behavior throughout all sessions.

Language-Specific Rules

typescript-rules.mdc

Purpose: Enforces TypeScript coding standards for maintainable, consistent code.

Key Features:

  • Eliminates repetitive patterns through configuration-driven approaches
  • Prefers named exports over default exports for better IDE support
  • Promotes direct imports over barrel files to improve tree-shaking
  • Establishes one-way import flow for types to prevent circular dependencies
  • Includes refactoring best practices and testing guidelines

When Applied: Automatically applied to all .ts and .tsx files.

react-general-rules.mdc

Purpose: Maintains clean React architecture and separation of concerns.

Key Features:

  • Guidelines for when to extract vs. inline components
  • Complex prop logic extraction patterns
  • Pre-computation of data before JSX rendering
  • Auto-animate integration best practices
  • Semantic HTML usage standards

When Applied: Automatically applied to all .tsx files.

Commands

create-component.md

Purpose: Streamlines creation of new React components in the design system with proper structure and tooling integration.

Key Features:

  • Generates complete component structure with TypeScript, SCSS, Storybook, and tests
  • Integrates with Figma MCP for design-driven development
  • Enforces design system standards and naming conventions
  • Includes comprehensive Storybook documentation requirements
  • Handles proper export patterns and dependency management

Usage: @create-component ComponentName [category] [figmaUrl]

Benefits:

  • Reduces component creation time from 30+ minutes to 2-3 minutes
  • Ensures consistency across all design system components
  • Eliminates boilerplate setup errors
  • Integrates design specifications directly into implementation

pre-pr-checks.md

Purpose: Executes systematic code review process before pull request creation to ensure production readiness.

Key Features:

  • Batched rule loading strategy for optimal context management
  • Domain-specific rule application (Frontend, Backend, Testing, etc.)
  • Automated compliance checking and fixing
  • Branch size analysis with splitting recommendations
  • Cross-batch consistency validation

Usage: Run before creating any pull request to validate code against all applicable rules.

Benefits:

  • Reduces PR review cycles by catching issues early
  • Ensures consistent application of all coding standards
  • Provides actionable feedback for manual improvements
  • Optimizes AI context usage with 60-70% reduction vs. loading all rules simultaneously

Rule Types Explained

Always Rules (alwaysApply: true)

These rules are always loaded in the AI's context and apply to all interactions:

  • use-cursor-rules-not-memories.mdc - Ensures consistent behavior patterns

File-Specific Rules (globs defined)

These rules are automatically applied when working with matching file types:

  • typescript-rules.mdc - Applied to .ts and .tsx files
  • react-general-rules.mdc - Applied to .tsx files

Agent Requested Rules

These rules are available for the AI to request when relevant:

  • cursor-rule-format.mdc - Loaded when creating or modifying rules

Benefits of This Approach

For Development Teams

  • Consistency: All team members follow the same standards automatically
  • Onboarding: New developers learn patterns through AI guidance
  • Knowledge Retention: Standards persist beyond individual team members
  • Discoverability: Rules are visible and searchable in the codebase

For AI Assistance

  • Context Efficiency: Rules are loaded only when relevant
  • Deterministic Behavior: Clear, actionable instructions reduce ambiguity
  • Scalability: New rules can be added without affecting existing workflows
  • Maintainability: Rules can be updated centrally and apply immediately

For Code Quality

  • Automated Enforcement: Standards are applied consistently without manual oversight
  • Reduced Review Time: Common issues are caught and fixed automatically
  • Pattern Consistency: Similar problems are solved in similar ways across the codebase
  • Documentation: Rules serve as living documentation of team decisions

Learning More

For comprehensive documentation on Cursor's rule and command systems:

Getting Started

  1. Copy relevant rules to your project's .cursor/rules/ directory
  2. Adapt glob patterns to match your project structure
  3. Customize standards to reflect your team's preferences
  4. Test with AI assistant to ensure rules are applied correctly
  5. Iterate and refine based on team feedback

Best Practices

  • Start small: Begin with 2-3 core rules and expand gradually
  • Be specific: Provide concrete examples and counter-examples
  • Optimize for AI: Use clear, deterministic language in rule descriptions
  • Regular review: Update rules as team practices evolve
  • Team alignment: Ensure all team members understand and agree with the rules

License

This project is licensed under the MIT License - see the LICENSE file for details.


Green Project - Demonstrating practical AI-assisted development workflows through real-world examples.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors