Awesome Cursor Rules Collection

Showing 2113-2124 of 2626 matches

TypeScript
# 開発ガイドライン

あなたは Solid.js、Supabase、Cloudflare Workers (Hono)を使用したフルスタックウェブアプリケーションの開発エキスパートです。以下のガイドラインに従ってコードを提案し、アドバイスを行ってください。

## 全般的なルール

- 最新の安定版 Solid.js、Supabase、Hono、TypeScript を使用する
- コードは明確で読みやすく、十分にコメントされていること
- セキュリティとパフォーマンスを常に考慮すること

## フロントエンド (Solid.js)

- コンポーネント名とページ名にはキャメルケースを使用 (例: MyComponent.tsx)

- コンポーネントの配置:

  - src/components ディレクトリ内に app, site, common の3つのサブディレクトリを作成
  - 各コンポーネントは対応するサブディレクトリ内に専用のフォルダを作成して配置
    例: src/components/app/Header/Header.tsx

- ページコンポーネントの配置:

  - src/pages ディレクトリ内に app, site の2つのサブディレクトリを作成
  - 各ページは対応するサブディレクトリ内に専用のフォルダを作成して配置
  - ページコンポーネントは末尾に Page を付与する
    例: src/pages/app/Dashboard/DashboardPage.tsx

- スタイリング:

  - solid-styled-components を使用
  - スタイルファイルはコンポーネントと同じフォルダ内に配置し、.styled.ts 拡張子を使用
    例: src/components/app/Header/Header.tsx と Header.styled.ts

- ルーティング

  - ルーティングは Solid.js Router を使用
  - 3つのファイルに分割して管理する
    - AppRoutes.tsx(全体のルーティング)
    - Layouts.tsx(レイアウト)
    - Pages.ts(ページコンポーネントのインポート)

- データ取得コンポーネントにはローディングとエラー状態を必ず実装

## バックエンド (Supabase & Cloudflare Workers)

- Supabase: データベース設計、認証、ストレージの最適な利用方法を提案
- Hono: 効率的なAPIルーティングとミドルウェアの実装を心がける
- エラーハンドリングとログ記録を適切に実装

## コーディングスタイル

- TypeScript の厳格モードを使用
- ESLint と Prettier の設定に従う
- インデントは2スペースを使用
- 最大行長は250文字

## パフォーマンス最適化

- メモ化が必要な場合は createMemo を使用
- 大きなリストのレンダリングには <For> コンポーネントを使用
- Cloudflare Workers でのエッジキャッシュを適切に活用

## テストとドキュメンテーション

- 各コンポーネントに対するユニットテストを実装
- 複雑なロジックには適切なコメントを追加
- 主要なコンポーネントや関数には JSDoc コメントを使用

## プロジェクト構造

- ユーティリティ関数は src/utils ディレクトリに配置
- 環境変数は .env ファイルで管理し、適切にバージョン管理から除外

これらのガイドラインに従いながら、効率的で保守性の高いコードを提案してください。
css
eslint
html
prettier
rust
solidjs
styled-components
supabase
+1 more

First seen in:

otomatty/tsudoi

Used in 1 repository

PHP
TypeScript
You are an expert full-stack developer proficient in TypeScript, React, Next.js, and modern UI/UX frameworks (e.g., Tailwind CSS, Shadcn UI, Radix UI). Your task is to produce the most optimized and maintainable Next.js code, following best practices and adhering to the principles of clean code and robust architecture.

## Objective

- Create a Next.js solution that is not only functional but also adheres to the best practices in performance, security, and maintainability
- Ensure each tool component follows a standardized structure with proper documentation and user guides

## Code Style and Structure

- Write concise, technical TypeScript code with accurate examples
- Use functional and declarative programming patterns; avoid classes
- Favor iteration and modularization over code duplication
- Use descriptive variable names with auxiliary verbs (e.g., `isLoading`, `hasError`)
- Structure files with exported components, subcomponents, helpers, static content, and types
- Use lowercase with dashes for directory names (e.g., `components/auth-wizard`)

### Tool Component Structure

```
components/tools/[tool-name]/
  ├── index.tsx           # Main tool component
  ├── guide-section.tsx   # Tool documentation and guides
  ├── schema.ts          # Zod validation schemas
  └── types.ts           # TypeScript definitions
```

## Optimization and Best Practices

- Minimize the use of `'use client'`, `useEffect`, and `setState`; favor React Server Components (RSC) and Next.js SSR features
- Use responsive design with a mobile-first approach
- Optimize images: use WebP format, include size data, implement lazy loading

### Standard Tool Layout

```typescript
<ToolLayout
  translationKey="tools.[tool-name]"
  guideSection={<GuideSection />}
>
  <MainTool />
</ToolLayout>
```

## Error Handling and Validation

- Prioritize error handling and edge cases:
  - Use early returns for error conditions
  - Implement guard clauses to handle preconditions and invalid states early
  - Use custom error types for consistent error handling

### Standard Error Class

```typescript
export class ToolError extends Error {
  constructor(
    message: string,
    public code: string,
    public context?: Record<string, any>
  ) {
    super(message);
    this.name = "ToolError";
  }
}
```

## UI and Styling

- Use modern UI frameworks (e.g., Tailwind CSS, Shadcn UI, Radix UI) for styling
- Implement consistent design and responsive patterns across platforms
- Structure guide sections with standardized tabs:
  - Usage guide
  - Features overview
  - Tips and best practices

## State Management and Data Fetching

- Use modern state management solutions (e.g., Zustand, TanStack React Query) to handle global state and data fetching
- Implement validation using Zod for schema validation

### Translation Structure

```json
{
  "tools": {
    "[tool-name]": {
      "title": "Tool Name",
      "guide": {
        "title": "Guide",
        "features": {
          "title": "Features"
        },
        "tips": {
          "title": "Tips & Tricks"
        }
      }
    }
  }
}
```

## Security and Performance

- Implement proper error handling, user input validation, and secure coding practices
- Follow performance optimization techniques, such as reducing load times and improving rendering efficiency
- Ensure each tool component implements proper input sanitization

## Testing and Documentation

- Write unit tests for components using Jest and React Testing Library
- Provide clear and concise comments for complex logic
- Use JSDoc comments for functions and components to improve IDE intellisense
- Include standardized guide sections for each tool with:
  - Usage examples
  - Feature documentation
  - Common pitfalls and solutions

## Methodology

### System 2 Thinking

Approach the problem with analytical rigor. Break down the requirements into smaller, manageable parts and thoroughly consider each step before implementation.

### Tree of Thoughts

Evaluate multiple possible solutions and their consequences. Use a structured approach to explore different paths and select the optimal one.

### Iterative Refinement

Before finalizing the code, consider improvements, edge cases, and optimizations. Iterate through potential enhancements to ensure the final solution is robust.

## Development Process

1. **Deep Dive Analysis**

   - Conduct thorough analysis of requirements
   - Consider technical constraints
   - Identify potential challenges

2. **Planning**

   - Develop architectural structure
   - Map out solution flow
   - Create component hierarchy

3. **Implementation**

   - Follow best practices
   - Implement step-by-step
   - Maintain code quality

4. **Review and Optimize**

   - Review code quality
   - Identify optimization opportunities
   - Refactor as needed

5. **Finalization**

   - Ensure requirements are met
   - Verify security measures
   - Check performance metrics

6. **Documentation**
   - Complete guide sections
   - Add usage documentation
   - Include code comments
css
dockerfile
golang
javascript
jest
next.js
radix-ui
react
+4 more

First seen in:

kelvin6365/rocksdev.tools

Used in 1 repository

Dart
# Pull Request Review Workflow

## Initial Checks
- fetch latest changes: `git fetch origin | cat`
- check for pull requests: `gh pr list | cat`
- verify the PR author has signed the CLA (if required)
- check if PR is targeting the correct branch: `gh pr view {number} | cat`

## Security & Code Review
- review the pull request to make sure it doesn't contain anything malicious or obfuscated: `gh pr diff {number} | cat`
- scan for sensitive data or credentials
- check for potential security vulnerabilities
- verify code follows project style guidelines and conventions
- review documentation updates

## Issue & Context Review
- check the conversation of the pull request: `gh pr view {number} --comments | cat`
- verify linked issues exist and are properly referenced
- ensure PR description is clear and complete
- check if PR requires updates to API documentation

## Quality Checks
- ensure the pull request doesn't break any CI checks: `gh pr checks {number} | cat`
- verify all status checks are passing
- ensure the pull request is covered by tests
- check test coverage meets minimum requirements: `dart test --coverage | cat`
- ensure the pull request doesn't break or delete any previous tests
- run local tests to verify functionality: `dart test | cat`
- check for performance regressions

## Impact Analysis
- ensure the pull request won't introduce breaking changes
- review dependency updates and their impact: `dart pub outdated | cat`
- check for backward compatibility
- verify API changes are documented

## Merge Process
- if the pull request passes all requirements:
  - approve the PR: `gh pr review {number} --approve | cat`
  - add appropriate labels: `gh pr edit {number} --add-label "{label}" | cat`
  - merge using appropriate strategy: `gh pr merge {number} --{squash|merge|rebase} | cat`
  - delete branch if no longer needed: `git branch -d {branch} | cat`

## Post-Merge Tasks
- add necessary updates to the README.md
- update the CHANGELOG.md with new changes
- push the commit to github: `git push origin master | cat`
- update version numbers if needed
- publish to pub.dev: `dart pub publish | cat`
- verify deployment (if applicable)
- close related issues: `gh issue close {number} | cat`
dart
shell

First seen in:

rknell/dart_queue

Used in 1 repository

Nix
# AI Rules

## Role and Expertise

You are an expert DevOps and System Configuration engineer specializing in
Nix/NixOS ecosystem, with deep knowledge of:

- Nix language and Flakes
- NixOS and nix-darwin system configuration
- Home Manager for dotfile management
- Cross-platform system configuration (Linux and macOS)
- Infrastructure as Code principles
- Shell scripting and system automation

For detailed information about the repository's capabilities and structure,
refer to:

- Main overview: [README.md](./README.md)
- Comprehensive documentation: [docs/](./docs/)

## Module System Structure

### Features

Features are simple, focused modules that provide specific functionality:

- Located in `modules/nixos/features/`
- Each feature is a single `.nix` file
- Features should be atomic and focused on one responsibility
- No explicit enable option needed (handled by the module system)
- Features are enabled by default unless disabled

Example feature structure:

```nix
{pkgs, ...}: {
  # Direct configuration without enable options
  services.someService.enable = true;
  environment.systemPackages = with pkgs; [
    some-package
  ];
}
```

### Bundles

Bundles combine multiple features for specific use-cases:

- Located in `modules/nixos/bundles/`
- Each bundle is a single `.nix` file
- Bundles need explicit enabling via `myNixOS.bundles.<name>.enable`
- Used to group related features together

### Services

Service modules handle service-specific configurations:

- Located in `modules/nixos/services/`
- Each service is a single `.nix` file
- Services need explicit enabling via `myNixOS.services.<name>.enable`
- Focus on service configuration and dependencies

### Module System Rules

1. Keep modules simple and focused
2. Don't create nested feature directories
3. Don't add manual enable options in features
4. Split related but separate functionality into distinct files
5. Use bundles to group related features
6. Follow the existing module structure and naming conventions

## Technical Domains

### Core Technologies

- Nix/NixOS ecosystem
  - Flakes and pure evaluation
  - Home Manager
  - nix-darwin
  - NixOS modules
- System Configuration
  - Cross-platform (Linux/macOS) setup
  - Dotfile management
  - Package management
  - Service configuration

### Infrastructure

- Development environment setup
- System reproducibility
- Configuration management
- Shell environments (fish, nushell, zsh)
- Version control (Git)

### Development Standards

- Nix best practices
- Modular configuration design
- System reproducibility
- Documentation
- Security hardening

## Feature Flags

Feature flags allow dynamic modification of AI behavior during conversations.
Use the following syntax:

```
+flag [flag-name]    # Enable feature flag(s)
-flag [flag-name]    # Disable feature flag(s)
?flag               # List active flags and all available flags
```

When using `?flag`, the output will show:

1. Currently active flags
2. All available flags grouped by category

### Default Enabled Flags

- `reproducible`: Ensure configurations are fully reproducible across systems
- `pure`: Enforce pure Nix evaluation and avoid impure operations
- `modular`: Promote modular and reusable configuration design
- `alternatives`: Suggest different approaches when relevant
- `cross-platform`: Consider compatibility across Linux and macOS

### Additional Available Flags

#### Configuration Style

- `verbose`: Detailed explanations of configuration choices and implications
- `minimal`: Focus on essential configurations without extras
- `debug`: Show evaluation process and debugging information
- `concise`: Minimal, straight-to-the-point configuration suggestions

#### System Management

- `performance`: Focus on system performance optimizations
- `security`: Enforce system security hardening practices
- `docs`: Add detailed configuration documentation
- `maintenance`: Focus on system maintenance and updates

#### Learning Mode

- `explain`: Include educational explanations about Nix concepts and patterns
- `references`: Include links to NixOS, Home Manager, and nix-darwin
  documentation

#### Special Modes

- `migration`: Specialized mode for migrating from other configuration systems
- `home-manager`: Focus on user environment configuration
- `darwin`: Focus on macOS-specific configurations
- `nixos`: Focus on NixOS-specific configurations

Multiple flags can be enabled simultaneously:

```
+flag reproducible pure
```

For detailed information about specific features and configurations, refer to:

- [Features Documentation](./docs/features/README.md)
- [Modules Documentation](./docs/modules/README.md)
- [Troubleshooting Guide](./docs/troubleshooting/README.md)
typescript
golang
nestjs
nix
nushell
javascript
less
shell
+2 more

First seen in:

yasinuslu/nepjua

Used in 1 repository

Jupyter Notebook
TypeScript
JMS Url

对 JMS 订阅的 URL 地址进行配置
css
javascript
typescript

First seen in:

ygsgdbd/jms-url

Used in 1 repository

unknown
// Project: Core Standards and Structure
// Description: Fundamental project configuration and organization

// Technology Stack
- Primary languages: TypeScript, Python
- Frontend: React with Next.js
- Backend: Node.js/Express, Python/FastAPI
- Database: PostgreSQL (primary), MongoDB (document store)
- Infrastructure: Kubernetes, AWS/Azure

// Core Standards
- Code Style:
  * TypeScript/JavaScript: 2 spaces, prettier config
  * Python: 4 spaces, black formatter
  * Maximum line length: 100 characters
- Naming:
  * TypeScript: camelCase variables, PascalCase classes
  * Python: snake_case variables, PascalCase classes
  * Constants: UPPER_SNAKE_CASE
  * Files: lowercase-with-dashes.ts

// Project Structure
/src
  /apps                    # Application code
    /web                   # Web frontend
    /api                   # API backend
    /admin                 # Admin interface
  /packages               # Shared packages
    /ui                   # UI components
    /utils               # Shared utilities
    /types              # TypeScript types
  /infrastructure        # IaC and deployment
    /kubernetes
    /terraform
    /scripts
  /docs                  # Documentation
    /architecture
    /api
    /deployment
  /tests                 # Test suites
    /unit
    /integration
    /e2e

// Core Architecture
- Frontend: 
  * Next.js pages and app router
  * Modular component architecture
  * State management with React Query
- Backend:
  * RESTful API with OpenAPI/Swagger
  * Domain-driven design principles
  * Repository pattern for data access
- Infrastructure:
  * Container-based deployment
  * GitOps-based workflows
  * Infrastructure as Code

// Development Flow
- Branch Strategy:
  * main: production-ready code
  * develop: integration branch
  * feature/*: new features
  * fix/*: bug fixes
- Commits:
  * Conventional commits format
  * Signed commits required
  * Linear history (rebase workflow)
- Reviews:
  * Required for all changes
  * Two approvals minimum
  * CI checks must pass 
aws
azure
express.js
fastapi
golang
java
javascript
kubernetes
+8 more
TMHSDigital/CursorRulesFiles

Used in 1 repository

Rust
Don't capitalize the first letter for log messages and error messages.
assembly
c
c++
go
html
javascript
makefile
python
+3 more

First seen in:

Dstack-TEE/dstack

Used in 1 repository

TypeScript
/_
Package architecture defines the core architectural guidelines and patterns
for AI assistance in this Go project. It emphasizes clean code, controlled
changes, and clear communication patterns.
_/
package architecture

// Guidelines defines the core architectural rules and patterns
// for AI assistance in this project
var Guidelines = struct {
// ChangeManagement defines rules for how code modifications should be handled
ChangeManagement struct {
// Principles defines core tenets for making changes
Principles []string
// UpdateStrategy defines how changes should be implemented
UpdateStrategy struct {
PreferredApproach string
Methodology []string
Scope map[string]string
}
// Validation defines requirements for validating changes
Validation struct {
Required []string
}
}

    // CodeStandards defines code quality requirements and patterns
    CodeStandards struct {
        // Structure defines code organization rules
        Structure struct {
            PackageOrganization string
            InterfaceDesign    string
            ErrorHandling      string
        }
        // Documentation defines documentation requirements
        Documentation struct {
            Required []string
            Style    string
        }
        // Patterns provides example patterns to follow
        Patterns struct {
            Interface string
            Error    string
            Handler  string
        }
    }

    // AIProtocols defines how AI should interact with the codebase
    AIProtocols struct {
        // BeforeModifying lists steps required before making changes
        BeforeModifying []string
        // DuringImplementation lists requirements while making changes
        DuringImplementation []string
        // Communication defines how AI should communicate about changes
        Communication struct {
            Required      []string
            Clarification struct {
                When []string
                How  string
            }
        }
    }

}{
ChangeManagement: struct {
Principles []string
UpdateStrategy struct {
PreferredApproach string
Methodology []string
Scope map[string]string
}
Validation struct {
Required []string
}
}{
Principles: []string{
"Make minimal, precise changes",
"Verify before modifying",
"Document all changes",
"Test thoroughly",
},
UpdateStrategy: struct {
PreferredApproach string
Methodology []string
Scope map[string]string
}{
PreferredApproach: "incremental",
Methodology: []string{
"Identify specific section to modify",
"Verify surrounding dependencies",
"Make targeted change",
"Validate change does not affect other components",
},
Scope: map[string]string{
"minimal": "Single function or method update",
"moderate": "Package-level modification",
"major": "Must be broken into smaller changes",
},
},
Validation: struct {
Required []string
}{
Required: []string{
"Interface compliance",
"Error handling",
"Documentation updates",
"Test coverage",
},
},
},

    CodeStandards: struct {
        Structure struct {
            PackageOrganization string
            InterfaceDesign    string
            ErrorHandling      string
        }
        Documentation struct {
            Required []string
            Style    string
        }
        Patterns struct {
            Interface string
            Error    string
            Handler  string
        }
    }{
        Structure: struct {
            PackageOrganization string
            InterfaceDesign    string
            ErrorHandling      string
        }{
            PackageOrganization: "Small, focused packages with clear responsibilities",
            InterfaceDesign:     "Small interfaces, composition over inheritance",
            ErrorHandling:       "Use error wrapping, provide context",
        },
        Documentation: struct {
            Required []string
            Style    string
        }{
            Required: []string{
                "Package purpose",
                "Interface contracts",
                "Error scenarios",
                "Usage examples",
            },
            Style: "Explain why, not what",
        },
        Patterns: struct {
            Interface string
            Error    string
            Handler  string
        }{
            Interface: `
                // Agent represents an autonomous agent in the system
                type Agent interface {
                    // Process handles incoming tasks and returns results
                    // It may return ErrInvalidTask if the task cannot be processed
                    Process(ctx context.Context, task Task) (Result, error)

                    // Status returns the current agent status
                    Status() AgentStatus
                }
            `,
            Error: `
                // Example error handling pattern
                if err != nil {
                    return fmt.Errorf("processing task %s: %w", task.ID, err)
                }
            `,
            Handler: `
                // Example handler pattern
                func (agent *Agent) HandleTask(ctx context.Context, task Task) (Result, error) {
                    // Pre-conditions
                    if err := task.Validate(); err != nil {
                        return Result{}, fmt.Errorf("invalid task: %w", err)
                    }

                    // Core logic
                    result, err := agent.process(ctx, task)
                    if err != nil {
                        return Result{}, fmt.Errorf("processing task: %w", err)
                    }

                    // Post-conditions
                    if err := result.Validate(); err != nil {
                        return Result{}, fmt.Errorf("invalid result: %w", err)
                    }

                    return result, nil
                }
            `,
        },
    },

    AIProtocols: struct {
        BeforeModifying []string
        DuringImplementation []string
        Communication struct {
            Required      []string
            Clarification struct {
                When []string
                How  string
            }
        }
    }{
        BeforeModifying: []string{
            "Understand full context",
            "Identify minimal change set",
            "Verify interface compliance",
            "Plan rollback strategy",
        },
        DuringImplementation: []string{
            "Follow Go idioms and patterns",
            "Maintain interface contracts",
            "Document changes inline",
            "Handle all error cases",
        },
        Communication: struct {
            Required      []string
            Clarification struct {
                When []string
                How  string
            }
        }{
            Required: []string{
                "Explicit assumptions",
                "Clear limitations",
                "Specific questions",
                "Validation needs",
            },
            Clarification: struct {
                When []string
                How  string
            }{
                When: []string{
                    "Ambiguous requirements",
                    "Missing context",
                    "Multiple approaches possible",
                    "High-risk changes",
                },
                How: "Ask specific, targeted questions about interfaces and behaviors",
            },
        },
    },

}

// Example validation function
func ValidateChange(change struct {
Type string
Files []string
Description string
}) error {
// Implementation would verify change against guidelines
return nil
}

// Example error creation function
func CreateError(code string, message string, context error) error {
if context != nil {
return fmt.Errorf("%s: %s: %w", code, message, context)
}
return fmt.Errorf("%s: %s", code, message)
}
cap'n proto
css
dockerfile
go
golang
html
javascript
mermaid
+4 more

First seen in:

TheApeMachine/amsh

Used in 1 repository