Awesome Cursor Rules Collection

Showing 385-396 of 2626 matches

Java
您是 Java 编程、Spring Boot、Spring Framework、Maven、JUnit 和相关 Java 技术的专家,特别专注于API安全、加密解密和网关技术。

代码风格和结构
- 编写简洁、高效且文档完善的 Java 代码,提供准确的 Spring Boot 示例。
- 在代码中遵循 Spring Boot 最佳实践和约定。
- 创建 Web 服务时实现 RESTful API 设计模式,确保接口的安全性和可维护性。
- 使用符合驼峰命名法的描述性方法和变量名。
- 结构化项目模块:
  * core模块:核心加密解密逻辑
  * spring-boot-starter:Spring Boot集成模块
  * spring-cloud-gateway-starter:网关集成模块
  * example:示例代码模块

Spring Boot 具体要求
- 使用 Spring Boot starters 快速设置项目和管理依赖。
- 正确使用注解(如 @SpringBootApplication、@RestController、@Service)。
- 有效利用 Spring Boot 的自动配置功能,特别是在starter模块中。
- 使用 @ControllerAdvice 和 @ExceptionHandler 实现统一的加密解密异常处理。

Spring Cloud 网关要求
- 基于 Spring Cloud Gateway 实现网关层的加密解密。
- 使用 Spring Cloud Gateway Filter 实现请求和响应的加解密处理。
- 实现网关层的统一异常处理和响应包装。
- 支持网关路由的动态配置。
- 实现网关层的限流、熔断和降级策略。
- 提供网关监控和链路追踪支持。

Spring Cloud 微服务集成
- 支持注册中心(如Nacos、Eureka)的服务注册与发现。
- 实现配置中心的动态配置管理。
- 支持Spring Cloud LoadBalancer的负载均衡。
- 集成Spring Cloud Circuit Breaker实现服务熔断。
- 提供分布式链路追踪支持(如Sleuth + Zipkin)。
- 实现微服务间的安全通信机制。

命名规范
- 类名使用帕斯卡命名法(如 ApiEncryptFilter、SignatureVerifier)。
- 方法和变量名使用驼峰命名法(如 encryptData、verifySignature)。
- 常量使用大写字母(如 ENCRYPTION_KEY、SIGNATURE_HEADER)。

安全性和加密
- 实现对称加密和非对称加密支持。
- 实现请求签名验证机制。
- 实现时间戳防重放攻击。
- 支持接口白名单和黑名单配置。
- 确保密钥的安全存储和传输。
- 支持分布式环境下的密钥管理。
- 实现微服务间的加密通信。

配置和属性
- 使用 application.properties 或 application.yml 进行加密配置。
- 使用 Spring Profiles 实现不同环境的加密策略。
- 使用 @ConfigurationProperties 实现加密配置的类型安全。
- 支持配置中心的动态配置管理。

依赖注入和 IoC
- 使用构造函数注入而不是字段注入以提高可测试性。
- 利用 Spring 的 IoC 容器管理加密组件的生命周期。

测试
- 使用 JUnit 5 编写完整的加密解密单元测试。
- 使用 MockMvc 测试加密接口。
- 编写集成测试验证完整的加密解密流程。
- 测试各种异常情况的处理。
- 编写网关过滤器的单元测试。
- 实现端到端的集成测试。

性能和可扩展性
- 优化加密解密性能。
- 实现加密算法的可插拔设计。
- 支持自定义加密策略扩展。
- 确保加密不影响系统响应时间。
- 实现网关层的性能优化。
- 支持水平扩展部署。

日志和监控
- 记录关键的加密解密操作日志。
- 实现加密失败的告警机制。
- 使用 Spring Boot Actuator 监控加密服务的健康状态。
- 集成 Spring Cloud Sleuth 实现分布式链路追踪。
- 提供网关层的监控指标。
- 实现日志的统一收集和分析。

API 文档
- 使用 Springdoc OpenAPI 详细说明加密接口的使用方式。
- 提供完整的加密参数说明和示例。
- 维护网关路由配置文档。
- 提供微服务接口文档。

构建和部署
- 使用 Maven 管理多模块项目。
- 提供详细的部署文档。
- 支持Docker容器化部署。
- 提供Kubernetes部署配置。
- 实现CI/CD流水线配置。

最佳实践:
- 遵循密码学最佳实践。
- 实现优雅的降级策略。
- 提供完整的异常处理机制。
- 支持灵活的配置项。
- 实现网关的高可用部署。
- 提供完整的监控告警方案。

遵守 SOLID 原则,保持代码的可维护性和可扩展性,特别是在设计加密解密策略时。
    
docker
java
kubernetes
rest-api
solidjs
spring
jasonkung22/futu-api-encrypt

Used in 1 repository

TypeScript
You are an expert in TypeScript, Node.js, Next.js App Router, React, Zustand, React Query, Drizzle, Shadcn UI, Radix UI and Tailwind.

- Follow the user’s requirements carefully & to the letter.
- First think step-by-step - describe your plan for what to build in pseudocode, written out in great detail.
- Confirm, then write code!
- Always write correct, up to date, bug free, fully functional and working, secure, performant and efficient code.
- Focus on readability over being performant.
- Fully implement all requested functionality.
- Leave NO todo’s, placeholders or missing pieces.
- Ensure code is complete! Verify thoroughly finalized.
- Include all required imports, and ensure proper naming of key components.
- Be concise. Minimize any other prose.
- If you think there might not be a correct answer, you say so. If you do not know the answer, say so instead of guessing.
- If a dependency needs to be installed, show the CLI call that needs to be run

Code Style and Structure

- Write concise, technical TypeScript code with accurate examples.
- Use functional and declarative programming patterns; avoid classes.
- Prefer iteration and modularization over code duplication.
- Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError).
- Structure files: exported component, subcomponents, helpers, static content, types.

Naming Conventions

- Use lowercase with dashes for directories (e.g., components/auth-wizard).
- Favor named exports for components.
- Use camelcase for variables and functions.
- Use PascalCase for constructors and React components.

TypeScript Usage

- Use TypeScript for all code; prefer interfaces over types.
- Avoid enums; use maps instead.
- Use functional components with TypeScript interfaces.
- Always use === instead of ==.

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.

React/Next.js Best Practices

- Use functional components and TypeScript interfaces.
- Use declarative JSX.
- Use function, not const, for components.
- Use Shadcn UI, Radix, and Tailwind for components and styling.
- Implement responsive design with Tailwind CSS; use a mobile-first approach.
- Minimize 'use client', 'useEffect', and 'setState'; favor React Server Components (RSC).
- Wrap client components in Suspense with fallback.
- Use dynamic loading for non-critical components.
- Optimize images: use WebP format, include size data, implement lazy loading.
- Use Zod for form validation.
- Use useActionState with react-hook-form for form validation.
- Create custom hooks to extract reusable component logic.
- Use `dangerouslySetInnerHTML` sparingly and only with sanitized content.
- Avoid inline function definitions in render to prevent unnecessary re-renders.
- Use cleanup functions in useEffect to prevent memory leaks.
- Follow the Rules of Hooks (only call hooks at the top level, only call hooks from React functions).
- Implement hooks correctly (useState, useEffect, useContext, useReducer, useMemo, useCallback).

State Management

- Use Zustand for global state management.
- Lift state up when needed to share state between components.
- Use context for intermediate state sharing when prop drilling becomes cumbersome.

Error Handling and Validation

- Prioritize error handling and edge cases.
- Handle errors and edge cases at the beginning of functions.
- Use early returns for error conditions to avoid deeply nested if statements.
- Place the happy path last in the function for improved readability.
- Avoid unnecessary else statements; use if-return pattern instead.
- Use guard clauses to handle preconditions and invalid states early.
- Implement proper error logging and user-friendly error messages.
- Model expected errors as return values in Server Actions.
- Consider using custom error types or error factories for consistent error handling.
- Implement error boundaries to catch and handle errors gracefully.

Accessibility (a11y)

- Use semantic HTML elements.
- Implement proper ARIA attributes.
- Ensure keyboard navigation support.

Testing

- Write unit tests for components using Jest and React Testing Library.
- Implement integration tests for critical user flows.
- Use snapshot testing judiciously.

Key Conventions

- Use 'nuqs' for URL search parameter state management.
- Optimize Web Vitals (LCP, CLS, FID).
- Limit 'use client':
  - Favor server components and Next.js SSR.
  - Use only for Web API access in small components.
  - Avoid for data fetching or state management.

Follow Next.js docs for Data Fetching, Rendering, and Routing.
css
drizzle-orm
javascript
jest
nestjs
next.js
radix-ui
react
+4 more

First seen in:

elliot/bolt-starter

Used in 1 repository

JavaScript
```yaml
# Cursor Assistant Rules
# These rules guide the AI assistant's behavior across the project

## Testing
- Write tests for ALL new code
- Follow test-driven development (TDD)
- Maintain minimum coverage:
  - 80% branches
  - 80% functions
  - 80% lines
  - 80% statements
- Test categories required:
  - Unit tests
  - Integration tests (where applicable)
  - Edge cases
  - Error handling
- Test documentation:
  - Clear test descriptions
  - Test coverage explanation
  - Edge case documentation
- Test patterns:
  - Arrange-Act-Assert
  - Given-When-Then
  - Mock external dependencies
  - Isolate test concerns

## CI/CD
- Check CI status after pushes using gh commands
- Wait for checks before suggesting merges
- Help diagnose failed checks
- Use GitHub CLI (gh) for all GitHub operations
- Don't rely on environment variables in commands
- Remember command sandboxing limitations
- Verify all required checks pass:
  - Tests
  - Linting
  - Build
  - Plugin validation

## Documentation
- Follow guides in docs/guides/ for all tasks
- Documentation serves both humans and AI - keep it dual-purpose
- Use AI markers (@ai-task, @context) in documentation
- Add YAML frontmatter with AI context
- Keep examples practical and executable
- Include test examples in documentation

## Code Style
- Follow Prettier configuration for all code formatting
- Use ESLint rules as defined in .eslintrc
- Prefer TypeScript over JavaScript
- Use explicit types, avoid 'any'
- Follow functional programming principles where possible

## Git Practices
- Write conventional commits (feat:, fix:, docs:, etc.)
- Keep commits atomic and focused
- Reference issues in commits where applicable
- Include tests in feature branches
- Check CI status before suggesting merges

## Project Structure
- Place all utilities in utilities/
- Follow plugin architecture for new features
- Keep core functionality minimal
- Use TypeScript for all new code
- Maintain test directory structure

## Testing
- Write tests for all new features
- Maintain test coverage above 80%
- Follow TDD where applicable
- Use Jest for testing
- Test both success and failure paths
- Mock external dependencies
- Test edge cases
- Document test patterns

## Dependencies
- Minimize external dependencies
- Pin dependency versions
- Document all new dependencies
- Prefer well-maintained, typed packages
- Include test dependencies

## Security
- Never commit secrets or credentials
- Follow security guidelines in SECURITY.md
- Use environment variables for configuration
- Validate all inputs
- Test security measures

## Performance
- Consider performance implications of changes
- Optimize for both speed and memory
- Use lazy loading where appropriate
- Profile significant changes
- Test performance critical paths

## Error Handling
- Use typed errors
- Provide meaningful error messages
- Log errors appropriately
- Handle edge cases explicitly
- Test error conditions

## Accessibility
- Follow WCAG 2.1 guidelines
- Test with screen readers
- Provide keyboard navigation
- Use semantic HTML
- Test accessibility features

## AI Integration
- Use documentation as primary instruction source
- Follow guide-specific instructions from docs/guides/
- Respect AI markers in documentation
- Consider both human and AI readers in documentation
- Include test requirements in AI context
- Use gh commands for GitHub operations
- Remember command sandbox limitations

## git
- use `.commit-message.txt` to create multi-line commit messages
``` 
css
eslint
golang
html
java
javascript
jest
powershell
+3 more

First seen in:

asbjborg/tallimantra

Used in 1 repository

unknown
// Basic CursorRules Template
// Description: A template for creating new .cursorrules files

// Section 1: Overview
- Purpose:
  * Define the purpose of these rules
  * Specify the target audience
  * List key objectives
  * Define scope
  * Note any prerequisites

// Section 2: Standards
- Naming Conventions:
  * Define naming patterns
  * List exceptions
  * Provide examples
  * Note restrictions
  * Define abbreviations

// Section 3: Structure
- Organization:
  * Define file structure
  * Specify grouping rules
  * List required files
  * Define relationships
  * Note dependencies

// Section 4: Patterns
- Implementation:
  * Define common patterns
  * List anti-patterns
  * Provide examples
  * Note edge cases
  * Define best practices

// Section 5: Quality
- Requirements:
  * Define quality metrics
  * List required tests
  * Specify coverage
  * Define review process
  * Note acceptance criteria

// Section 6: Documentation
- Guidelines:
  * Define doc requirements
  * Specify formats
  * List required sections
  * Define examples
  * Note maintenance

// Section 7: Process
- Workflow:
  * Define development flow
  * List review steps
  * Specify deployment
  * Define monitoring
  * Note maintenance

// Section 8: Examples
// Example 1: Basic Implementation
implementation Example {
  // Structure
  - Follow defined patterns
  - Use proper naming
  - Include documentation
  
  // Quality
  - Include tests
  - Meet coverage
  - Pass review
}

// Example 2: Advanced Pattern
advancedPattern Example {
  // Implementation
  - Handle edge cases
  - Include error handling
  - Optimize performance
  
  // Documentation
  - Include examples
  - Note limitations
  - Define use cases
}

// Section 9: References
- Resources:
  * Link to standards
  * Reference docs
  * Related guides
  * Tools documentation
  * Community resources

// Section 10: Maintenance
- Updates:
  * Version control
  * Change process
  * Review cycle
  * Deprecation
  * Migration guides 
rest-api
TMHSDigital/CursorRulesFiles

Used in 1 repository

TypeScript
{
  "project": {
    "language": "typescript",
    "framework": "nextjs app router",
    "rules": [
      {
        "description": "Ensure TypeScript is used without 'any' type.",
        "codeQuality": "enforce_strict_typing"
      },
      {
        "description": "Implement authentication and authorization using Clerk with RBAC.",
        "authentication": {
          "provider": "clerk",
          "roles": {
            "admin": "access_all_features_manage_tenants_detailers_clients_assessments",
            "detailer": "read_services_pricing_assessments_manage_appointments_clients_take_payments",
            "client": "access_assessments_schedule_appointments_communicate_provide_payments"
          }
        }
      },
      {
        "description": "Style the application using Tailwind CSS with utility-first approach.",
        "styling": "tailwind_usage"
      },
      {
        "description": "Use ShadCN-UI for reusable UI components.",
        "ui": "shadcn_ui_components"
      },
      {
        "description": "Incorporate ShadCN-Graphs for visual graph representation.",
        "visualization": "shadcn_graphs"
      },
      {
        "description": "Integrate Ollama for deep learning models.",
        "ai": "ollama_integration"
      },
      {
        "description": "Use Convex for database, file storage, and AI vector search functionalities.",
        "database": "convex_database"
      },
      {
        "description": "Host the application on Vercel for scalability and sub-domain management.",
        "hosting": "vercel_hosting"
      },
      {
        "description": "Integrate Google Calendar for AI-powered appointment scheduling.",
        "calendar_integration": "google_calendar_ai"
      },
      {
        "description": "Utilize Google Chat for real-time customer support.",
        "communication": "google_chat_integration"
      },
      {
        "description": "Use Stripe for processing payments in the application.",
        "payment": "stripe_integration"
      },
      {
        "description": "Support self-marketing with tenant-specific QR codes.",
        "marketing": "self_marketing_qr_code"
      },
      {
        "description": "Enable client self-assessment for vehicle information capture.",
        "feature": "client_self_assessment"
      },
      {
        "description": "Ensure the application is invite-only for client entry.",
        "security": "invite_only_app"
      },
      {
        "description": "Generate estimates based on client assessment and detailer's pricing models.",
        "feature": "estimate_generation"
      },
      {
        "description": "Implement robust RBAC with Clerk for resource authorization based on role.",
        "security": "role_based_access_control"
      },
      {
        "description": "Employ a multi-tenant database architecture using MongoDB.",
        "architecture": "mongo_db_multi_tenant"
      },
      {
        "description": "Support dynamic pricing models for various detailers.",
        "feature": "dynamic_pricing_models"
      },
      {
        "description": "Provide an analytics dashboard for business insights.",
        "analytics": "dashboard"
      },
      {
        "description": "Allow customizable theming for client personalization.",
        "ui": "customizable_theming"
      },
      {
        "description": "Optimize developer experience with ESLint, Prettier, and EditorConfig.",
        "codeQuality": "optimized_developer_experience"
      },
      {
        "description": "Manage subscription cancellations and updates efficiently.",
        "feature": "subscription_management"
      },
      {
        "description": "Provide a dedicated dashboard for detailers to manage services and bookings.",
        "feature": "detailer_dashboard"
      },
      {
        "description": "Implement a rating and review system for client feedback on detailers.",
        "feature": "rating_review_system"
      },
      {
        "description": "Send automated reminders for upcoming appointments to users.",
        "feature": "automated_reminders"
      },
      {
        "description": "Implement a notification system for updates on bookings and services.",
        "feature": "notification_system"
      },
      {
        "description": "Include a comprehensive knowledge base for user guides and tutorials.",
        "feature": "knowledge_base"
      },
      {
        "description": "Implement client self-assessment enhancements with image/video upload functionality.",
        "feature": "image_video_upload"
      },
      {
        "description": "Develop a feedback mechanism to gather user input for continuous improvement.",
        "feature": "feedback_mechanism"
      },
      {
        "description": "Design a scalable system capable of handling a minimum of 10,000 concurrent users.",
        "scalability": "high_concurrency_support"
      }
      {
        "description": "Incorporate ShadCN-Graphs for visual graph representation.",
        "visualization": "shadcn_graphs"
      },
      {
        "description": "Integrate Ollma for deep learning models.",
        "ai": "ollma_integration"
      },
      {
        "description": "Use Convex for database, file storage, and AI vector search functionalities.",
        "database": "convex_database"
      },
      {
        "description": "Host the application on Vercel for scalability and sub-domain management.",
        "hosting": "vercel_hosting"
      },
      {
        "description": "Integrate Google Calendar for AI-powered appointment scheduling.",
        "calendar_integration": "google_calendar_ai"
      },
      {
        "description": "Utilize Google Chat for real-time customer support.",
        "communication": "google_chat_integration"
      },
      {
        "description": "Use Stripe for processing payments in the application.",
        "payment": "stripe_integration"
      },
      {
        "description": "Support self-marketing with tenant-specific QR codes.",
        "marketing": "self_marketing_qr_code"
      },
      {
        "description": "Enable client self-assessment for vehicle information capture.",
        "feature": "client_self_assessment"
      },
      {
        "description": "Ensure the application is invite-only for client entry.",
        "security": "invite_only_app"
      },
      {
        "description": "Generate estimates based on client assessment and detailer's pricing models.",
        "feature": "estimate_generation"
      },
      {
        "description": "Implement robust RBAC with Clerk for resource authorization based on role.",
        "security": "role_based_access_control"
      },
      {
        "description": "Employ a multi-tenant database architecture using MongoDB.",
        "architecture": "mongo_db_multi_tenant"
      },
      {
        "description": "Support dynamic pricing models for various detailers.",
        "feature": "dynamic_pricing_models"
      },
      {
        "description": "Provide an analytics dashboard for business insights.",
        "analytics": "dashboard"
      },
      {
        "description": "Allow customizable theming for client personalization.",
        "ui": "customizable_theming"
      },
      {
        "description": "Optimize developer experience with ESLint, Prettier, and EditorConfig.",
        "codeQuality": "optimized_developer_experience"
      },
      {
        "description": "Manage subscription cancellations and updates efficiently.",
        "feature": "subscription_management"
      },
      {
        "description": "Provide a dedicated dashboard for detailers to manage services and bookings.",
        "feature": "detailer_dashboard"
      },
      {
        "description": "Implement a rating and review system for client feedback on detailers.",
        "feature": "rating_review_system"
      },
      {
        "description": "Send automated reminders for upcoming appointments to users.",
        "feature": "automated_reminders"
      },
      {
        "description": "Implement a notification system for updates on bookings and services.",
        "feature": "notification_system"
      },
      {
        "description": "Include a comprehensive knowledge base for user guides and tutorials.",
        "feature": "knowledge_base"
      };
    ]
  }
}
analytics
clerk
css
eslint
golang
javascript
mongodb
next.js
+7 more
Holding-1-at-a-time/slick-solutions-mvp

Used in 1 repository

TypeScript
Start all chats with 🤖

## Stack
- NextJS
- Vercel AI SDK
- Deepgram
- Shadcn
- Tailwind CSS
css
javascript
next.js
shadcn/ui
tailwindcss
typescript
vercel

First seen in:

Aaryan6/preptaai

Used in 1 repository