find-rules
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseFind 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 and tools for local code discovery to find relevant rule files and guidelines.
GlobGrepEXECUTION STRATEGY: Execute 3+ tools simultaneously in the FIRST action for efficiency. Never execute tools sequentially when they can run in parallel.
MANDATORY STEPS:
-
Find Rule Files (run in parallel): Use multiplepatterns simultaneously.
Glob# 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" -
Search by Content: Useto find rules mentioning specific technologies or concepts.
GrepGrep 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 -
Search Locations Priority:
- - Technology-specific rules (highest priority)
.cursor/rules/*.mdc - - General project guidelines
CLAUDE.md - - Agent-specific instructions
AGENTS.md - ,
.windsurf/rules/- Alternative AI tool rules.cursorrules - - Documentation directory
docs/ - Configuration files - Implicit rules from tooling
必填要求:使用和工具进行本地代码检索,查找相关的规则文件和指南。
GlobGrep执行策略:为了提升效率,在第一步操作中同时运行3个及以上的工具。可并行运行的工具绝对不要顺序执行。
强制步骤:
-
查找规则文件(并行执行):同时使用多个模式检索。
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" -
按内容检索:使用查找提及特定技术或概念的规则。
GrepGrep 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 -
检索位置优先级:
- - 技术专属规则(最高优先级)
.cursor/rules/*.mdc - - 通用项目指南
CLAUDE.md - - Agent专属指令
AGENTS.md - 、
.windsurf/rules/- 其他AI工具规则.cursorrules - - 文档目录
docs/ - 配置文件 - 工具内置的隐式规则
3. Extract and Categorize Rules
3. 提取并分类规则
Once you identify the relevant files:
-
Read: Use thetool to examine the full content of the identified rule files (e.g.,
Read)..cursor/rules/react.mdc -
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
-
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"
找到相关文件后:
-
读取内容:使用工具查看识别到的规则文件的完整内容(例如
Read)。.cursor/rules/react.mdc -
对每条规则分类: 针对找到的每条规则,确定以下信息:
- 类别:所属领域(例如身份验证、测试、安全、性能、样式、架构)
- 内容:规则或指南的具体文本
- 来源文件:规则所在的文件路径
- 执行等级:CRITICAL、MANDATORY、RECOMMENDED 或 SUGGESTED
-
分析规则:
- 优先查找CRITICAL或MANDATORY级别的要求
- 识别命名约定、文件结构和要求使用的模式
- 记录涉及的技术存在的冲突或特殊指令
- 留意关键词:"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:
- Context: Feature development, React, component structure.
- Discovery:
- Use Glob: to find rule files.
Glob pattern=".cursor/rules/*.mdc" - Use Grep: to find React-related rules.
Grep pattern="react" path=".cursor/rules" - Result points to .
.cursor/rules/react.mdc
- Use Glob:
- Extraction: Read .
.cursor/rules/react.mdc - 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:
- Context: Backend, API, implementation.
- Discovery:
- Use Glob: to list available rules.
Glob pattern=".cursor/rules/*.mdc" - Use Grep: to find backend rules.
Grep pattern="backend|endpoint|elysia" path=".cursor/rules" - Result points to and
.cursor/rules/elysia.mdc..cursor/rules/data-fetch.mdc
- Use Glob:
- Extraction: Read relevant files.
- Findings:
- 🚨 CRITICAL: Follow Elysia handler patterns.
- ⚠️ MANDATORY: Use specific data fetching wrappers.
用户:"我需要创建一个新的React组件。"
技能执行动作:
- 上下文:功能开发、React、组件结构
- 规则查找:
- 使用Glob:查找规则文件
Glob pattern=".cursor/rules/*.mdc" - 使用Grep:查找React相关规则
Grep pattern="react" path=".cursor/rules" - 结果定位到
.cursor/rules/react.mdc
- 使用Glob:
- 规则提取:读取
.cursor/rules/react.mdc - 查找结果:
- 🚨 CRITICAL:仅允许使用函数式组件
- ⚠️ MANDATORY:文件命名必须采用格式
kebab-case.tsx - ⚠️ MANDATORY:使用Hooks进行状态管理
用户:"我该怎么编写后端接口?"
技能执行动作:
- 上下文:后端、API、实现
- 规则查找:
- 使用Glob:列出可用规则
Glob pattern=".cursor/rules/*.mdc" - 使用Grep:查找后端规则
Grep pattern="backend|endpoint|elysia" path=".cursor/rules" - 结果定位到和
.cursor/rules/elysia.mdc.cursor/rules/data-fetch.mdc
- 使用Glob:
- 规则提取:读取相关文件
- 查找结果:
- 🚨 CRITICAL:遵循Elysia handler模式
- ⚠️ MANDATORY:使用指定的数据请求封装工具