Skip to content

feat: Add comprehensive Cursor rules for Medusa development#66

Merged
jaruesink merged 3 commits intomainfrom
codegen/lc-239-create-comprehensive-cursor-rules-for-medusa-development
May 29, 2025
Merged

feat: Add comprehensive Cursor rules for Medusa development#66
jaruesink merged 3 commits intomainfrom
codegen/lc-239-create-comprehensive-cursor-rules-for-medusa-development

Conversation

@codegen-sh
Copy link
Copy Markdown
Contributor

@codegen-sh codegen-sh Bot commented May 29, 2025

🎯 Overview

This PR implements comprehensive Cursor rules for the Medusa2 starter project to improve developer experience and AI-assisted development. The rules provide contextually aware suggestions when working with Cursor AI on Medusa projects.

📁 What's Added

Core Rule Files

  • .cursor/rules/medusa-development.mdc - Medusa v2 backend development patterns
  • .cursor/rules/remix-storefront.mdc - React Router v7 storefront development
  • .cursor/rules/typescript-patterns.mdc - Advanced TypeScript patterns
  • .cursor/rules/testing-patterns.mdc - Comprehensive testing strategies
  • .cursor/README.md - Complete documentation and usage guide

🚀 Key Features

Medusa v2 Backend Development

  • Module and service architecture patterns
  • API route development (admin/store)
  • Database models and repository patterns
  • Workflow and subscriber implementations
  • Security and validation best practices
  • Performance optimization techniques

React Router v7 Storefront

  • Component architecture and patterns
  • Medusa SDK integration
  • Form handling with @lambdacurry/forms
  • Tailwind CSS styling patterns
  • SEO optimization and meta tags
  • Performance and accessibility

TypeScript Excellence

  • Advanced type patterns and utility types
  • Error handling with Result patterns
  • Async programming patterns
  • Functional programming concepts
  • Type-safe testing patterns

Testing Strategies

  • Unit testing for services and components
  • Integration testing for APIs
  • End-to-end testing with Playwright
  • Test utilities and factories
  • Mocking strategies

🎨 Integration

File Pattern Targeting

  • apps/medusa/**/*.ts → Medusa development rules
  • apps/storefront/**/*.ts → Remix storefront rules
  • **/*.test.ts → Testing pattern rules
  • All TypeScript files → TypeScript pattern rules

Automatic Activation

  • Rules are automatically loaded by Cursor
  • Context-aware suggestions based on file location
  • No additional configuration required

📚 Documentation

The .cursor/README.md provides:

  • Comprehensive usage guide
  • Code examples and patterns
  • Best practices enforcement
  • Customization instructions
  • Integration with development workflow

✅ Benefits

  • Faster Development - AI suggestions follow established patterns
  • Consistency - Enforces project conventions across the team
  • Learning - Helps developers learn Medusa v2 and React Router v7 patterns
  • Quality - Promotes best practices for security, performance, and maintainability
  • Documentation - Serves as living documentation of project patterns

🔧 Usage

Once merged, developers using Cursor will automatically receive:

  • Contextual code suggestions based on file type
  • Best practice recommendations
  • Pattern-based completions
  • Error prevention guidance

📖 Related

  • Addresses requirements from Linear issue LC-239
  • Builds upon existing .cursor/rules/remix-hook-form-migration.mdc
  • Integrates with project's TypeScript and Biome configuration
  • Complements existing development workflow

This implementation provides a comprehensive foundation for AI-assisted Medusa development, helping developers build better applications faster while maintaining code quality and consistency.


💻 View my workAbout Codegen

- Add medusa-development.mdc with Medusa v2 patterns and best practices
- Add remix-storefront.mdc for React Router v7 storefront development
- Add typescript-patterns.mdc with advanced TypeScript patterns
- Add testing-patterns.mdc for comprehensive testing strategies
- Add comprehensive README.md documentation
- Covers API development, modules, services, components, and testing
- Includes TypeScript conventions, error handling, and performance optimization
- Provides contextual guidance for AI-assisted development
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 29, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Join our Discord community for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@jaruesink jaruesink self-requested a review May 29, 2025 03:57
- Split testing-patterns.mdc (682 lines) into:
  - testing-patterns-unit.mdc (240 lines)
  - testing-patterns-integration.mdc (184 lines)
  - testing-patterns-e2e.mdc (31 lines)

- Split remix-storefront.mdc (562 lines) into:
  - remix-storefront-routing.mdc (205 lines)
  - remix-storefront-components.mdc (147 lines)
  - remix-storefront-optimization.mdc (257 lines)

- Updated .cursor/README.md to reflect new file structure
- Improved file organization and maintainability
- Enhanced context-aware targeting with specific globs
- Reduced cognitive load for developers working with specific patterns

This optimization follows Cursor best practices for file size management
while maintaining comprehensive coverage and improving navigation.
…rules-file-sizes

feat: Optimize cursor rules file sizes by splitting large files
@jaruesink jaruesink marked this pull request as ready for review May 29, 2025 14:54
@jaruesink jaruesink merged commit 333ce96 into main May 29, 2025
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant