find-rules

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Find Rules

查找规则

This skill helps you discover and understand the specific rules, conventions, and guidelines that apply to your current task. It systematically explores project documentation to ensure compliance with project standards.
本技能可帮助你发现并理解适用于当前任务的具体规则、约定和指南。它会系统地检索项目文档,确保你遵守项目标准。

Instructions

使用说明

Follow this workflow to identify applicable rules:
遵循以下工作流来识别适用的规则:

1. Understand Context

1. 理解上下文

First, analyze the task to determine:
  • Task Type: PRD creation, Technical Spec, Feature Implementation, Refactoring, Bugfix, etc.
  • Technologies: React, Elysia, Tailwind, Drizzle, etc.
  • Aspects: Architecture, Testing, Styling, Naming, etc.
首先,分析任务以确定:
  • 任务类型:PRD 编写、技术方案设计、功能实现、重构、Bug 修复等
  • 使用技术:React、Elysia、Tailwind、Drizzle 等
  • 涉及维度:架构、测试、样式、命名等

2. Pattern-Based Discovery

2. 基于模式的发现

REQUIRED: Use
Glob
and
Grep
tools for local code discovery to find relevant rule files and guidelines.
EXECUTION STRATEGY: Execute 3+ tools simultaneously in the FIRST action for efficiency. Never execute tools sequentially when they can run in parallel.
MANDATORY STEPS:
  1. Find Rule Files (run in parallel): Use multiple
    Glob
    patterns simultaneously.
    # Primary rules
    Glob pattern=".cursor/rules/*.mdc"
    Glob pattern="**/CLAUDE.md"
    Glob pattern="**/AGENTS.md"
    
    # Secondary rules
    Glob pattern="**/CONTRIBUTING.md"
    Glob pattern="**/ARCHITECTURE.md"
    Glob pattern="**/STYLEGUIDE.md"
    
    # Alternative AI tool locations
    Glob pattern=".windsurf/rules/*"
    Glob pattern=".cursorrules"
    Glob pattern=".copilot/*"
    
    # Configuration files
    Glob pattern="**/.eslintrc*"
    Glob pattern="**/tsconfig.json"
    Glob pattern="**/biome.json"
  2. Search by Content: Use
    Grep
    to find rules mentioning specific technologies or concepts.
    Grep pattern="react" path=".cursor/rules"
    Grep pattern="CRITICAL|MANDATORY" path=".cursor/rules" output_mode="content"
    Grep pattern="testing" glob="*.md"
    Grep pattern="must|should|never" glob="*.mdc" -i=true
  3. Search Locations Priority:
    • .cursor/rules/*.mdc
      - Technology-specific rules (highest priority)
    • CLAUDE.md
      - General project guidelines
    • AGENTS.md
      - Agent-specific instructions
    • .windsurf/rules/
      ,
      .cursorrules
      - Alternative AI tool rules
    • docs/
      - Documentation directory
    • Configuration files - Implicit rules from tooling
必填要求:使用
Glob
Grep
工具进行本地代码检索,查找相关的规则文件和指南。
执行策略:为了提升效率,在第一步操作中同时运行3个及以上的工具。可并行运行的工具绝对不要顺序执行。
强制步骤
  1. 查找规则文件(并行执行):同时使用多个
    Glob
    模式检索。
    # 核心规则
    Glob pattern=".cursor/rules/*.mdc"
    Glob pattern="**/CLAUDE.md"
    Glob pattern="**/AGENTS.md"
    
    # 次级规则
    Glob pattern="**/CONTRIBUTING.md"
    Glob pattern="**/ARCHITECTURE.md"
    Glob pattern="**/STYLEGUIDE.md"
    
    # 其他AI工具规则位置
    Glob pattern=".windsurf/rules/*"
    Glob pattern=".cursorrules"
    Glob pattern=".copilot/*"
    
    # 配置文件
    Glob pattern="**/.eslintrc*"
    Glob pattern="**/tsconfig.json"
    Glob pattern="**/biome.json"
  2. 按内容检索:使用
    Grep
    查找提及特定技术或概念的规则。
    Grep pattern="react" path=".cursor/rules"
    Grep pattern="CRITICAL|MANDATORY" path=".cursor/rules" output_mode="content"
    Grep pattern="testing" glob="*.md"
    Grep pattern="must|should|never" glob="*.mdc" -i=true
  3. 检索位置优先级
    • .cursor/rules/*.mdc
      - 技术专属规则(最高优先级)
    • CLAUDE.md
      - 通用项目指南
    • AGENTS.md
      - Agent专属指令
    • .windsurf/rules/
      .cursorrules
      - 其他AI工具规则
    • docs/
      - 文档目录
    • 配置文件 - 工具内置的隐式规则

3. Extract and Categorize Rules

3. 提取并分类规则

Once you identify the relevant files:
  1. Read: Use the
    Read
    tool to examine the full content of the identified rule files (e.g.,
    .cursor/rules/react.mdc
    ).
  2. Categorize Each Rule: For each rule found, determine:
    • Category: Domain area (e.g., Authentication, Testing, Security, Performance, Styling, Architecture)
    • Content: The actual rule or guideline text
    • Source File: File path where the rule was found
    • Enforcement Level: CRITICAL, MANDATORY, RECOMMENDED, or SUGGESTED
  3. Analyze:
    • Look for CRITICAL or MANDATORY requirements first
    • Identify naming conventions, file structures, and required patterns
    • Note any conflicts or specific instructions for the technologies involved
    • Check for keywords: "must", "should", "never", "always", "required", "forbidden"
找到相关文件后:
  1. 读取内容:使用
    Read
    工具查看识别到的规则文件的完整内容(例如
    .cursor/rules/react.mdc
    )。
  2. 对每条规则分类: 针对找到的每条规则,确定以下信息:
    • 类别:所属领域(例如身份验证、测试、安全、性能、样式、架构)
    • 内容:规则或指南的具体文本
    • 来源文件:规则所在的文件路径
    • 执行等级:CRITICAL、MANDATORY、RECOMMENDED 或 SUGGESTED
  3. 分析规则
    • 优先查找CRITICALMANDATORY级别的要求
    • 识别命名约定、文件结构和要求使用的模式
    • 记录涉及的技术存在的冲突或特殊指令
    • 留意关键词:"must"、"should"、"never"、"always"、"required"、"forbidden"

4. Present Findings

4. 展示查找结果

Summarize the rules you found in a clear, actionable format:
  • Rule/Guideline: The specific standard.
  • Source: File path and section where it is defined.
  • Enforcement Level: CRITICAL, MANDATORY, RECOMMENDED.
  • Applicability: Why it applies to this task.
将找到的规则整理为清晰、可执行的格式总结:
  • 规则/指南:具体的标准内容
  • 来源:定义该规则的文件路径和章节
  • 执行等级:CRITICAL、MANDATORY、RECOMMENDED
  • 适用性:该规则适用于当前任务的原因

Documentation Sources

文档来源

Primary Rule Locations

核心规则位置

  • .cursor/rules/*.mdc: Technology-specific rules (React, Backend, Tailwind, etc.)
  • CLAUDE.md: General AI assistant guidelines and project context
  • AGENTS.md: Agent-specific instructions and workflows
  • .cursor/rules/*.mdc:技术专属规则(React、后端、Tailwind等)
  • CLAUDE.md:通用AI助手指南和项目上下文
  • AGENTS.md:Agent专属指令和工作流

Secondary Rule Locations

次级规则位置

  • CONTRIBUTING.md: Contribution guidelines and processes
  • CODE_OF_CONDUCT.md: Community and code standards
  • ARCHITECTURE.md: Architectural decisions and patterns
  • STYLEGUIDE.md: Code style conventions
  • CODING_STANDARDS.md: Programming standards
  • CONTRIBUTING.md:贡献指南和流程
  • CODE_OF_CONDUCT.md:社区和代码标准
  • ARCHITECTURE.md:架构决策和模式
  • STYLEGUIDE.md:代码风格约定
  • CODING_STANDARDS.md:编程标准

Alternative AI Tool Locations

其他AI工具规则位置

  • .windsurf/rules/: Windsurf-specific rules
  • .cursorrules: Cursor rules file
  • .copilot/: GitHub Copilot configuration
  • .codeium/: Codeium configuration
  • .windsurf/rules/:Windsurf专属规则
  • .cursorrules:Cursor规则文件
  • .copilot/:GitHub Copilot配置
  • .codeium/:Codeium配置

Configuration Files (Implicit Rules)

配置文件(隐式规则)

  • .eslintrc.*, .eslintrc.json: Linting rules
  • .prettierrc.*, .prettierrc.json: Formatting rules
  • tsconfig.json: TypeScript compiler options
  • .oxlintrc.json: Oxlint configuration
  • biome.json: Biome formatter/linter rules
  • .eslintrc.*, .eslintrc.json:Lint规则
  • .prettierrc.*, .prettierrc.json:格式化规则
  • tsconfig.json:TypeScript编译选项
  • .oxlintrc.json:Oxlint配置
  • biome.json:Biome格式化/ Lint规则

Documentation Directories

文档目录

  • docs/: Project documentation
  • .github/: GitHub-specific templates and workflows
  • docs/:项目文档
  • .github/:GitHub专属模板和工作流

Enforcement Levels

执行等级

  • 🚨 CRITICAL: Must be followed strictly; violation leads to task rejection.
  • ⚠️ MANDATORY: Required standards that should not be skipped.
  • RECOMMENDED: Best practices that should be followed when applicable.
  • 💡 SUGGESTED: Nice-to-have guidelines.
  • 🚨 CRITICAL:必须严格遵守,违反将导致任务被驳回
  • ⚠️ MANDATORY:要求遵守的标准,不得跳过
  • RECOMMENDED:适用时应当遵守的最佳实践
  • 💡 SUGGESTED:建议采纳的优化指南

Common Rule Categories

常见规则分类

When categorizing rules, use these common domain areas:
  • Architecture: Design patterns, module boundaries, dependencies
  • Testing: Test requirements, coverage, patterns
  • Security: Authentication, authorization, input validation
  • Performance: Optimization requirements, caching, lazy loading
  • Styling: CSS/Tailwind conventions, component styling
  • Naming: File naming, variable naming, function naming
  • Code Quality: Linting, formatting, type safety
  • API: Endpoint patterns, request/response handling
  • State Management: Redux, Context, hooks patterns
  • Error Handling: Exception handling, error boundaries
对规则分类时,可使用以下通用领域分类:
  • 架构:设计模式、模块边界、依赖管理
  • 测试:测试要求、覆盖率、模式
  • 安全:身份验证、授权、输入校验
  • 性能:优化要求、缓存、懒加载
  • 样式:CSS/Tailwind约定、组件样式
  • 命名:文件命名、变量命名、函数命名
  • 代码质量:Lint、格式化、类型安全
  • API:接口模式、请求/响应处理
  • 状态管理:Redux、Context、Hooks模式
  • 错误处理:异常处理、错误边界

Examples

示例

User: "I need to create a new React component." Skill Action:
  1. Context: Feature development, React, component structure.
  2. Discovery:
    • Use Glob:
      Glob pattern=".cursor/rules/*.mdc"
      to find rule files.
    • Use Grep:
      Grep pattern="react" path=".cursor/rules"
      to find React-related rules.
    • Result points to
      .cursor/rules/react.mdc
      .
  3. Extraction: Read
    .cursor/rules/react.mdc
    .
  4. Findings:
    • 🚨 CRITICAL: Use functional components exclusively.
    • ⚠️ MANDATORY: File naming must be
      kebab-case.tsx
      .
    • ⚠️ MANDATORY: Use hooks for state management.
User: "How do I write a backend endpoint?" Skill Action:
  1. Context: Backend, API, implementation.
  2. Discovery:
    • Use Glob:
      Glob pattern=".cursor/rules/*.mdc"
      to list available rules.
    • Use Grep:
      Grep pattern="backend|endpoint|elysia" path=".cursor/rules"
      to find backend rules.
    • Result points to
      .cursor/rules/elysia.mdc
      and
      .cursor/rules/data-fetch.mdc
      .
  3. Extraction: Read relevant files.
  4. Findings:
    • 🚨 CRITICAL: Follow Elysia handler patterns.
    • ⚠️ MANDATORY: Use specific data fetching wrappers.
用户:"我需要创建一个新的React组件。" 技能执行动作
  1. 上下文:功能开发、React、组件结构
  2. 规则查找
    • 使用Glob:
      Glob pattern=".cursor/rules/*.mdc"
      查找规则文件
    • 使用Grep:
      Grep pattern="react" path=".cursor/rules"
      查找React相关规则
    • 结果定位到
      .cursor/rules/react.mdc
  3. 规则提取:读取
    .cursor/rules/react.mdc
  4. 查找结果
    • 🚨 CRITICAL:仅允许使用函数式组件
    • ⚠️ MANDATORY:文件命名必须采用
      kebab-case.tsx
      格式
    • ⚠️ MANDATORY:使用Hooks进行状态管理
用户:"我该怎么编写后端接口?" 技能执行动作
  1. 上下文:后端、API、实现
  2. 规则查找
    • 使用Glob:
      Glob pattern=".cursor/rules/*.mdc"
      列出可用规则
    • 使用Grep:
      Grep pattern="backend|endpoint|elysia" path=".cursor/rules"
      查找后端规则
    • 结果定位到
      .cursor/rules/elysia.mdc
      .cursor/rules/data-fetch.mdc
  3. 规则提取:读取相关文件
  4. 查找结果
    • 🚨 CRITICAL:遵循Elysia handler模式
    • ⚠️ MANDATORY:使用指定的数据请求封装工具