Token导航 LogoToken导航

Agent Skill · 研究检索

creating-cursor-rules-skill(creating Cursor rules 技能)

creating-cursor-rules-skill 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

creating-cursor-rules-skill 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为操作浏览器;许可证信息还不明确,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 70,176。

总安装 212周安装 9GitHub Stars 公开资料未说明下载 74核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:creating-cursor-rules-skill(creating Cursor rules 技能)
来源仓库:https://github.com/cristiano-pacheco/ai-rules
仓库路径:skills/creating-cursor-rules-skill
安装命令:
npx skills add https://github.com/cristiano-pacheco/ai-rules --skill creating-cursor-rules-skill
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/cristiano-pacheco/ai-rules --skill creating-cursor-rules-skill

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

creating-cursor-rules-skill 专门用于生成 Cursor IDE 的规则文件,提升项目一致性。适用于在 Codex、Claude、Cursor、Gemini CLI 中将技能指南或团队规范转为 .cursor/rules 格式。

自动识别项目类型并输出结构化规则,涵盖代码风格、命名约定与审查流程。仅限 Cursor 环境使用,不适用于 Claude Code 或其他宿主,避免误用。适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

来源仓库内路径:skills/creating-cursor-rules-skill

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/cristiano-pacheco/ai-rules --skill creating-cu…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要操作浏览器,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

creating-cursor-rules-skill 怎么安装?

在终端执行 npx skills add https://github.com/cristiano-pacheco/ai-rules --skill creating-cursor-rules…。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

creating-cursor-rules-skill 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

creating-cursor-rules-skill 需要什么权限?

权限级别是操作浏览器。该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

creating-cursor-rules-skill 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

creating-cursor-rules-skill 用的人多吗?

公开数据是累计安装 212 次,近一周安装 9 次,下载 74 次。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

creating-cursor-rules-skill 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
creating-cursor-rules-skill

creating Cursor rules 技能 · 本页

212—操作浏览器未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Creating Cursor Rules

You are an expert at creating effective .cursor/rules files that help AI assistants understand project conventions and produce better code.

When to Apply This Skill

Use when:

  • User is starting a new project and needs .cursor/rules setup
  • User wants to improve existing project rules
  • User asks to convert skills/guidelines to Cursor format
  • Team needs consistent coding standards documented

Don't use for:

  • One-time instructions (those can be asked directly)
  • User-specific preferences (those go in global settings)
  • Claude Code skills (this skill is specifically for Cursor rules)

Core Principles

1. Be Specific and Actionable

Rules should provide concrete guidance, not vague advice.

❌ BAD - Vague:

Write clean code with good practices.
Use proper TypeScript types.

✅ GOOD - Specific:

Use functional components with TypeScript.
Define prop types with interfaces, not inline types.
Extract custom hooks when logic exceeds 10 lines.

2. Focus on Decisions, Not Basics

Don't document what linters handle. Document architectural decisions.

❌ BAD - Linter territory:

Use semicolons in JavaScript.
Indent with 2 spaces.
Add trailing commas.

✅ GOOD - Decision guidance:

Choose Zustand for global state, React Context for component trees.
Use Zod for runtime validation at API boundaries only.
Prefer server components except for: forms, client-only APIs, animations.

3. Organize by Concern

Group related rules into clear sections:

## Tech Stack
- Next.js 14 with App Router
- TypeScript strict mode
- Tailwind CSS for styling

## Code Style
- Functional components only
- Named exports (no default exports)
- Co-locate tests with source files

## Patterns
- Use React Server Components by default
- Client components: mark with "use client" directive
- Error handling: try/catch + toast notification

## Project Conventions
- API routes in app/api/
- Components in components/ (flat structure)
- Types in types/ (shared), components/*/types.ts (local)

Rule Anatomy

MDC Format and Metadata

Cursor rules are written in MDC (.mdc) format, which supports YAML frontmatter metadata and markdown content. The metadata controls how and when rules are applied.

Required YAML Frontmatter

Every Cursor rule MUST start with YAML frontmatter between --- markers:

---
description: Brief description of when and how to use this rule
globs: ["**/*.ts", "**/*.tsx"]
alwaysApply: false
---

Frontmatter Properties

PropertyTypeRequiredDescription
descriptionstringYesBrief description of the rule's purpose. Used by AI to decide relevance. Never use placeholders like --- or empty strings.
globsarrayNoFile patterns that trigger auto-attachment (e.g., ["**/*.ts"]). Leave empty or omit if not using Auto Attached type.
alwaysApplybooleanNoIf true, rule is always included in context. If false or omitted, behavior depends on Rule Type.

Rule Types

Control how rules are applied using the type dropdown in Cursor:

Rule TypeDescriptionWhen to Use
AlwaysAlways included in model contextCore project conventions, tech stack, universal patterns that apply everywhere
Auto AttachedIncluded when files matching globs pattern are referencedFile-type specific rules (e.g., React components, API routes, test files)
Agent RequestedAvailable to AI, which decides whether to include it based on descriptionContextual patterns, specialized workflows, optional conventions
ManualOnly included when explicitly mentioned using @ruleNameRarely-used patterns, experimental conventions, legacy documentation

Examples by Rule Type

Always Rule (Core conventions):

---
description: TypeScript and code style conventions for the entire project
alwaysApply: true
---

Auto Attached Rule (File pattern-specific):

---
description: React component patterns and conventions
globs: ["**/components/**/*.tsx", "**/app/**/*.tsx"]
alwaysApply: false
---

Agent Requested Rule (Contextual):

---
description: RPC service boilerplate and patterns for creating new RPC endpoints
globs: []
alwaysApply: false
---

Manual Rule (Explicit invocation):

---
description: Legacy API migration patterns (deprecated, use for reference only)
globs: []
alwaysApply: false
---

Best Practices for Frontmatter

  1. Description is mandatory - AI uses this to determine relevance. Be specific:

- ❌ Bad: Backend code - ✅ Good: Fastify API route patterns, error handling, and validation using Zod

  1. Use globs strategically - Auto-attach to relevant file types:

- React components: ["**/*.tsx", "**/*.jsx"] - API routes: ["**/api/**/*.ts", "**/routes/**/*.ts"] - Tests: ["**/*.test.ts", "**/*.spec.ts"]

  1. Avoid always applying everything - Use alwaysApply: true sparingly:

- ✅ Good for: Tech stack, core conventions, project structure - ❌ Bad for: Framework-specific patterns, specialized workflows

  1. Make Agent Requested rules discoverable - Write descriptions that help AI understand when to use:

- Include keywords: "boilerplate", "template", "pattern for X" - Mention specific use cases: "when creating new API routes"

Required Sections

Every Cursor rule file should include these sections:

1. Tech Stack Declaration

## Tech Stack
- Framework: Next.js 14
- Language: TypeScript 5.x (strict mode)
- Styling: Tailwind CSS 3.x
- State: Zustand
- Database: PostgreSQL + Prisma
- Testing: Vitest + Playwright

Why: Prevents AI from suggesting wrong tools/patterns.

2. Code Style Guidelines

## Code Style
- **Components**: Functional with TypeScript
- **Props**: Interface definitions, destructure in params
- **Hooks**: Extract when logic > 10 lines
- **Exports**: Named exports only (no default)
- **File naming**: kebab-case.tsx

3. Common Patterns

Always include code examples, not just descriptions:

## Patterns

### Error Handling

try { const result = await operation(); toast.success('Operation completed'); return result; } catch (error) { const message = error instanceof Error ? error.message : 'Unknown error'; toast.error(message); throw error; // Re-throw for caller to handle }


### API Route Structure

// app/api/users/route.ts export async function GET(request: Request) { try { // 1. Parse/validate input // 2. Check auth/permissions // 3. Perform operation // 4. Return Response } catch (error) { return new Response(JSON.stringify({ error: 'Message' }), { status: 500 }); } }

What NOT to Include

Avoid these common mistakes:

❌ Too obvious:

- Write readable code
- Use meaningful variable names
- Add comments when necessary
- Follow best practices

❌ Too restrictive:

- Never use any third-party libraries
- Always write everything from scratch
- Every function must be under 5 lines

❌ Language-agnostic advice:

- Use design patterns
- Think before you code
- Test your code
- Keep it simple

Structure Template

Use this template for new Cursor rules:

# Project Name - Cursor Rules

## Tech Stack
[List all major technologies with versions]

## Code Style
[Specific style decisions]

## Project Structure
[Directory organization]

## Patterns
[Common patterns with code examples]

### Pattern Name
[Description + code example]

## Conventions
[Project-specific conventions]

## Common Tasks
[Frequent operations with step-by-step snippets]

### Task Name
1. Step one
2. Step two
[Code example]

## Anti-Patterns
[What to avoid and why]

## Testing
[Testing approach and patterns with examples]

Example Sections

Tech Stack Section

## Tech Stack

**Framework:** Next.js 14 (App Router)
**Language:** TypeScript 5.x (strict mode enabled)
**Styling:** Tailwind CSS 3.x with custom design system
**State:** Zustand for global, React Context for component trees
**Forms:** React Hook Form + Zod validation
**Database:** PostgreSQL with Prisma ORM
**Testing:** Vitest (unit), Playwright (E2E)
**Deployment:** Vercel

**Key Dependencies:**
- `@tanstack/react-query` for server state
- `date-fns` for date manipulation (not moment.js)
- `clsx` + `tailwind-merge` for conditional classes

Anti-Patterns Section

## Anti-Patterns

### ❌ Don't: Default Exports

// ❌ BAD export default function Button() { }

// ✅ GOOD export function Button() { }


**Why:** Named exports are more refactor-friendly and enable better tree-shaking.

### ❌ Don't: Inline Type Definitions

// ❌ BAD function UserCard({ user }: { user: { name: string; email: string } }) { }

// ✅ GOOD interface User { name: string; email: string; }

function UserCard({ user }: { user: User }) { }


**Why:** Reusability and discoverability.

Common Tasks

Include shortcuts for frequent operations:

## Common Tasks

### Adding a New API Route

1. Create `app/api/[route]/route.ts`
2. Define HTTP method exports (GET, POST, etc.)
3. Validate input with Zod schema
4. Use try/catch for error handling
5. Return `Response` object

import { z } from 'zod';

const schema = z.object({ name: z.string().min(1) });

export async function POST(request: Request) { try { const body = await request.json(); const data = schema.parse(body);

// Process...

return Response.json({ success: true }); } catch (error) { if (error instanceof z.ZodError) { return Response.json( { error: error.errors }, { status: 400 } ); } return Response.json( { error: 'Internal error' }, { status: 500 } ); } }

Best Practices

Keep Rules Under 500 Lines

  • Split large rules into multiple, composable files
  • Each rule file should focus on one domain or concern
  • Reference other rule files when needed (e.g., "See backend-api.mdc for API patterns")
  • Why: Large files become unmanageable and harder for AI to process effectively

Split Into Composable Rules

Break down by concern rather than creating one monolithic file:


.cursor/rules/ ├── tech-stack.mdc # Core technologies ├── typescript-patterns.mdc # Language-specific patterns ├── api-conventions.mdc # API route standards ├── component-patterns.mdc # React/UI patterns └── testing-standards.mdc # Testing approaches

Why: Easier to maintain, update, and reuse across similar projects.

Provide Concrete Examples or Referenced Files

Instead of vague guidance, always include:

  • Complete, runnable code examples
  • References to actual project files: See components/auth/LoginForm.tsx for example
  • Links to internal docs or design system
  • Specific file paths and line numbers when relevant

❌ BAD - Vague:

Use proper error handling in API routes.

✅ GOOD - Concrete:

API routes must use try/catch with typed errors. Example:

// app/api/users/route.ts (lines 10-25) export async function POST(request: Request) { try { const data = await request.json(); return Response.json({ success: true }); } catch (error) { return handleApiError(error); // See lib/errors.ts } }


See `app/api/products/route.ts` for complete implementation.

Write Rules Like Clear Internal Docs

Rules should read like technical documentation, not casual advice:

  • Be precise and unambiguous
  • Include the "why" behind decisions
  • Document exceptions to rules
  • Reference architecture decisions
  • Link to related rules or documentation

Think: "Could a new engineer understand this without asking questions?"

Reuse Rules When Repeating Prompts

If you find yourself giving the same instructions repeatedly in chat:

  1. Document that pattern in .cursor/rules/
  2. Include the specific guidance you keep repeating
  3. Add examples of correct implementation
  4. Update existing rule files rather than creating new ones

Common scenarios to capture:

  • "Always use X pattern for Y"
  • "Don't forget to Z when doing W"
  • Corrections you make frequently
  • Patterns specific to your team/codebase

Keep It Scannable

  • Use clear section headers
  • Bold important terms
  • Include code examples (not just prose)
  • Use tables for comparisons
  • Add table of contents for files over 200 lines

Update Regularly

  • Review monthly or after major changes
  • Remove outdated patterns
  • Add new patterns as they emerge
  • Keep examples current with latest framework versions
  • Archive deprecated rules rather than deleting (for reference)

Test with AI

After creating rules, test them:

  1. Ask AI: "Create a new API route following our conventions"
  2. Ask AI: "Add error handling to this component"
  3. Ask AI: "Refactor this to match our patterns"

Verify AI follows rules correctly. Update rules based on gaps found.

Real-World Example

The PRPM registry .cursor/rules demonstrates:

  • Clear tech stack declaration (Fastify, TypeScript, PostgreSQL)
  • Specific TypeScript patterns
  • Fastify-specific conventions
  • Error handling standards
  • API route patterns
  • Database query patterns

Checklist for New Cursor Rules

Project Context:

  • [ ] Tech stack clearly defined with versions
  • [ ] Key dependencies listed
  • [ ] Deployment platform specified

Code Style:

  • [ ] Component style specified (functional/class)
  • [ ] Export style (named/default)
  • [ ] File naming convention
  • [ ] Specific to project (not generic advice)

Patterns:

  • [ ] At least 3-5 code examples
  • [ ] Cover most common tasks
  • [ ] Include error handling pattern
  • [ ] Show project-specific conventions

Organization:

  • [ ] Logical section headers
  • [ ] Scannable (not wall of text)
  • [ ] Examples are complete and runnable
  • [ ] Anti-patterns included with rationale

Testing:

  • [ ] Tested with AI assistant
  • [ ] AI follows conventions correctly
  • [ ] Updated after catching mistakes

Helpful Prompts for Users

When helping users create Cursor rules:

Discovery:

  • "What's your tech stack?"
  • "What patterns do you want AI to follow?"
  • "What mistakes does AI currently make?"

Refinement:

  • "Are there anti-patterns you want documented?"
  • "What are your most common coding tasks?"
  • "Do you have naming conventions?"

Validation:

  • "Let me test these rules by asking you to generate code..."
  • "Does this match your team's style?"

Remember

  • Cursor rules are living documents - update as project evolves
  • Focus on decisions, not basics
  • Include runnable code examples, not descriptions
  • Test rules with AI to verify effectiveness
  • Keep it scannable - use headers, bold, lists

Goal: Help AI produce code that matches project conventions without constant correction.

平台分布

Codex

33.11%
按下载量换算25

Claude

29.18%
按下载量换算22

Cursor

18.39%
按下载量换算14

Gemini CLI

9.46%
按下载量换算7

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills