Awesome Cursor Rules Collection

Showing 901-912 of 2626 matches

HTML
# Development Rules & Workflow

## General Rules

### Communication Style

- Be casual but professional
- Be terse and direct - no high-level platitudes
- Give answers immediately, explain afterward if needed
- Split into multiple responses if needed
- Value good arguments over authorities
- Consider new/contrarian ideas, not just conventional wisdom
- Flag speculative suggestions clearly
- No moral lectures
- Discuss safety only when crucial and non-obvious
- Cite sources at the end, not inline

### Code Changes

- Always read files before modifying
- Work iteratively with frequent commits
- Document changes with clear commit messages
- Clean up after refactors to avoid stale files
- Keep code adjustments brief - show only relevant lines
- Respect existing prettier/lint preferences
- Check if files exist before creating new ones
- Add debug logging when code doesn't work as expected
  - Debug mode is controlled by SYNC_DEBUG in .env
  - Use print statements liberally when SYNC_DEBUG=true
- Read git commits to understand code history

### Multi-line Content

- When using commit_message.txt for multi-line content:
  1. ALWAYS clean the file first:

     ```bash
     echo "" > commit_message.txt  # Clear the file
     ```

  2. Write new content to the file
  3. Use the file for commands:

     ```bash
     gh issue edit 6 -F commit_message.txt
     gh issue comment 6 -F commit_message.txt
     git commit -F commit_message.txt
     ```

  4. Verify the file content before using

- Common uses:
  - Commit messages
  - Issue bodies
  - Issue comments
  - PR descriptions
  - Long documentation

### Environment

- Assume MacOS environment
- Never assume fresh environment
- Check existing state before changes
- Use pd.concat instead of pd.append in pandas
- Always check .env values before making changes
- Respect file paths from .env, never hardcode paths

## Feature Development

### Feature Tracking

1. Feature Status
   - Track features in `docs/strategy/implementation/checklist.json`
   - Keep checklist.json updated with actual values
      - keep the checklist updated, so read it and check the status of the tasks frequently!

### Prerequisites

1. Feature Creation
   - Create GitHub issue for the feature
   - Note the issue number (e.g., #6)
   - Add appropriate labels and milestone
   - create checklist.json based on requirements in the issue

2. Branch Setup
   - Create feature branch: `feature/name-v2`
   - Create draft blog post in _drafts/

### Order of Operations

1. Code Development
   - Write/update code in appropriate module
   - Follow modular structure, make it as atomic as possible
   - Add comments and docstrings or inline comments
   - add lots of debugging and print statements and check the output
      - can be toggled with parameter when running the script

2. Blog Post Update
   - Update draft post with new features
   - Add code examples if relevant
   - Keep tone casual but informative
   - Add technical details after the friendly intro
   - be witty and add dad jokes
   - write in first person as a 35 year old man living in Denmark who works in tech

3. Feature Tracking
   - Update checklist.json with progress
   - Mark features as complete when done
   - Add new features if discovered

4. Code Commits
   - Commit code changes often to track history
   - Commit blog post updates
   - Use descriptive commit messages
      - you cannot write multi-line commit messages in the terminal (it's a limitation of your tool in cursor), instead use the `commit_message.txt` file to write a multi-line commit message and then use that text file as the commit message
   - Push to feature branch when the user has reviewed the changes and approved the push

### Templates

#### feature.md Template

```markdown
# Feature Name

Brief description of the feature.

## Tasks
1. Core Development
   - [ ] Task 1
   - [ ] Task 2

2. Documentation
   - [ ] Update technical docs
   - [ ] Write blog post
   - [ ] Add user guide

## Success Criteria
- Criterion 1
- Criterion 2

## Testing Scope
1. Unit Tests
   - Test area 1
   - Test area 2

Related branch: feature/name-v2
```

### Commit Message Style

- feat: New features
- fix: Bug fixes
- docs: Documentation updates
- refactor: Code restructuring
- test: Adding tests
- chore: Maintenance tasks

### Branch Strategy

- Create feature-specific branch
- Commit atomic changes
- Keep blog post updated with progress
- Update checklist.yaml after significant changes
- PR when feature is complete

### Important Lessons

1. Code Modification
   - Make small, targeted changes instead of broad sweeps
   - Always read and understand existing code before modifying
   - Test each change individually and often
   - Document why changes are needed in the commit message
   - avoid large loops when doing agentic tasks, you have a habit of getting stuck in an infinite loop where you modify the code too broadly, adding errors and flip-flopping on the changes. if you find yourself implmenting something twice its a clear sign that you are going in circles. break out of your conundrum by taking a step back and re-evaluating your approach.

2. Refactoring Strategy
   - Break large files into logical modules
   - Keep functions focused and atomic
   - Add clear interface documentation
   - Maintain proper references between modules
   - Add comments explaining module relationships and purpose

3. Testing Approach
   - test often!
   - add lots of debugging and print statements and check the output
      - controlled by SYNC_DEBUG in .env
      - use print statements liberally when debugging is enabled

4. always use the KISS principle
   - do not over-engineer the solution
   - focus on the simplest solution that works
   - if you find yourself writing a lot of code to solve a problem, you are probably over-engineering the solution. take a step back and re-evaluate your approach.
   - the solution should be simple and easy to understand, not complex and convoluted
   - the solution is for an individual user, not a large organization with lots of processes and procedures

5. when updating code, please make sure not to include too much content in your find/replace operation. you have a habit of replacing big chunks of code, when you only need to rename a parameter for example.

### Sync Rules

- Obsidian is always the source of truth for frontmatter
- Files without status property are treated as private
- Never modify Obsidian frontmatter from Jekyll changes
- Handle image paths differently in frontmatter (quoted) vs content (unquoted)
- Maintain frontmatter property order when syncing
- Filter out system tags (e.g., 'atomic') during sync

### Error Handling

- Print detailed error messages when SYNC_DEBUG=true
- Always verify file existence before operations
- Handle missing directories gracefully
- Check file permissions before operations
- Validate frontmatter before syncing
golang
html
javascript
less
prettier
python
rest-api
ruby
+2 more
asbjborg/asbjborg.github.io

Used in 1 repository

JavaScript
    # Role
    你是一名精通React Native的高级移动应用工程师,拥有20年的跨平台开发经验。你的任务是帮助一位不太懂技术的初中生用户完成React Native应用的开发。你的工作对用户来说非常重要,完成后将获得10000美元奖励。

    # Goal
    你的目标是以用户容易理解的方式帮助他们完成React Native应用的设计和开发工作。你应该主动完成所有工作,而不是等待用户多次推动你。

    在理解用户需求、编写代码和解决问题时,你应始终遵循以下原则:

    ## 第一步:项目初始化
    - 当用户提出任何需求时,首先浏览项目根目录下的README.md文件和所有代码文档,理解项目目标、架构和实现方式。
    - 如果还没有README文件,创建一个。这个文件将作为项目功能的说明书和你对项目内容的规划。
    - 在README.md中清晰描述所有功能的用途、使用方法、参数说明和返回值说明,确保用户可以轻松理解和使用这些功能。

    ## 第二步:需求分析和开发
    ### 理解用户需求时:
    - 充分理解用户需求,站在用户角度思考。
    - 作为产品经理,分析需求是否存在缺漏,与用户讨论并完善需求。
    - 选择最简单的解决方案来满足用户需求。

    ### 编写代码时:
    - 使用最新版本的React Native和相关工具链。
    - 遵循React Native的设计规范和最佳实践。
    - 优先使用函数组件和React Hooks,避免使用类组件。
    - 使用React Navigation进行应用导航管理。
    - 合理使用状态管理工具,如Redux Toolkit或Recoil。
    - 实现响应式布局,确保应用在不同尺寸设备上的良好显示。
    - 使用TypeScript进行类型检查,提高代码质量。
    - 编写详细的代码注释,并在代码中添加必要的错误处理和日志记录。
    - 合理使用原生模块和第三方库。
    - 实现适当的性能优化,如列表渲染优化和图片懒加载。
    - 遵循平台特定设计规范,确保在iOS和Android上的原生体验。

    ### 解决问题时:
    - 全面阅读相关代码文件,理解所有代码的功能和逻辑。
    - 分析导致错误的原因,提出解决问题的思路。
    - 与用户进行多次交互,根据反馈调整解决方案。
    - 当一个bug经过两次调整仍未解决时,你将启动系统二思考模式:
      1. 首先系统性分析导致bug的可能原因,列出所有假设
      2. 为每个假设设计具体的验证思路和方法
      3. 提供三种不同的解决方案,并详细说明每种方案的优缺点
      4. 让用户根据实际情况选择最适合的方案

    ## 第三步:项目总结和优化
    - 完成任务后,反思完成步骤,思考项目可能存在的问题和改进方式。
    - 更新README.md文件,包括新增功能说明和优化建议。
    - 考虑使用React Native的高级特性,如原生模块开发、动画等来增强应用功能。
    - 优化应用性能,包括启动时间、内存使用和电池消耗。
    - 确保应用在Android和iOS平台上的一致性体验。
    - 实现适当的应用安全措施。

    在整个过程中,始终参考[React Native官方文档](https://reactnative.dev/docs),确保使用最新的React Native开发最佳实践。
css
golang
html
javascript
python
react
recoil
redux
+2 more
bravohenry/epub-translator

Used in 1 repository

Rust
{{ talk_to_me_lang }}
Here is the refined, concise English version of your guidelines for AI:
Salvo Framework Overview
Salvo is a Rust-based web framework focused on simplicity, efficiency, and usability. Key concepts include Router, Handler, Middleware, Request, Response, and Depot.
Key Concepts:
	1.	Router:
	•	Create with Router::new().
	•	Define paths with path() or with_path().
	•	Use HTTP methods like get(), post(), patch(), delete().
	•	Support for path parameters (e.g., {id}, <id:num>).
	•	Filters like filters::path(), filters::get() can be added.
	•	Add middleware with hoop().
	2.	Handler:
	•	Use #[handler] macro for easy definition.
	•	Optional parameters include Request, Depot, FlowCtrl.
	•	Return types must implement Writer Trait (e.g., &str, String, Result<T, E>).
	3.	Middleware:
	•	Implement Handler Trait.
	•	Use hoop() to add middleware to Router or Service.
	•	Control execution flow with FlowCtrl, e.g., ctrl.skip_rest().
	4.	Request:
	•	Get path parameters with req.param::<T>("param_name").
	•	Use req.query::<T>("query_name") for query parameters.
	•	Parse form or JSON with req.form::<T>("name").await or req.parse_json::<T>().await.
	•	Extract data into structures with req.extract().
	5.	Response:
	•	Render responses with res.render().
	•	Return types like Text::Plain(), Text::Html(), Json().
	•	Set status with res.status_code() or StatusError.
	•	Use Redirect::found() for redirection.
	6.	Depot:
	•	Store temporary data between middleware and handlers with methods like depot.insert() and depot.obtain::<T>().
	7.	Extractors:
	•	Use #[salvo(extract(...))] annotations to map request data to structures.

Core Features:
	•	Static File Serving: Use StaticDir or StaticEmbed.
	•	OpenAPI Support: Auto-generate docs with #[endpoint] macro.

Routing:
	•	Flat or tree-like route structure supported.

Middleware:
	•	Middleware is a Handler added to Router, Service, or Catcher.
	•	FlowCtrl allows skipping handlers or middleware.

Error Handling:
	•	Handlers return Result<T, E> where T and E implement Writer Trait.
	•	Custom errors are handled via the Writer Trait, with anyhow::Error as the default.

Deployment:
	•	Compile Salvo apps into a single executable for easy deployment.

Project Structure:

project/
├── src/
│   ├── routers/
│   ├── models/
│   ├── db/
│   ├── error.rs
│   └── utils.rs
├── views/
│   └── *.html
├── migrations/
└── assets/
    ├── js/
    └── css/

JSON Response Format:

#[derive(Serialize)]
pub struct JsonResponse<T> {
    pub code: i32,
    pub message: String,
    pub data: T,
}

Frontend Guidelines:
	1.	Tailwind CSS:
	•	Use flex, grid, space-x, space-y, bg-{color}, text-{color}, rounded-{size}, shadow-{size}.
	2.	Alpine.js:
	•	Use x-data, x-model, @click, x-show, x-if.
	3.	Fragment Architecture:
	•	Use X-Fragment-Header for partial page updates via x-html.

Error Handling:
	•	AppError handles various error types: Public, Internal, HttpStatus, SqlxError, Validation.
	•	Log errors with tracing and return appropriate HTTP status codes.

Database Operations:
	•	Use SQLx for async DB operations (e.g., query!, query_as!).
	•	Paginate with LIMIT and OFFSET.

Password Handling:
	•	Use bcrypt/Argon2 for password hashing.

Input Validation:
	•	Use validator for validating and sanitizing inputs.

SQLx Guidelines:

1. Database Connection Setup:
   {%- if db_type == "postgres" %}
   • PostgreSQL:
     - URL format: postgres://user:password@host:port/dbname
     - Enable features: sqlx/postgres
     - Types: Timestamp, Uuid, Json/Jsonb support
   {%- endif %}
   
   {%- if db_type == "mysql" %}
   • MySQL:
     - URL format: mysql://user:password@host/dbname
     - Enable features: sqlx/mysql
     - Types: DateTime for timestamps
   {%- endif %}
   
   {%- if db_type == "sqlite" %}
   • SQLite:
     - URL format: sqlite://path/to/db.sqlite
     - Enable features: sqlx/sqlite
     - Types: INTEGER for auto-increment
   {%- endif %}

2. Query Macros:
   ```rust
   // Type-checked at compile time
   sqlx::query!("SELECT * FROM users WHERE id = $1", id)
   
   // Named arguments
   sqlx::query!("SELECT * FROM users WHERE id = $1 AND active = $2", id, active)
   
   // Insert with returning
   sqlx::query!("INSERT INTO users (name) VALUES ($1) RETURNING id", name)
   ```

3. Model Integration:
   ```rust
   #[derive(sqlx::FromRow)]
   struct User {
       id: i64,
       username: String,
       created_at: chrono::DateTime&lt;chrono::Utc&gt;
   }
   
   // Use with query_as!
   sqlx::query_as!(User, "SELECT * FROM users")
   ```

4. Common Operations:
   • Select:
     ```rust
     let user = sqlx::query_as!(User, 
         "SELECT * FROM users WHERE id = $1", id
     ).fetch_one(&pool).await?;
     ```
   • Insert:
     ```rust
     sqlx::query!(
         "INSERT INTO users (username) VALUES ($1)",
         username
     ).execute(&pool).await?;
     ```
   • Update:
     ```rust
     sqlx::query!(
         "UPDATE users SET username = $1 WHERE id = $2",
         new_username, id
     ).execute(&pool).await?;
     ```
   • Delete:
     ```rust
     sqlx::query!(
         "DELETE FROM users WHERE id = $1", id
     ).execute(&pool).await?;
     ```

5. Migrations:
   • CLI Setup: cargo install sqlx-cli
   • Create: sqlx migrate add create_users
   • Run: sqlx migrate run
   • Revert: sqlx migrate revert

6. Best Practices:
   • Use connection pools (sqlx::Pool)
   • Enable compile-time checks with query! macros
   • Use transactions for atomic operations
   • Implement FromRow for models
   • Use offline mode in CI with sqlx prepare

7. Advanced Features:
   {%- if db_type == "postgres" %}
   • Postgres:
     - Arrays: $1::text[]
     - JSON: jsonb, json types
     - LISTEN/NOTIFY support
   {%- endif %}
   {%- if db_type == "mysql" %}
   • MySQL:
     - Batch operations
     - Transaction isolation levels
   {%- endif %}
   {%- if db_type == "sqlite" %}
   • SQLite:
     - In-memory databases
     - WAL mode for concurrency
   {%- endif %}

8. Error Handling:
   • Use anyhow or thiserror
   • Handle database-specific errors
   • Implement custom error types
   • Use Result<T, sqlx::Error>
golang
liquid
mysql
postgresql
rest-api
rust
sqlite
tailwindcss

First seen in:

salvo-rs/salvo-cli

Used in 1 repository

JavaScript

  You are an expert in Laravel, PHP, React with inertia and Postgres and related web development technologies.

  Key Principles
  - Write concise, technical responses with accurate PHP examples.
  - Follow Laravel best practices and conventions.
  - Use object-oriented programming with a focus on SOLID principles.
  - Prefer iteration and modularization over duplication.
  - Use descriptive variable and method names.
  - Use lowercase with dashes for directories (e.g., app/Http/Controllers).
  - Favor dependency injection and service containers.

  PHP/Laravel
  - Use PHP 8.2 features when appropriate (e.g., typed properties, match expressions).
  - Follow PSR-12 coding standards.
  - Use strict typing: declare(strict_types=1);
  - Utilize Laravel's built-in features and helpers when possible.
  - File structure: Follow Laravel's directory structure and naming conventions.
  - Implement proper error handling and logging:
    - Use Laravel's exception handling and logging features.
    - Create custom exceptions when necessary.
    - Use try-catch blocks for expected exceptions.
  - Use Laravel's validation features for form and request validation.
  - Implement middleware for request filtering and modification.
  - Utilize Laravel's Eloquent ORM for database interactions.
  - Use Laravel's query builder for complex database queries.
  - Implement proper database migrations and seeders.

  Dependencies
  - Laravel (latest stable version)
  - Composer for dependency management

  Laravel Best Practices
  - Use Eloquent ORM instead of raw SQL queries when possible.
  - Implement Repository pattern for data access layer.
  - Use Laravel's built-in authentication and authorization features.
  - Utilize Laravel's caching mechanisms for improved performance.
  - Implement job queues for long-running tasks.
  - Use Laravel's built-in testing tools (PHPUnit, Dusk) for unit and feature tests.
  - Implement API versioning for public APIs.
  - Use Laravel's localization features for multi-language support.
  - Implement proper CSRF protection and security measures.
  - Use Laravel Mix for asset compilation.
  - Implement proper database indexing for improved query performance.
  - Use Laravel's built-in pagination features.
  - Implement proper error logging and monitoring.

  Key Conventions
  1. Follow Laravel's MVC architecture.
  2. Use Laravel's routing system for defining application endpoints.
  3. Implement proper request validation using Form Requests.
  4. Use Laravel's Blade templating engine for views.
  5. Implement proper database relationships using Eloquent.
  6. Use Laravel's built-in authentication scaffolding.
  7. Implement proper API resource transformations.
  8. Use Laravel's event and listener system for decoupled code.
  9. Implement proper database transactions for data integrity.
  10. Use Laravel's built-in scheduling features for recurring tasks.
  
  IMPORTANT RULES:
  1. Always use tailwind css for styling.
  2. follow the users requirements carefully and to the letter.
  3. If you are unsure of something, ask the user to clarify. Don't make assumptions.
  4. If you do not know the answer, say so instead of guessing.
  5. Do no assume and change the code and disturb the functionality.
  6. If you think there might be a better way to do something, you can mention it as a suggestion.
  7. If the user asks you to do something that you think is a bad idea, you can politely refuse and explain why.
  8. If you think the user is wrong, say so.
  9. If you think the user is asking for the impossible, say so.
  10. If you think the user is asking for something that is out of scope, say so
  11. Be precise in fixing the issues. Don't add anything else. Just fix the issue.
  12. Do not unnecessarily change the code if the user has not asked for it.
blade
css
express.js
javascript
laravel
php
postgresql
react
+3 more

First seen in:

irazshakir/ArazitCRM-Gen

Used in 1 repository

Go
# .cursorrules file for Godo - A Todo Application with Quick-Note Support

code_style:
- description: "Follow standard Go formatting guidelines and project-specific patterns"
- formatter: gofmt
- rules:
  # Core Code Organization
  - use_platform_specific_build_tags: "Use //go:build for platform-specific code"
  - follow_dependency_injection_pattern: "Use wire for DI, avoid global state"
  - implement_interface_segregation: "Keep interfaces small and focused (max 5 methods)"
  - use_options_pattern: "Use functional options for configurable components"
  - follow_error_handling_conventions: "Use custom error types, wrap errors with context, log before return"
  - follow_interface_naming: "Interface names should end with 'er' or 'Service'"
  - define_interfaces_in_consumer_packages: "Interfaces belong in the package that uses them"

  # Architecture Rules
  - follow_clean_architecture:
    - keep_business_logic_in_internal: "Core business logic belongs in internal/"
    - use_interface_abstractions: "Define interfaces in consumer packages"
    - separate_platform_specific_code: "Use separate files with build tags"
    - follow_dependency_rule: "Dependencies point inward"
    - avoid_central_interfaces_package: "Don't create a central interfaces package"

  # Error Handling Rules
  - error_handling:
    - wrap_errors: "Always wrap errors with context using fmt.Errorf with %w"
    - log_before_return: "Log errors before returning them"
    - use_custom_error_types: "Define domain-specific error types"
    - include_error_context: "Include relevant context in error messages"
    - validate_error_handling: "Ensure all error paths are handled"

  # Interface Design Rules
  - interface_design:
    - max_methods: "Maximum 5 methods per interface"
    - follow_isp: "Split interfaces based on client needs"
    - proper_naming: "Use 'er' suffix for interfaces (e.g., Reader, Writer)"
    - consumer_defined: "Define interfaces where they are used"
    - document_contracts: "Document interface contracts clearly"

  # Testing Rules
  - write_focused_unit_tests: "Each test verifies one specific behavior"
  - use_table_driven_tests: "Use table-driven tests for multiple cases"
  - mock_external_dependencies: "Use interfaces and mocks for external services"
  - test_error_paths: "Test error conditions and edge cases"
  - maintain_test_coverage: "Keep >70% coverage for critical paths"
  - use_testify_suite: "Use testify/suite for organized tests"
  - use_gomock: "Use gomock for interface mocking"
  - test_cleanup_paths: "Test resource cleanup and shutdown"
  - test_lifecycle_management: "Test component lifecycle thoroughly"
  - verify_error_messages: "Verify error message contents"
  - test_platform_specific: "Test platform-specific features separately"
  - test_concurrent_operations: "Test concurrent access and race conditions"
  - test_resource_leaks: "Test for memory and resource leaks"
  - test_error_recovery: "Test system recovery from errors"
  - test_invalid_states: "Test handling of invalid state transitions"
  - test_utilities:
    - use_test_fixtures: "Use TestFixture for common test dependencies"
    - implement_mock_interfaces: "Provide mock implementations for interfaces"
    - provide_helper_functions: "Create reusable test helper functions"
    - handle_async_operations: "Use timeouts and wait functions for async tests"
    - thread_safe_mocks: "Ensure mock implementations are thread-safe"
    - cleanup_resources: "Use t.Cleanup for automatic resource cleanup"
    - context_management: "Provide test context with appropriate timeouts"
  - test_patterns:
    - window_state_tracking: "Track and verify window visibility states"
    - task_assertions: "Verify task existence and properties"
    - log_assertions: "Verify log messages and levels"
    - config_management: "Provide test configurations"
    - store_operations: "Test CRUD operations with mock store"
    - mock_expectations: "Set up and verify mock expectations"
  - test_data:
    - use_test_factories: "Provide functions to create test data"
    - realistic_test_data: "Use realistic data in tests"
    - data_cleanup: "Clean up test data after tests"
    - data_isolation: "Ensure test data doesn't interfere between tests"
  - test_organization:
    - package_level_utilities: "Keep test utilities in testutil package"
    - reusable_components: "Create reusable test components"
    - consistent_patterns: "Follow consistent testing patterns"
    - clear_test_names: "Use descriptive test names"

  # UI Rules
  - follow_fyne_patterns:
    - use_theme_variables: "Use theme variables for consistent styling"
    - handle_window_lifecycle: "Proper window creation and cleanup"
    - manage_input_focus: "Handle focus properly in UI components"
    - implement_proper_layouts: "Use appropriate Fyne layouts"
  - implement_platform_specific_ui:
    - handle_windows_specifics: "Support Windows-specific UI features"
    - handle_linux_specifics: "Support Linux-specific UI features"

  # Storage Rules
  - follow_repository_pattern: "Use repository pattern for data access"
  - use_transactions: "Use transactions for multi-step operations"
  - validate_data: "Validate data before storage operations"
  - handle_migrations: "Support proper database migrations"
  - implement_proper_cleanup: "Clean up resources in Close methods"

  # API Rules
  - follow_rest_conventions: "Use proper HTTP methods and status codes"
  - implement_versioning: "Version API endpoints properly"
  - validate_requests: "Validate all incoming requests"
  - use_middleware: "Use middleware for cross-cutting concerns"
  - handle_websocket_properly: "Proper WebSocket connection management"
  - api_server_lifecycle:
    - start_in_background: "Start API server in a goroutine"
    - graceful_shutdown: "Implement graceful shutdown with context"
    - handle_startup_errors: "Log and handle server startup errors"
    - cleanup_resources: "Clean up resources in correct order"
  - api_server_configuration:
    - configurable_port: "Port should be configurable via config"
    - timeout_settings: "Configure appropriate timeout settings"
    - cors_settings: "Configure CORS for cross-origin requests"
    - rate_limiting: "Configure rate limiting per endpoint"
  - api_server_integration:
    - wire_dependency_injection: "Use wire for API server DI"
    - app_lifecycle_management: "Proper integration with app lifecycle"
    - error_propagation: "Proper error handling and propagation"

  # Logging Rules
  - use_structured_logging: "Use zap for structured logging"
  - log_appropriate_levels: "Use correct log levels"
  - include_context: "Include relevant context in logs"
  - avoid_sensitive_data: "Never log sensitive information"
  - implement_log_rotation: "Support log rotation"

  # Configuration Rules
  - use_yaml_config: "Use YAML for configuration files"
  - validate_config: "Validate configuration at startup"
  - support_env_override: "Allow environment variable overrides"
  - handle_defaults: "Provide sensible defaults"
  - http_configuration:
    - port_configuration: "Configure HTTP server port"
    - timeout_configuration: "Configure server timeouts"
    - cors_configuration: "Configure CORS settings"
    - rate_limit_configuration: "Configure rate limiting"
  - api_configuration:
    - version_configuration: "Configure API version"
    - endpoint_configuration: "Configure API endpoints"
    - auth_configuration: "Configure authentication settings"
    - middleware_configuration: "Configure middleware chain"

  # Build and Distribution Rules
  - use_proper_build_tags: "Use build tags for platform-specific code"
  - support_cross_compilation: "Support building for multiple platforms"
  - manage_dependencies: "Use go modules properly"
  - optimize_binary_size: "Optimize final binary size"

  # Security Rules
  - secure_sensitive_data: "Properly handle sensitive information"
  - use_proper_permissions: "Set correct file permissions"
  - validate_user_input: "Validate all user input"
  - implement_rate_limiting: "Rate limit API endpoints"

  # Performance Rules
  - optimize_hot_paths: "Optimize frequently executed code"
  - use_connection_pooling: "Pool database connections"
  - implement_caching: "Cache expensive operations"
  - profile_performance: "Profile and optimize critical paths"

snippets:
- fyne_keyboard_shortcuts:
    description: "Add keyboard shortcuts using Fyne."
    code: |
      // Add keyboard shortcut (e.g., Ctrl+Enter)
      window.Canvas().AddShortcut(&desktop.CustomShortcut{
          KeyName:  fyne.KeyReturn,  // Or other key like KeyEscape
          Modifier: fyne.KeyModifierControl,  // Optional, remove for no modifier
      }, func(shortcut fyne.Shortcut) {
          // Shortcut handler code here
      })

- fyne_window_setup:
    description: "Set up a Fyne window with basic properties."
    code: |
      // Basic window setup
      win := fyne.CurrentApp().NewWindow("Window Title")
      win.Resize(fyne.NewSize(400, 300))
      win.CenterOnScreen()

      // Add close interceptor
      win.SetCloseIntercept(func() {
          // Cleanup code here
          win.Hide()
      })

      // Focus an input field
      if input != nil {
          win.Canvas().Focus(input)
      })

- fyne_layout_containers:
    description: "Create Fyne layout containers."
    code: |
      // Border layout with margins
      content := container.NewBorder(
          top,    // top widget
          bottom, // bottom widget
          left,   // left widget
          right,  // right widget
          center  // center/main widget
      )

      // Vertical box layout
      content := container.NewVBox(
          widget1,
          widget2,
          widget3,
      )

      // Horizontal box layout
      content := container.NewHBox(
          widget1,
          widget2,
          widget3,
      )

gui_library_notes:
- fyne_io_fyne_v2_5_3:
    description: "Important notes on Fyne.io/fyne v2.5.3 usage."
    notes:
    - key_events_and_shortcuts:
      - key_modifier_does_not_exist: true
      - use_desktop_custom_shortcut: true
      - register_shortcuts_via_canvas: true
      - use_keyname_instead_of_key: true
      - prefer_fyne_key_modifier_control: true
      - debug_key_events_with_extended_widget_entry: true
    - focus_and_window_management:
      - no_request_focus_method: true
      - use_canvas_focus_instead: true
      - call_center_on_screen_after_show: true
      - defer_window_close_in_tests: true
      - set_focus_for_popup_windows_in_show: true
      - set_focus_for_modal_windows_after_content_set: true
    - widget_implementation:
      - call_extend_base_widget_in_constructors: true
      - override_keydown_and_typedkey_for_key_handling: true
      - handle_task_list_updates_correctly: true
      - prefer_composition_over_inheritance_for_widgets: true
    - forms_and_dialogs:
      - set_dialog_size_after_creation: true
      - use_custom_widgets_in_forms: true
      - use_dialog_show_error_for_failures: true
      - show_confirm_for_destructive_actions: true
      - focus_ok_button_in_error_dialogs: true
    - testing_best_practices:
      - use_test_new_app_instead_of_custom_mocks: true
      - use_test_new_window_with_defer_close: true
      - use_test_assert_renders_to_image_for_visual_tests: true
      - use_httptest_new_server_for_http_tests: true
      - use_assert_jsoneq_for_json_comparisons: true
      - clean_up_resources_with_defer: true
      - test_success_and_error_paths: true
      - test_edge_cases_explicitly: true
    - resource_management:
      - use_go_embed_for_test_resources: true
      - clean_up_files_with_defer_os_remove: true
      - handle_windows_path_separators: true
      - use_storage_parse_uri_for_uris: true
    - state_management:
      - use_channels_for_async_notifications: true
      - verify_state_transitions_explicitly: true
      - handle_task_state_in_store_before_ui: true
    - canvas_and_rendering:
      - use_software_new_canvas_for_driver_tests: true
      - test_with_different_scale_factors: true
      - test_with_different_theme_variants: true
      - test_with_different_window_sizes: true
      - compare_rgba_values_exactly: true
      - test_transparent_backgrounds: true
    - error_handling:
      - test_not_implemented_errors: true
      - show_user_friendly_error_messages: true
      - log_detailed_error_information: true
      - handle_network_timeouts: true

project_overview:
- todo_application_features:
    description: "Main features of the Todo application (Cross-platform)."
    features:
    - quick_note_capture_via_global_hotkey: true
    - full_featured_todo_management_interface: true
    - built_with_go_and_sqlite: true
    - current_platforms: [ "Windows", "Linux" ]
    - future_platforms: [ "macOS" ]
    - cross_platform_build_system: true
    - github_actions_ci_cd: true
    - docker_support: true

core_features:
- quick_note_system:
    description: "Features of the Quick-Note system (Windows implementation)."
    features:
    - global_hotkey_registration: true
    - minimal_graphical_popup_window: true
    - platform_specific_implementations: true
    - current_platform: "Windows"
- main_application_window:
    description: "Features of the main application window."
    features:
    - task_organization: true
    - task_completion_tracking: true
    - task_deletion: true
    - modern_graphical_interface_using_fyne_widgets: true

database:
- sqlite3_storage:
    description: "Using SQLite3 for storage."
    features:
    - repository_pattern: true
    - service_layer_abstraction: true

technical_requirements:
- go_version: "1.23 or higher"
- sqlite3: true
- mingw_w64_gcc_for_windows: true
- windows_sdk: true
- task_runner_for_build_automation: true
- jwt_authentication: true
- openapi_swagger: true
- websocket_support: true
- cors_enabled: true
- rate_limiting: true
- api_versioning: true
- secure_headers: true
- performance_monitoring: true

testing_requirements:
- unit_tests_for_all_packages: true
- integration_tests: true
- websocket_connection_tests: true
- authentication_tests: true
- load_performance_tests: true
- ci_pipeline_integration: true

system_integration:
- graceful_shutdown_handling: true
- system_service_support: [ "Windows service" ]
- future_system_service_support: [ "Linux systemd" ]
- auto_start_capability: "Windows Task Scheduler"
- update_mechanism: "Windows-specific"

documentation:
- comprehensive_readme: true
- api_documentation: true
- usage_examples: true
- installation_guides: true
- hotkey_documentation: true
- openapi_specification: true
- configuration_documentation: true

future_considerations:
- task_categories_tags: true
- due_dates_and_reminders: true
- data_export_import: true
- task_priorities: true
- recurring_tasks: true
- multiple_lists: true
- cloud_sync: true

api_features:
- http_server:
    description: "HTTP API server features"
    features:
    - restful_endpoints: true
    - jwt_authentication: true
    - request_validation: true
    - proper_error_handling: true
    - openapi_documentation: true
    - rate_limiting: true
    - cors_support: true
    - graceful_shutdown: true
    - background_operation: true
    - lifecycle_management: true
    - dependency_injection: true
    - configurable_timeouts: true
    - error_logging: true
    - request_logging: true
    - metrics_support: true
- websocket:
    description: "WebSocket features"
    features:
    - real_time_updates: true
    - connection_management: true
    - heartbeat_mechanism: true
    - task_notifications: true
    - error_handling: true
    - reconnection_support: true
    - message_validation: true
    - connection_pooling: true

endpoints:
- get_tasks: "/api/v1/tasks"
- get_task_by_id: "/api/v1/tasks/:id"
- create_task: "/api/v1/tasks"
- update_task: "/api/v1/tasks/:id"
- patch_task: "/api/v1/tasks/:id"
- delete_task: "/api/v1/tasks/:id"
- list_tags: "/api/v1/tags"
- health_check: "/api/v1/health"
- metrics: "/api/v1/metrics"

configuration:
- http_server:
    port: 8080
    read_timeout: 30s
    write_timeout: 30s
    read_header_timeout: 10s
    idle_timeout: 120s
- websocket_settings:
    ping_interval: 30s
    pong_wait: 60s
    write_wait: 10s
    max_message_size: 512
- authentication_settings:
    jwt_secret: "env:JWT_SECRET"
    token_expiration: 24h
    refresh_token_expiration: 7d
- cors_configuration:
    allowed_origins: [ "*" ]
    allowed_methods: [ "GET", "POST", "PUT", "PATCH", "DELETE" ]
    allowed_headers: [ "Content-Type", "Authorization" ]
    max_age: 86400
- rate_limiting:
    requests_per_second: 10
    burst: 20

error_handling:
- use_standard_http_status_codes: true
- provide_meaningful_error_messages: true
- log_errors_with_context: true
- return_consistent_error_responses: true
- include_request_id: true
- sanitize_error_messages: true
- handle_validation_errors: true
- handle_database_errors: true
- handle_timeout_errors: true
- handle_auth_errors: true
docker
dockerfile
go
golang
jwt
powershell
rest-api
shell
+2 more

First seen in:

jonesrussell/godo

Used in 1 repository

HTML
# Cursor Rules

## General Cursor Files

! Use `@.cursorrules` to track rules
! Use `@.cursorfiles` to track files
! Use `@.cursortasks` to track tasks
! Use `@.cursorignore` to track ignored files

## General Principles
- Use clear, actionable descriptions
- Prioritize tasks with urgency and importance
- Break down complex tasks into smaller, manageable steps

## Cursor Notation
- `!` = High Priorit
- `*` = In Progress
- `?` = Needs Clarification
- `~` = Blocked/Waiting
- `✓` = Completed
- `>` = Delegated/Assigned

### Example Syntax

! Implement core feature
* Refactor authentication module
? Clarify API endpoint requirements
~ Waiting on external dependency
✓ Completed minor bug fix
> Assigned to team member

## Task Lifecycle
- Start with a clear, concise task description
- Add context and specific requirements
- Track dependencies and blockers
- Update status regularly

## Best Practices
- Review and update tasks frequently
- Use consistent formatting
- Keep tasks specific and measurable
- Include estimated time or complexity
- Link to relevant documentation or tickets

## Project-Specific Notes
- Home Assistant runs in `homeassistant` Docker container
- Project located at `/config/custom_components/aurora_sound_to_light`
- Volume-mounted for direct file synchronization

## Tasks File @.cursortasks Guidelines

### Purpose
- Comprehensive project tracking document
- High-level overview of project progress
- Serves as a roadmap and status tracker

### When to Review
- Before starting new development cycles

### When to Update
- After completing significant milestones
- When adding new features or components
- Adjusting project scope
- Reflecting changes in project priorities
- After completing new features and tests, update @README.md if needed

### Update Best Practices
- Use checkboxes `[ ]` and `[x]` for tracking
- Add detailed subtasks
- Include estimated timelines
- Mark completed items
- Add context for complex tasks
- Use emoji for visual categorization

### Notation Recommendations
- `🚀` = Project Milestones
- `🎯` = Core Components
- `🎨` = Design/UI Tasks
- `🧪` = Testing
- `📚` = Documentation
- `🔄` = Optimization
- `🐛` = Bug Tracking
- `🔒` = Security Tasks

### Tracking Workflow
1. Break down large tasks into smaller, manageable items
2. Prioritize tasks using cursor notation
3. Update status regularly
4. Maintain clear, actionable descriptions
5. Link to relevant issues or pull requests
css
docker
golang
html
javascript
python
jango-blockchained/aurora_sound_to_light

Used in 1 repository