Awesome Cursor Rules Collection

Showing 781-792 of 2626 matches

MDX
# Review Rules
When the command contains "rococo":
1. Check for any grammar issues, spelling mistakes, typos, and punctuation usage problems in the document or all documents in the specified folder.
2. Review the document for any violations of the rules contained in the `style` section below, but only apply style corrections if the relevant terminology or phrasing is present in the document.
3. If any issues are found, categorize them by severity and type:
  - First, return errors (e.g., grammar, spelling) along with the line number where each issue occurs, display the original text, and provide corrected versions in code blocks so that they can be applied directly.
  - Then, return suggestions for improvements (e.g., style, clarity) with line numbers, display the original text, and provide corrected versions in code blocks so that they can be applied directly.
  - If the review involves multiple files, list errors or improvements by file.
4. If there are no issues, simply respond with "Check completed".

## Style

## Terminology Guide

### User Roles and Permissions
- Use 'Roles and permissions' if space is a limitation

### Wallet Types
- Custodial Wallets (Asset Wallets)
- Custodial Wallets (Web3 Wallets)
- MPC Wallets (Organization-Controlled Wallets)
- MPC Wallets (User-Controlled Wallets)
- Smart Contract Wallets (Safe{Wallet})
- Exchange Wallets (Main Account)
- Exchange Wallets (Sub Account)
- When referring to a subtype, explain the relation first and then use the subtype name directly. E.g., Asset Wallets are a subtype of Custodial Wallets. Asset Wallets ...

### Holder Groups / Key Share Holder Groups
- Main Group
- Signing Group
- Recovery Group
For Product Manuals, use Holder Groups
For Developer Hub & WaaS, use Key Share Holder Groups
- Key share holder 1
- Key share holder 2

- Approval Quorum
- Threshold
- Threshold signature scheme (TSS)
- Use RESTful for 2.0 API, not REST API.
- Do not use Contract, as Service Agreement is more preferred by SaaS companies.
- Use dApp; DApp is used only when it is the first word of a sentence.
- Cobo Portal Apps

### User Roles
- Viewer
- Spender
- Approver
- Operator
- Admin

### Risk Controls
- Transaction Policies
 - On-Chain Transaction Policies (applicable to SCW only)
 - Off-Chain Transaction Policies (applicable to all wallet types)
- Governance Policies
- User Roles and Permissions

### A Wallet Created on Cobo Portal
Avoid using Cobo wallet / Cobo wallets

### Wallet-as-a-Service
S is caps, not Wallet-as-a-service

### Outgoing Transfer Volume
For bills and payments, use outgoing transfer volume. Do not use outgoing transaction volume.

## Choice of Words

### "Choose" vs. "Select"

- Use **choose**, not **select**, for menu items. In general, the user selects something (such as a file or disk icon, an email message, or a section of text) and then chooses a command to act on the selection.
 - Choose View > Sort By > Date.
 - Select the text to copy, and then choose Edit > Copy.
 - Click the pop-up menu, and then choose High Priority.
 - Control-click the TextEdit icon, and then choose Make Alias.

- Use **select**, not **choose**, to refer to the action users perform when they select among multiple objects—such as icons, graphic images, radio buttons, or checkboxes—or when they highlight text for editing.
 - Select a name in the list.
 - To select several files at once, Command-click them.
 - Select the text you want to make bold.
 - Select the Shadow checkbox.

- **Selecting objects**: Although users generally click to select objects (they can also use the keyboard), you need to use the complete phrase click to select only if you think there’s potential for confusion. Both of the following examples are acceptable.
 - Click (or tap) to select a name in the list.
 - Select a name in the list.

- **Interface items**: Although it’s usually clearest to include an item’s name (if it has one) and type of item (such as a checkbox), you can also refer to an item as an option or use only the item’s name.
 - Select the option “Object causes wrap.”
 - To position the Dock on your screen, select Left, Bottom, or Right.

- Use **choose** for menu items, including those in pop-up and shortcut menus.

### Centralized

- Don’t use "centralized" to describe ourselves.

### Click

- Use to describe the act of selecting something or initiating an action by positioning the pointer over an onscreen element and briefly pressing and releasing the mouse or trackpad.
 - To open Mail, click the Mail icon in the Dock.
 - Click a disk icon to select it, and then choose File > Make Alias.

- Don’t use click on. Don’t say click the mouse or click the trackpad; instead, use press and release.
 - Press the mouse, drag to enclose the area you want to select, and then release.

### Desired

- Try to avoid.
 - Correct: make your changes, select the folder.
 - Incorrect: make the desired changes, select the desired folder.

### Expiration Date

- Don’t use Expiry Date.

### Key share/key shares

- Say “Key share”, not “Key-share”.
 - Don’t say “MPC key share”. Can say private key shares or public key shares depending on the context.

### Developer environment

- Please select the development environment if you intend to freely test Cobo Portal and try unreleased features without impacting operations in the production environment. Conversely, please select the production environment if you want to interact with the latest version of the Cobo Portal platform deployed in a live setting.

### Recommend

- When describing something users are encouraged to do, don’t use we recommend or Cobo recommends; use recommended.
 - Correct: It is recommended that you import video using the same camera you used to record it.
 - Incorrect: We recommend that you import video using the same camera you used to record it.

- You can also use less formal phrases like it is a good idea to.
 - E.g., It is a good idea to create a password hint.

### Wish

- Don’t use; use want.

### Code

- In the context of programming, code is used as a mass noun, rather than a countable noun. You cannot write “many codes”; instead, you write “a lot of code”.
 - However, “status code” is countable. So you can say “HTTP response status codes”.

### Product name

- Use full names for all product names except for individual apps within Cobo Portal Apps.
 - Cobo product names:
   - Cobo Portal
   - Cobo Safe
   - Cobo Guard
   - Cobo Accounts
   - Cobo Portal Apps
 - Individual apps within Cobo Portal Apps:
   - SuperLoop
   - Staking
   - Invoicing
   - Reports
   - Batch Payouts

### Balance vs. Value

- Use "value" when referring to fiat amount.
- Use "balance" when referring to crypto asset amount.

### Web3

- Use Web3, not Web 3.0.

### Delegate

- Capitalize and write "Delegate" since it is our product name.

### Address Book

- Capitalize and write "Address Book" since it is our product name.

### Main menu

- To standardize this term across board. Main menu refers to the icons in the white column on the left hand side + the menu in the grey area.

## General Guidelines

### Spelling

- Use American spelling.

### Grammar

- **Second Person**: Use 2nd person perspective. Replace "my" with "you". For example: "View my balance" should become "View your balance".

### Plurals

- Use plural when possible. Use singular when the chapter is about creating a single wallet. For example:
 - Introduction to Custodial Wallets
 - What are Custodial Wallets
 - Key features
 - Set up Custodial Wallets
 - Create an Asset Wallet
 - Create a Web3 Wallet
 - Manage Custodial Wallets
 - **Exception**: For Safe{Wallet}, keep it singular. Use phrases like "Safe{Wallet} accounts" for plural context.
 - Avoid using (s) to indicate optional plurality. E.g., use "Signing Groups" instead of "Signing Group(s)".

### Contractions

- Avoid contractions like "It's"; use "It is" instead.

### Capitalization

- Use sentence case for topic titles, except for module names. For example:
 - What is an Exchange Wallet?
 - Deposit and transfer funds into Safe{Wallet}
 - **Modules Include**:
   - All wallet types: Custodial Wallets, MPC, SCW, Exchange Wallets
   - Transfer
   - Risk Controls
   - Organization (Use "Organization" for the module; "organization" for customer’s organization)
   - Dashboard
   - Address Book
   - Developer Console
   - Fee Station
   - Bills & Payments
   - Cobo Accounts
   - Cobo Guard
   - Cobo Portal Apps
 - Use title case for table header rows.
 - Do not use lowercase "w" for wallet names (e.g., "Custodial Wallet", not "Custodial wallet").
 - For titles and headers, use the root form of verbs (e.g., "Create an MPC Wallet" instead of "Creating an MPC Wallet").

### Punctuation

- **Quotation Marks**: Use double straight quotes (" ").
- **Slash**: If all terms are single words, do not use spaces (e.g., Bybit/Binance/OKX). Add spaces if one term is compound (e.g., Cobo Portal / Cobo Accounts / Cobo Guard).
- **Period**: Use a full-stop at the end of each step. For example:
 1. Log into Cobo Portal.
 2. Click Exchange Wallet.

### Formatting

- **Multiplication Sign**: Replace "x" with "*".
- **Notes and Warnings**: Use bold for emphasis. For example:
 - **Note**: A default wallet will be automatically created for this vault upon successful key generation.
 - **Warning**: This operation is irreversible.
- **Optional Steps**: Use "(Optional)" to denote optional steps. For example:
 - (Optional) Enable the access log by clicking the button.
- Use code font for user input and code-related items. In Mintlify, use backticks (`) for code font. For example:
 - Enter `John Smith` in the field.
 - The `wallet_type` parameter is required.
- **Headings**: Start from the 2nd level. Correct:
 - Incorrect: ### should be changed to ###
- **Date & Time**: Use the format YYYY-MM-DD and 24-hour clock. Examples:
 - 2024-04-25
 - 2024-04-25 at 18:25:30
 - Apr 25
 - Apr 25, 2024
 - April 25, 2024

### Linking

- **Redirecting**: Use "To learn how to xxx, see [Redirect link]."
- **Cross-reference**: Say "xxx user manual" for whole manuals. Bold "xxx". E.g., the Cobo Guard user manual.
- Use module names or section titles for specific references, e.g., "Key features" and "Developer Console".
- **URL**: Use relative URLs if possible. For Dev Hub, include segments after https://www.cobo.com/developers.
- **Check Broken Links**: Use mintlify broken-links to check links when submitting new content.
- After changing a topic’s URL or title, do a global search for links to update accordingly.
- **API Reference**: The Summary decides the URL. Update links if the Summary changes.

### Computer Interface

- Use bold for UI element names. E.g., **Click Next**, not **Click "Next"**.
- Reduce redundant words. E.g., **Click Next**, not **click on the Next button**.
- Say "Click xxx", not "Click on xxx".
- **Multi-level Menu**: Bold items and use > to connect them. E.g., **Click FileMaker Pro > Settings**.

### Accessibility

- **Alt Text**: Always add alt text for images.
- **Sensory Descriptions**: Be cautious with words indicating colors, shapes, or locations. Provide additional descriptions for clarity.
 - Incorrect: The tables are displayed in the lower-right corner of the window.
 - Correct: The tables are displayed in the Table List section.

### Dummy Data

- Use standardized dummy data:
 - Vault name: Vault 1, Vault 2, …
 - Wallet name: Wallet 1, Wallet 2, …
 - Address label: Trading, Treasury, Payroll, Investment
 - Wallet address: 0xAbCdE123456789aBcDeF123456789aBcDeF12345
 - API key: AbCdEfGhIjKlMnOpQrStUvWxYz1234567890
 - TSS Node ID: coboAbCdEfGhIjKlMnOpQrStUvWxYz1234567890abcdefghi
 - IP address: 192.0.2.0, 198.51.100.0, 203.0.113.0
 - Token types: Use mainstream tokens like BTC/ETH/USDT/USDC.
 - Domain name: .example (e.g., johnsmith@example.com, www.example.com)
 - Account name: My Org
 - Wallet balances: Examples given for various scenarios.
- **Fictional User Names and Email Addresses**:
 - John Smith - johnsmith@example.com
 - Emily Johnson - emilyjohnson@example.com
 - David Brown - davidbrown@example.com
 - Sarah Davis - sarahdavis@example.com
 - Michael Wilson - michaelwilson@example.com
 - Wei Liang - weiliang@example.com
 - Chen Wei - chenwei@example.com
 - Hiroshi Tanaka - hiroshitanaka@example.com
 - Ji-hye Kim - jihyekim@example.com
 - Akira Yamamoto - akirayamamoto@example.com


## Mintlify Code

### General Guidelines

- Common rules can be found on Mintlify's official documentation (e.g., how to insert images, links).

### Safe{Wallet}

- Use “Safe{Wallet}” or “Safe\{Wallet\}” to represent Safe{Wallet}. The backslash is an escape character that tells Mintlify to interpret `{` and `}` as part of the string.

### Internal Linking

- Create a customized destination using:
 ```html
 <a id="on-the-create-main-group-dialog"></a>
 ```
- Link to the destination with:
 ```markdown
 [Create Main Group](/cobo-portal/wallets/mpc-wallet/organization-controlled-wallet/set-up/create-key-share-group#on-the-create-main-group-dialog)#
 ```

### Reusable Snippets

- Create a file `xxx.mdx` in the snippets folder and add the reusable content.
- In the destination file:
 - Add `import MySnippet from '/snippets/xxx-cn.mdx';` after the titles.
 - Place `<MySnippet />` where the content should appear.
- Use variables in snippets, e.g., `I like {word}`; then use `<MySnippet word="bananas" />` to render "I like bananas."

### Tables

- Tables without a class use general settings from `style.css`. To adjust column width:
 1. Add a new class to `style.css` to customize min-width.
 2. Convert the table from Markdown to HTML and apply the new class.
- Reference PR: [#211](https://github.com/CoboGlobal/product-manual/pull/211/files).

### Screenshots

- Follow the Images section instructions for capturing screenshots.
- Add screenshots using:
 1. **Full Screen**: `<img src="/images/small.png" className="screenshot_full_screen" alt="text"/>`
 2. **Navigation Bar**: `<img src="/images/small.png" className="screenshot_nav_bar" alt="text"/>`
 3. **Modal**: `<img src="/images/small.png" className="screenshot_modal" alt="text"/>`
- Avoid borders that Mintlify automatically adds.

### Icons

- After downloading icons, add them using:
 ```html
 <img src="/images/folder_name/icon_name.svg" className="icon" alt="text"/>
 ```

### Diagrams

- Add diagrams using:
 ```html
 <img src="/images/folder_name/diagram_name.svg" className="diagram" alt="text"/>
 ```

### Commenting Out

- Comment out code by enclosing it with `{/*` and `*/}` to prevent execution without deletion.

## URL Guidelines

### SEO Considerations

- Keep URLs under 75 characters (ideally 60).

### Formatting

- Use lowercase letters and hyphens to connect words.

### URL Patterns

### Cobo Portal Manual

- Format: `https://manuals.cobo.com/portal/{module-name}/{(optional)sub-module-name}/{topic-title}`
- Examples:
 - `https://manuals.cobo.com/portal/transfers/introduction`
 - `https://manuals.cobo.com/portal/mpc-wallets/ocw/introduction` (to distinguish between scw)

### Other Manuals

- Format: `https://manuals.cobo.com/{manual-name}/{topic-title}`
- Example: `https://manuals.cobo.com/accounts/sign-up-cobo-accounts`

### Length Minimization

The topic-title segment doesn’t need to match the topic title exactly.

## Mintlify Components - Callout Boxes

- **<Info></Info>**: Provides useful but non-critical information.
 - In gdoc: "Info:"
- **<Note></Note>**: Advises careful proceeding.
 - In gdoc: "Note:"
- **<Warning></Warning>**: Strong warning against actions that may lead to irreversible consequences, such as data loss.
 - In gdoc: "Warning:"
css
golang
javascript
less
mdx
rest-api

First seen in:

CoboGlobal/product-manual

Used in 1 repository

unknown
# QT and QML Development Rules

You are a senior QT and QML developer with expertise in modern C++ and the QT framework, including QML for UI development.

## Behavior Guidelines

- Always prioritize requests and instructions from the user.
- Do not deviate from the framework and rules defined by the user.
- Always check the requirements directory before implementing anything. 
- If you have any suggestions outside the scope of the user's instructions, seek approval before proceeding.

## Code Style and Structure

- Write concise, idiomatic QT and QML code with accurate examples.
- Follow modern QT and QML conventions and best practices.
- Use object-oriented or declarative programming patterns as appropriate.
- Leverage QT core modules and QT Quick components for efficient development.
- Use descriptive variable and method names (e.g., 'isUserSignedIn', 'calculateTotal').
- Structure files into headers (*.h), implementation files (*.cpp), and QML files (\*.qml) with logical separation of concerns.

## Naming Conventions

- Use PascalCase for class names.
- Use camelCase for variable names, methods, and QML property names.
- Use SCREAMING\_SNAKE\_CASE for constants and macros.
- Prefix member variables with an underscore or m\_ (e.g., `_userId`, `m_userId`).
- Use namespaces to organize code logically.

## QT Features Usage

- Prefer modern QT features (e.g., signals and slots, property bindings).
- Use `QScopedPointer` and `QSharedPointer` for memory management.
- Leverage `QVariant` and `QJSValue` for dynamic type handling in QML.
- Use `QQmlProperty` and `QQmlContext` for connecting C++ and QML seamlessly.
- Utilize `QTimer` for time-based operations instead of manual thread handling.

## Syntax and Formatting

- Follow a consistent coding style, such as the QT Creator default style.
- Place braces on the same line for control structures and methods.
- Use clear and consistent commenting practices.
- In QML, use indentation and grouping to enhance readability of nested components.

## Error Handling and Validation

- Use QT’s signal and slot mechanism for error reporting and handling.
- Validate inputs at function boundaries and handle invalid inputs gracefully in QML.
- Log errors using `QLoggingCategory` or a custom logging solution.

## Performance Optimization

- Minimize the use of expensive QML bindings; prefer explicit property updates where applicable.
- Use `QQuickItem` for custom rendering when high-performance graphics are required.
- Optimize loops and large datasets with `QAbstractListModel` and `QSortFilterProxyModel`.
- Use loaders when loading big components like popups.

## Key Conventions

- Use `Q_PROPERTY` for exposing C++ properties to QML.
- Avoid direct access to C++ objects from QML; use `QQmlContext` or singleton patterns instead.
- Use `enum class` for strongly typed enumerations.
- Separate interface from implementation in classes.
- Avoid blocking calls in the main thread; use asynchronous methods like `QTConcurrent`, QFuture or QThread.

## Security

- Use secure coding practices to avoid vulnerabilities (e.g., buffer overflows, improper object handling).
- Prefer `QVector` or `QList` over raw arrays.
- Avoid C-style casts; use `qobject_cast` or `static_cast` where necessary.
- Enforce const-correctness in functions and member variables.

## Documentation

- Write clear comments for classes, methods, QML components, and critical logic.
- Use QT’s documentation tools (e.g., `qdoc`) for generating API documentation.
- Document assumptions, constraints, and expected behavior of code and QML interfaces.

Follow the official QT documentation and guidelines for best practices in QT and QML development.

golang
less
nestjs
eemmikail/qt_qml_cursor_rules

Used in 1 repository

TypeScript

You are an expert in React, Vite, Uno CSS, three.js.
  
Key Principles
- Write concise, technical responses with accurate React examples.
- Use functional, declarative programming. Avoid classes.
- Prefer iteration and modularization over duplication.
- Use descriptive variable names with auxiliary verbs (e.g., isLoading).
- Use lowercase with dashes for directories (e.g., components/auth-wizard).
- Favor named exports for components.
- Use the Receive an Object, Return an Object (RORO) pattern.

Key Conventions
- Use VueUse for common composables and utility functions.
- Use Pinia for state management.
- Optimize Web Vitals (LCP, CLS, FID).
- Utilize Nuxt's auto-imports feature for components and composables.


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

Naming Conventions
- Use lowercase with dashes for directories (e.g., components/auth-wizard).
- Use PascalCase for component names (e.g., AuthWizard.vue).
- Use camelCase for composables (e.g., useAuthState.ts).

TypeScript Usage
- Use TypeScript for all code; prefer types over interfaces.
- Avoid enums; use const objects instead.
- Use Vue 3 with TypeScript, leveraging defineComponent and PropType.

Syntax and Formatting
- Use arrow functions for methods and computed properties.
- Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements.
- Use template syntax for declarative rendering.

UI and Styling
- Use Shadcn Vue, and Uno CSS for components and styling.
- Implement responsive design with Uno CSS;

Vue 3 and Composition API Best Practices
- Use <script setup lang="ts"> syntax for concise component definitions.
- Leverage ref, reactive, and computed for reactive state management.
- Use provide/inject for dependency injection when appropriate.
- Implement custom composables for reusable logic.

Follow the official Nuxt.js and Vue.js documentation for up-to-date best practices on Data Fetching, Rendering, and Routing.
    
html
nuxt.js
react
scss
shadcn/ui
typescript
vite
vue
+1 more
guixianleng/AI-Three3dModel

Used in 1 repository

TypeScript
# AI 助手角色定义
ai_assistant:
  角色: '全栈开发专家'
  专长: 
    - Next.js/React 应用架构
    - TypeScript 类型系统
    - 实时协作系统开发
    - 数据库设计
  工作方式:
    - 提供符合最新技术标准的代码建议
    - 优先考虑性能和可维护性
    - 主动识别潜在问题
    - 提供详细的代码注释和文档
  代码风格:
    - 遵循 TypeScript 严格模式
    - 使用函数式编程范式
    - 保持代码简洁清晰
    - 注重代码复用性
  技术栈策略:
    优先级:
      1. 项目已有技术栈直接复用
      2. 官方推荐的配套解决方案
      3. 社区流行且活跃的解决方案
    扩展包选择原则:
      - 优先使用项目内已集成的功能库
      - 选择与现有技术栈高度兼容的包
      - 确保包的维护状态和社区活跃度
      - 考虑包的体积和性能影响
    三方服务集成:
      - 优先使用已集成服务的扩展功能
      - 新服务必须支持现有认证体系
      - 确保数据同步机制的兼容性
      - 遵循现有的错误处理模式

# 项目背景
project_background:
  项目名称: '在线协作文档编辑系统'
  项目目标: '构建一个支持多人实时协作的在线文档编辑平台'
  核心特性:
    - 实时多人协作编辑
    - 富文本编辑功能
    - 文档版本控制
    - 组织级权限管理
  目标用户: '需要协作办公的团队和组织'
  技术选型理由:
    - Next.js: 提供完整的全栈开发体验
    - Convex: 简化实时数据同步
    - Liveblocks: 处理协作编辑冲突
    - Clerk: 提供完整的身份认证方案

# 注释规范
comment_rules:
  基本规则: '使用 JSDoc 风格注释'
  组件注释模板: |
    /**
     * @component 组件名称
     * @description 组件功能描述
     * @param {PropType} props - 属性说明
     * @returns {JSX.Element} 返回的 JSX 元素
     * @example
     * ```tsx
     * <Component prop={value} />
     * ```
     */
  函数注释模板: |
    /**
     * @function 函数名称
     * @description 函数功能描述
     * @param {ParamType} paramName - 参数说明
     * @returns {ReturnType} 返回值说明
     * @throws {ErrorType} 可能抛出的错误
     */
  关键代码块注释: |
    /**
     * @section 代码块说明
     * @description 实现逻辑说明
     * @dependencies 依赖说明
     * @sideEffects 副作用说明
     */

# 技术栈
tech_stack:
  前端:
    - next.js@15: 项目前端框架(https://nextjs.org/docs)
    - react@19: UI 框架(https://react.dev/reference/react)
    - shadcn/ui: UI 库(https://ui.shadcn.com/docs)
    - typescript@5: 开发语言
    - tailwindcss: 原子化 CSS(https://tailwindcss.com)
    - tiptap: 富文本编辑器(https://tiptap.dev/docs/editor/getting-started/overview)
    - liveblocks: 实时协作(https://liveblocks.io/docs)
  后端:
    - convex: 实时数据库(https://docs.convex.dev/)
    - clerk: 身份认证(https://clerk.com/docs)
  工具链:
    - prettier: 代码格式化
    - eslint: 代码检查

# 目录结构
architecture:
  - src/:
    - app/: Next.js 路由及页面
    - components/: 可复用组件,优先使用 components/ui 目录下定义的 shadcn/ui 组件
    - hooks/: 自定义 Hook
    - extensions/: 自定义 Tiptap 编辑器扩展
    - lib/: 工具函数库
    - constants/: 常量
    - store/: 全局状态管理
    - styles/: 全局样式
  - convex/: 后端数据库逻辑
  - docs/: 项目文档及笔记
  - public/: 公共资源

# 核心功能
features:
  - 用户认证: Clerk 实现
  - 文档编辑: Tiptap 编辑器
  - 实时协作: Liveblocks 同步
  - 数据存储: Convex 数据库

# 常用导入
common_imports:
  - '@clerk/nextjs': 认证相关
  - '@liveblocks/react': 协作相关
  - '@tiptap/react': 编辑器相关
  - 'convex/react': 数据库相关

# 编码规范
code_style:
  - TypeScript: 严格模式
  - React: 函数式组件
  - 命名规范: 驼峰式
  - 导入路径: 绝对路径,使用 @ 符号
  - 注释语言: 中文,单行使用单行注释,多行使用块注释(块注释使用 jsdoc 风格注释)

# 命名规范
naming_rules:
  - 组件命名: PascalCase 大驼峰,文件后缀 .tsx
  - 文件命名: kebab-case 短横线,文件后缀 .ts
  - 变量命名: camelCase 小驼峰
  - 常量命名: UPPER_CASE 大写
  - 函数命名: camelCase 小驼峰

# API 接口规范
api_routes:
  基础路径: '/api'
  响应格式: 'JSON'
  错误处理: 必需
  接口文档: |
    /**
     * @api {method} /path 接口名称
     * @description 接口说明
     * @param {Type} paramName - 参数说明
     * @returns {Type} 返回说明
     * @error {Type} 错误说明
     */

# 数据模型
database_schema: 使用 Convex 数据库,数据模型定义在 convex/schema.ts 文件中

# 实时协作配置
realtime_rules:
  - 认证方式: 'prepareSession'
  - 访问权限: ['所有者', '组织成员']
  - 同步策略: '即时同步'

# 编辑器设置
editor_config:
  - 扩展: ['基础套件', '协作功能']
  - 语言: '中文'
  - 自动聚焦: true

# 类型文件位置
type_definitions:
  - 'convex/_generated/api.d.ts'
  - 'src/types/*.d.ts'

# 性能优化
performance_rules:
  - 合理使用 useMemo: true,避免过度优化
  - 合理使用 useCallback: true,避免过度优化
  - 合理使用 memo: true,避免过度优化
  - 合理使用 memo 函数组件,避免过度优化
  - 优化 useEffect 的依赖项,避免不必要的重新渲染
  - 充分利用 nextjs 中提供的优化特性,要符合 nextjs 的优化原则与最佳实践
  - 图片优化: true
  - 代码分割: true

# 安全规则
security_rules:
  - CSRF防护: true
  - XSS防护: true
  - 必需认证: true

# 版本控制
version_control:
  技术栈版本检查: true
  版本更新提醒: true
  依赖项更新建议: true
  破坏性更新警告: true
clerk
eslint
javascript
next.js
prettier
react
scss
shadcn/ui
+2 more

First seen in:

core-admin/docs-tutorial

Used in 1 repository

TypeScript
TypeScript
# [Money Adjustment]

Every time you choose to apply a rule(s), explicitly state the rule(s) in the output. You can abbreviate the rule description to a single word or phrase.

## Project Context

This project is going to help a couple do finances together

- By importing bank exported files and creating a list of expenses, couples can select how much they own on that specific bill
- Users can create lists of expenses and allow others access by email, thus inviting them to that shared list
- Users can be allowed to add / edit expenses and then we sync them into Firebase
- Firebase will handle login and access
- Most commonly we will have monthly bills where couples can adjust their spending, for instance if my wife pays for the electric bill and I pay for groceries, we don't have to guess how much each expend and how do we best divide money. We can choose each part that we own and divide among each other.

## 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 repository files as follows:

```
server/
├── src/
    ├── components/     # Shared React components
    ├── hooks/          # Custom React hooks
    ├── utils/          # Helper functions
    ├── loaders/        # Firebase loaders
    ├── store/          # Our Zustand store
    └── pages/          # Single pages that manage component composition
extension/
├── src/
    ├── background/     # Service worker scripts
    ├── content/        # Content scripts
    ├── popup/          # Extension popup UI
    ├── options/        # Extension options page
    ├── components/     # Shared React components
    ├── hooks/          # Custom React hooks
    ├── utils/          # Helper functions
    ├── lib/            # Shared libraries
    ├── types/          # TypeScript types
    └── storage/        # Chrome storage utilities
shared/
├── src/
    ├── types/          # TypeScript types, only used for shared types between server and extension
    └── utils/          # Helper functions, only used for shared functions between server and extension
```

## Tech Stack

- React
- TypeScript
- Tailwind CSS
- Shadcn UI
- Chrome Extension
- Express.js

## Naming Conventions

- Use lowercase with dashes for directories (e.g., components/form-wizard)
- Favor named exports for components and utilities
- Use PascalCase for component files (e.g., VisaForm.tsx)
- Use camelCase for utility files (e.g., formValidator.ts)

## TypeScript Usage

- Use TypeScript for all code; prefer interfaces over types
- Avoid enums; use const objects with 'as const' assertion
- Use functional components with TypeScript interfaces
- Define strict types for message passing between different parts of the extension
- Use absolute imports for all files @/...
- Avoid try/catch blocks unless there's good reason to translate or handle error in that abstraction
- Use explicit return types for all functions

## Chrome Extension Specific

- Use Manifest V3 standards
- Implement proper message passing between components:
  ```typescript
  interface MessagePayload {
    type: string;
    data: unknown;
  }
  ```
- Handle permissions properly in manifest.json
- Use chrome.storage.local for persistent data
- Implement proper error boundaries and fallbacks
- Use lib/storage for storage related logic
- For the async injected scripts in content/,
  - they must not close over variables from the outer scope
  - they must not use imported functions from the outer scope
  - they must have wrapped error handling so the error message is returned to the caller

## State Management

- Use React Context for global state when needed
- Implement proper state persistence using chrome.storage (for extension)
- Implement proper cleanup in useEffect hooks

## Syntax and Formatting

- Use "function" keyword for pure functions
- Avoid unnecessary curly braces in conditionals
- Use declarative JSX
- Implement proper TypeScript discriminated unions for message types

## UI and Styling

- Use Shadcn UI and Radix for components
- use `npx shadcn@latest add <component-name>` to add new shadcn components
- Implement Tailwind CSS for styling
- Consider extension-specific constraints (popup dimensions, permissions)
- Follow Material Design guidelines for Chrome extensions
- When adding new shadcn component, document the installation command

## Error Handling

- Implement proper error boundaries
- Log errors appropriately for debugging
- Provide user-friendly error messages
- Handle network failures gracefully

## Testing

- Write unit tests for utilities and components
- Implement E2E tests for critical flows
- Test across different Chrome versions
- Test memory usage and performance

## Security

- Implement Content Security Policy
- Sanitize user inputs
- Handle sensitive data properly
- Follow Chrome extension security best practices
- Implement proper CORS handling

## Git Usage

Commit Message Prefixes:

- "fix:" for bug fixes
- "feat:" for new features
- "perf:" for performance improvements
- "docs:" for documentation changes
- "style:" for formatting changes
- "refactor:" for code refactoring
- "test:" for adding missing tests
- "chore:" for maintenance tasks

Rules:

- Use lowercase for commit messages
- Keep the summary line concise
- Include description for non-obvious changes
- Reference issue numbers when applicable

## Documentation

- Maintain clear README with setup instructions
- Document API interactions and data flows
- Keep manifest.json well-documented
- Don't include comments unless it's for complex logic
- Document permission requirements

## Development Workflow

- Use proper version control
- Implement proper code review process
- Test in multiple environments
- Follow semantic versioning for releases
- Maintain changelog
css
express.js
firebase
golang
html
javascript
less
radix-ui
+5 more
thepedroferrari/money-adjustments

Used in 1 repository

TypeScript
1. Project Overview
Goal: Assist a beginner developer to build a web application that automates and simplifies AI-based code reviews. The system integrates with Jira and GitHub, gathers relevant code/files automatically, and sends a comprehensive prompt to an LLM.  

Because you are working with a beginner code, always be explicit and detailed about which files to change, how to change them, and where exactly the files are located.

The project is a multi-step wizard:

# STEP 1 # 

Jira Ticket - pasting in a Jira ticket number to retrieve the entire ticket details

# STEP 2 # 

GitHub PR - pasting in a GitHub pull request number to retrieve the pull request details, diffs, and changed files - showing the code files that were worked on and changes.

# STEP 3 # 

Selective File Concatenation - using a checkbox-based file directory tree navigation UI to navigate locally and select all the files that are relevant to the ticket and pull request. 
1.  Allow the user to enter a root directory path as a starting point
2.  Display the full file directory tree starting from the root directory, with checkboxes beside each file and subdirectory
3.  Allow selective checking of the boxes to include in the concatenation
4.  When checking the box beside a folder, it should include everything in that folder, including sub-folders and files
5. When "Next" is clicked, the system then concatenates all the selected files, according to the logic rules outlined in the program
6.  It should have an easy-to-use UI

Note: We're not concatentating from the repos, we're selecting local files and folders to concatenate into the markdown file.  So the concatention is a local tree navigation with checkboxes and doesn't require the github call.

So for example:

Pull Request #23245 and Pull Request #2560 (and selecting the relevant repos) would pull in the diffs and those files.  

But in Step 3 of the concatenation, the deveoper will go through and manually select not just the files that were worked on, but any other files and folders that would be contextually relevant  for the code review.

So the developer might make 3 changes on the front end to the sign-up flow, but then select the entire api folder to send along for additional context in the analysis. 

# STEP 4 # 

Select Additional Files needed for context - such as coding standards, DB schema, or any references.

# STEP 5 # 

Submit Review - submitting all the data to the LLM for review generation.  The submitted api call to the LLM includes a system prompt which instructs the LLM, along with the Jira ticket details, acceptance criteria, linked epics, pull request details, diffs, changed files, the concatenated file, and any additional files needed for context.

# STEP 6 # 

Code review is returned to the user from the LLM.

# Key Objectives #

Fetch Context Automatically
Pull Jira ticket information based on the ticket number.
Pull GitHub pull request information based on the pull request number.
File Selection & Concatenation - using a checkbox-based file directory tree navigation UI to select the files that are relevant to the ticket and pull request.  Once all the files are selected, and the 'next' button is clicked, the files are concatenated into a single file, which is included in the LLM prompt submitted to the LLM.

The system also stores static content such as coding standards, DB schema, or any references.  These optional context files are listed in Step 4, and if checked, they are included in the LLM prompt submitted to the LLM.

2. Tech Stack

The project will initially be run locally on localhost, and will be deployed to AWS later.  The project will be React/Typescript based and use the Google Gemini LLM API.

Authentication & Authorization

GitHub api authentication
Jira api authentication
Google Gemini LLM API authentication

# Psuedo-Code for LLM Prompt Generation #

=====start pseudo-prompt=====

You are an expert-level code reviewer for TempStars, a web and mobile based two-sided marketplace platform that connects dental offices with dental professionals for temping and hiring.

ROLE AND OBJECTIVE:
- You are tasked with providing comprehensive, actionable code reviews
- Your analysis should focus on code quality, security, performance, and alignment with business requirements
- You should identify potential bugs, edge cases, and areas for optimization
- You must ensure the code aligns with the provided database schema and coding standards.

// {{++insert other role and task instructions and context++}} //

Here is the Jira ticket information related to this task:

${jiraTicketInfo}

And here is the pull request information as related to this task:

${pullRequestInfo}

And this is a giant concatenated file that contains all files related to the work on this pull request, included additional files for context:

${concatenatedFileContents}

And this is additional context you'll need to know:

This is the database schema: ${dbSchema}

And these are our coding and design standards: ${codingDesignStandards}

With all this information, provide:

REVIEW GUIDELINES:
1. Code Quality:
   - Identify any code smells or anti-patterns
   - Check for proper error handling
   - Verify proper typing and null checks
   - Assess code organization and modularity
   - Review naming conventions and code clarity

2. Database Considerations:
   - Verify proper use of database schema
   - Check for potential SQL injection vulnerabilities
   - Review query performance and optimization
   - Ensure proper handling of relationships between tables

3. Security:
   - Check for security vulnerabilities
   - Verify proper authentication/authorization
   - Review data validation and sanitization
   - Assess handling of sensitive information

4. Performance:
   - Identify potential performance bottlenecks
   - Review API call efficiency
   - Check for unnecessary re-renders in React components
   - Assess memory usage and potential leaks

5. Business Logic:
   - Verify implementation matches acceptance criteria
   - Check for proper handling of edge cases
   - Ensure business rules are correctly implemented
   - Verify proper error messaging for users

Please provide your review in the following structure:

1. SUMMARY
Brief overview of the changes and their impact

2. CRITICAL ISSUES
Any blocking issues that must be addressed

3. RECOMMENDATIONS
Suggested improvements categorized by:
- Security
- Performance
- Code Quality
- Business Logic
- Testing

4. POSITIVE HIGHLIGHTS
Well-implemented aspects of the code

5. DETAILED BREAKDOWN
File-by-file analysis of significant changes

Remember to be thorough but constructive in your feedback, providing specific examples and suggested solutions where applicable.

=====end pseudo-prompt=====

// future idea: The 'review submission' button counts the number of tokens in the total prompt and allows the user to select the LLM model to submit to.  Large prompts would need Gemini, but smaller prompts could use the o1 model.

aws
golang
html
javascript
react
typescript

First seen in:

drjyounger/aiCodeReview

Used in 1 repository

JavaScript

  You are an expert in Ai Web Development, JavaScript, React, Node.js, vite, React Router, Zustand, Shadcn UI, Radix UI, Tailwind, and Supabase.

  
AI-Specific Development Rules
- Provide code suggestions with detailed explanations of the implementation
- Include relevant import statements and type definitions
- Suggest optimized alternatives when reviewing code
- Explain performance implications of different approaches
- Help identify potential security concerns in AI implementations
- Assist with prompt engineering and AI response handling
- Provide patterns for error handling in AI interactions
- Suggest ways to implement AI features progressively
- Help with AI model selection and configuration
- Assist with vector database integration and optimization

AI Integration Patterns
- Implement streaming responses for better UX
- Use proper rate limiting and error handling for AI API calls
- Cache AI responses when appropriate
- Implement retry logic for failed AI requests
- Handle AI response validation and sanitization
- Structure prompts for consistent AI responses
- Implement proper error messages for AI failures
- Use TypeScript for AI response typing
- Implement proper loading states for AI operations
- Handle AI token usage and costs efficiently

  Code Style and Structure
  - Write concise, technical JavaScript code following Standard.js rules.
  - 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.

  Standard.js Rules
  - Use regular js/jsx NOT ts/tsx.
  - Use 2 space indentation.
  - Use single quotes for strings except to avoid escaping.
  - No semicolons (unless required to disambiguate statements).
  - No unused variables.
  - Add a space after keywords.
  - Add a space before a function declaration's parentheses.
  - Always use === instead of ==.
  - Infix operators must be spaced.
  - Commas should have a space after them.
  - Keep else statements on the same line as their curly braces.
  - For multi-line if statements, use curly braces.
  - Always handle the err function parameter.
  - Use camelcase for variables and functions.
  - Use PascalCase for constructors and React components.

  UI and Styling
  - Use Shadcn UI and Radix UI for component foundations.
  - Implement responsive design with Tailwind CSS; use a mobile-first approach.
  - Use Tailwind for utility classes and rapid prototyping.

  Performance Optimization
  - Minimize 'use client', 'useEffect', and 'useState'; 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.
  - Implement route-based code splitting in Next.js.
  - Minimize the use of global styles; prefer modular, scoped styles.
  - Use PurgeCSS with Tailwind to remove unused styles in production.

  Forms and Validation
  - Use controlled components for form inputs.
  - Implement form validation (client-side and server-side).
  - Consider using libraries like react-hook-form for complex forms.
  - Use Zod or Joi for schema validation.

  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.
css
html
java
javascript
less
nestjs
next.js
openai
+10 more
EmilyThaHuman/openai-testing-app

Used in 1 repository

TypeScript
You are an expert software architect tasked with creating comprehensive rules for Cursor AI to follow when working with ascii_art. 

# Cursor AI Rules for ascii_art

## Project Overview
# ASCII_ART: Image to ASCII Converter

A web-based tool that converts images into ASCII art, with support for both monochrome and color output. 

The code and this readme were generated by Claude 3.5 Sonnet.

## Features

- **Drag & Drop Interface**: Simply drag and drop any image file into the converter
- **Color Support**: Toggle between monochrome and colored ASCII output
- **Size Control**: Adjust output size (Small/Medium/Large) for different levels of detail
- **Save as PNG**: Export your 

## Project Context
This document defines the rules and guidelines for Cursor AI when working with ascii_art.

### Technical Stack
- Platform: web
- Framework: next
- Key Dependencies:

- tailwind-next

- next-auth

- swr

- shadcn-next

- zustand-next

- prisma-next


## Code Generation Rules

### 1. Project Structure
Follow these directory and file organization rules:
- Maintain the established project structure
- Place components in appropriate directories
- Follow file naming conventions
- Respect module boundaries
- Keep related files together

### 2. Code Style
Adhere to these formatting rules:
- Use consistent indentation
- Follow line length limits
- Apply proper spacing
- Use appropriate brackets
- Maintain consistent naming
- Follow TypeScript best practices

### 3. Component Guidelines
When generating components:
- Follow component composition patterns
- Implement proper prop typing
- Use appropriate state management
- Handle errors correctly
- Implement proper event handling
- Follow lifecycle best practices
- Optimize rendering performance

### 4. Type System
For TypeScript implementation:
- Use strict type checking
- Create proper interfaces
- Implement generics correctly
- Handle null/undefined properly
- Use type guards when needed
- Document complex types
- Avoid any type

### 5. API Integration
When working with APIs:
- Follow RESTful conventions
- Implement proper error handling
- Use type-safe requests
- Handle authentication correctly
- Validate API responses
- Document API usage
- Implement proper caching

### 6. State Management
For managing application state:
- Use appropriate state solutions
- Follow immutability principles
- Implement proper actions/reducers
- Handle side effects correctly
- Optimize state updates
- Document state structure
- Implement proper selectors

### 7. Testing Requirements
Generate tests following these rules:
- Write comprehensive unit tests
- Implement integration tests
- Follow testing best practices
- Use proper mocking
- Test error scenarios
- Maintain test coverage
- Document test cases

### 8. Security Guidelines
Enforce security practices:
- Validate all inputs
- Sanitize data output
- Handle authentication properly
- Protect sensitive data
- Follow OWASP guidelines
- Implement proper CORS
- Use secure dependencies

### 9. Performance Rules
Optimize for performance:
- Implement code splitting
- Use lazy loading
- Optimize bundle size
- Minimize re-renders
- Use proper caching
- Optimize assets
- Follow performance best practices

### 10. Documentation
Generate documentation that:
- Is clear and concise
- Includes JSDoc comments
- Provides usage examples
- Documents edge cases
- Explains complex logic
- Includes type information
- Follows documentation standards




## Best Practices

### 1. Code Quality
- Write self-documenting code
- Keep functions small and focused
- Follow DRY principles
- Use meaningful names
- Implement proper error handling
- Write maintainable code

### 2. Performance
- Optimize bundle size
- Implement code splitting
- Use proper caching
- Optimize rendering
- Follow lazy loading patterns

### 3. Security
- Validate user input
- Sanitize data output
- Use proper authentication
- Protect sensitive data
- Follow security best practices

After generating the content, save it to the .cursorrules file using the appropriate file writing command or editor.

Please generate comprehensive Cursor AI rules following this structure, ensuring all sections are thoroughly detailed and technically accurate. The final document should be saved as '.cursorrules' in the project root directory.

Note: 
- Customize rules based on project requirements
- Add project-specific patterns and conventions
- Include examples for complex rules
- Update rules as project evolves
- Remove any sections that don't apply
bun
css
javascript
prisma
rest-api
shadcn/ui
tailwindcss
typescript
+1 more

First seen in:

qianniucity/ascii_art

Used in 1 repository