CURSOR 잘 사용하기(0.46 버전 기준)-25.03.03 (.cursorrules / .cursorindexingignore, .cursorignore)

2025. 3. 3. 15:58꿀팁 분석 환경 설정

728x90

CURSOR가 이번에 업데이트가 되면서, 화면 구조가 바뀌었고, 몇몇 기능이 추가가 되었다.

추가가 된 김에 잘 사용하려면 어떤 것을 해야할 지 정리해보고자 한다.

 

 

아래 블로그에 잘 정리되어 있어서, 이걸 보시는 것도 추천드립니다.
특히 MCP에 대한 설명에 대해서 상세하게 작성해줘서 MCP가 필요한 부분은 참고하시면 좋을 것 같습니다.

 

https://youtu.be/f2ibNsDdJ0U?si=t9YOSBeUssVf5UD8

 

주오 업데이트 (0.46.x)

1. Agent가 기본 모드로 설정됨

  • 이전에는 Chat, Composer, Agent 세 가지 모드가 존재했지만, 이제는 Agent가 기본 모드가 되어 보다 강력하고 통합된 AI 경험을 제공합니다.
  • 이를 통해 사용자가 모드를 전환하는 과정에서 혼란을 줄이고, 하나의 스마트한 인터페이스에서 모든 기능을 사용할 수 있도록 개선되었습니다.

2. 새로운 UI 적용 (UI Refresh)

  • 기본 테마가 변경되어 보다 집중할 수 있도록 디자인되었습니다.
  • @-context 메뉴가 간소화되어 Agent가 더 정밀하게 작동하도록 최적화되었습니다.

3. 웹 검색 기능 향상

  • 이제 Agent가 자동으로 웹 검색을 수행할 수 있습니다.
  • 사용자가 명시적으로 @Web을 입력하지 않아도, 최신 정보를 검색하여 적용할 수 있습니다.

4. .cursorignore 및 .cursorindexingignore 기능 확장

  • .cursorignore 파일은 이제 채팅에서 파일이 추가되는 것을 차단하고, Tab 자동 완성에도 파일이 포함되지 않도록 변경되었습니다.
  • 기존 .cursorignore가 수행했던 인덱싱 제외 기능만 필요할 경우, 새로운 .cursorindexingignore 파일을 사용하여 보다 정밀하게 제어할 수 있습니다.

5. Agent Tool Limit 변경

  • 25개의 도구 호출 제한이 도달하면, "continue" 버튼을 눌러 요청을 새로 시작할 수 있도록 변경되었습니다.

6. Project Rules 개선

  • 프로젝트에 대한 규칙을 글로벌하게 적용할 수 있는 기능이 추가되었습니다.
  • 규칙이 적용될 때 시각적으로 표시되는 기능이 추가되어, 규칙이 언제 활성화되는지 쉽게 확인할 수 있습니다.

7. MCP 관련 개선

  • Agent가 자동으로 MCP(Multi-Context Processing) 도구를 실행할 수 있습니다.
  • Yolo 모드 지원: 빠른 실행을 위해 Agent가 MCP 도구를 Yolo 모드에서 자동 실행할 수 있습니다.
  • 프로젝트 서버 구성 가능: <project-root>/.cursor/mcp.json 파일을 사용하여 MCP 서버를 구성할 수 있습니다.
  • Agent가 MCP 리소스를 컨텍스트로 사용할 수 있도록 지원됩니다.

8. Tab 재매핑 (Tab Rebiding) 기능 추가

  • Tab 자동 완성 제안을 다른 키로 변경할 수 있도록 지원합니다.
  • 이를 통해 사용자는 보다 유연한 키 바인딩을 설정할 수 있습니다.

9. 성능 및 안정성 향상 (Fixes)

  • 메모리 및 성능 개선으로 더 안정적인 환경을 제공합니다.
  • MCP 서버 빌드 관련 개선을 통해 보다 신뢰성이 높아졌습니다.
  • Windows 관련 버그 수정으로 줄 바꿈 오류 및 자동 제거 문제를 해결했습니다.

 

Cursor Global Rules

모든 프로젝트에서 공통으로 적용할 규칙을 설정하는 방법

  • 위치: Cursor Settings > General > Rules for AI
  • 사용 예시:
    • 모든 프로젝트에서 AI 응답을 한국어로 설정
    • AI가 코드 응답을 짧게 요약하도록 설정

아래와 같이 전체 글로벌 룰을 정할 수 있습니다.

 

 

Cursor Project Rules(.cursurrules 랑 동일한 역할)

📌 프로젝트의 특정 파일이나 폴더에 맞춘 AI 행동을 정의하는 방식

  • 위치: .cursor/rules/ 디렉토리에 저장
  • 장점: 세밀한 파일 패턴 적용 가능, AI 자동 컨텍스트 추가 가능, 버전 관리 가능

프로젝트 규칙의 핵심 기능

파일 패턴 매칭 (glob 패턴 사용) → 특정 파일/폴더에 대한 규칙 적용
자동 적용 → 파일이 AI 요청에서 참조될 때 규칙 자동 추가
다른 파일 참조 → @file을 이용하여 다른 규칙 파일 포함 가능

 

예제: 특정 파일 타입에 맞춘 규칙 (.cursor/rules/tsx.json)

{
  "description": "SolidJS 컴포넌트 개발을 위한 규칙",
  "file_patterns": ["*.tsx"],
  "instructions": "이 파일에서는 SolidJS 스타일의 코드를 유지하세요. React와 혼동하지 마세요.",
  "references": ["@file:styles-guidelines.md"]
}

추천 사용 사례

  • 특정 프레임워크(.tsx → SolidJS) 설정
  • 자동 생성된 파일(.proto) 특수 처리
  • UI 개발 패턴 맞춤 설정
  • 특정 디렉토리 내 코드 스타일 강제 적용

Cursor 관련 파일 잘 활용하기(.cursorrules, .cursorignore, .cursorindexingignore )

Cursor는 AI 기반 코드 편집기로, AI가 코드베이스를 이해하고 효율적으로 작업할 수 있도록 다양한 설정 파일을 제공합니다. 특히, .cursorrules, .cursorignore, 그리고 .cursorindexingignore 파일을 적절히 활용하면 프로젝트의 보안과 성능을 최적화할 수 있습니다.

 

1.  .cursorrules – 프로젝트별 AI 동작 정의

https://github.com/PatrickJS/awesome-cursorrules

.cursorrules 파일은 Cursor AI의 동작을 프로젝트별로 커스터마이징하는 데 사용됩니다. AI가 코드를 분석하고 작업할 때 따를 규칙을 정의할 수 있어, 팀 내에서 일관된 코딩 스타일을 유지하거나 특정 패턴을 강제하는 데 유용합니다.

 

아래는 특정 cursor rules를 가져온 것이고 이런 식으로 사용자가 에이전트를 제어할 때 어떻게 제어하고 싶은 지에 대해서 규칙을 설정해준 것으로 이해하면 됩니다.

 

예시

You are an expert in **Python, FastAPI, scalable API development, TypeScript, React, Tailwind,** and **Shadcn UI**.

### Key Principles

- Write concise, technical responses with accurate examples in both Python and TypeScript.
- Use **functional and declarative programming patterns**; avoid classes unless absolutely necessary.
- Prefer **iteration and modularization** over code duplication.
- Use descriptive variable names with auxiliary verbs (e.g., `is_active`, `has_permission`, `isLoading`, `hasError`).
- Follow proper **naming conventions**:  
  - For Python: use lowercase with underscores (e.g., `routers/user_routes.py`).  
  - For TypeScript: use lowercase with dashes for directories (e.g., `components/auth-wizard`).

### Project Structure

- **Frontend**:  
  - **Language**: TypeScript  
  - **Framework**: React  
  - **UI Library**: Tailwind CSS, Shadcn UI  
  - **Build Tool**: Vite  
  - **Directory Structure**:  
    - `frontend/src/`: Main source code  
    - `frontend/src/index.html`: Main HTML file  
    - Configuration Files:  
      - `vite.config.ts`  
      - `tsconfig.json`  
      - `tailwind.config.js`  
      - `postcss.config.js`  
    - **Docker Files**:  
      - `Dockerfile`  
      - `Dockerfile.dev`

- **Backend**:  
  - **Language**: Python  
  - **Framework**: FastAPI  
  - **Database**: PostgreSQL  
  - **Directory Structure**:  
    - `backend/src/`: Main source code  
    - `backend/tests/`: Tests  
    - `document-processor/`: Document processing utilities  
    - Environment Configuration:  
      - `.env` / `.env.example`: Environment variables  
    - Database Configuration:  
      - `alembic.ini`  
      - `ddialog.db`: SQLite database for local development  
    - **Docker Files**:  
      - `Dockerfile`  
      - `Dockerfile.dev`

### Code Style and Structure

**Backend (Python/FastAPI)**:

- Use `def` for pure functions and `async def` for asynchronous operations.
- **Type Hints**: Use Python type hints for all function signatures. Prefer Pydantic models for input validation.
- **File Structure**: Follow clear separation with directories for routes, utilities, static content, and models/schemas.
- **RORO Pattern**: Use the "Receive an Object, Return an Object" pattern.
- **Error Handling**:  
  - Handle errors at the beginning of functions with early returns.  
  - Use guard clauses and avoid deeply nested if statements.  
  - Implement proper logging and custom error types.

**Frontend (TypeScript/React)**:

- **TypeScript Usage**: Use TypeScript for all code. Prefer interfaces over types. Avoid enums; use maps instead.
- **Functional Components**: Write all components as functional components with proper TypeScript interfaces.
- **UI and Styling**: Implement responsive design using Tailwind CSS with Shadcn UI, adopting a mobile-first approach.
- **Performance**:  
  - Minimize `use client`, `useEffect`, and `setState` hooks. Favor server-side rendering where possible.  
  - Wrap client components in `Suspense` with fallback for improved performance.

### Performance Optimization

**Backend**:

- **Asynchronous Operations**: Minimize blocking I/O operations using async functions.
- **Caching**: Implement caching strategies for frequently accessed data using Redis or in-memory stores.
- **Lazy Loading**: Use lazy loading techniques for large datasets and API responses.

**Frontend**:

- **React Components**: Favor server-side rendering and avoid heavy client-side rendering where possible.
- **Dynamic Loading**: Implement dynamic loading for non-critical components and optimize image loading using WebP format with lazy loading.

### Project Conventions

**Backend**:

1. Follow **RESTful API design principles**.
2. Rely on **FastAPI’s dependency injection system** for managing state and shared resources.
3. Use **SQLAlchemy 2.0** for ORM features, if applicable.
4. Ensure **CORS** is properly configured for local development.
5. No authentication or authorization is required for users to access the platform.

**Frontend**:

1. Optimize **Web Vitals** (LCP, CLS, FID).
2. Limit `use client` hooks to small, specific components for Web API access.
3. Use **Docker** for containerization and ensure easy deployment.

### Testing and Deployment

- Implement **unit tests** for both frontend and backend.
- Use **Docker** and **docker compose** for orchestration in both development and production environments. Avoid using the obsolete `docker-compose` command.
- Ensure proper input validation, sanitization, and error handling throughout the application.

 

  • 코딩 스타일 강제: 들여쓰기 크기, 최대 줄 길이 등을 설정 가능
  • 베스트 프랙티스 적용: use_strict 강제, const 사용 권장 등
  • 금지된 패턴 설정: 보안상 위험한 eval() 사용 금지

적용 효과

일관된 코드 스타일 유지
보안 취약점 예방
AI가 프로젝트의 특성을 학습하여 더 정확한 코드 제안 제공

 

주의 사항(25.03.03)

내용을 확인해보니,곧 없어질 수 있다고 하고 새로운 구조인 .cursor/rules 구조로 변경해서 관리해야할 것 같습니다.

2. .cursorignore – AI 기능 및 인덱싱에서 제외할 파일 지정

Cursor의 AI는 프로젝트 내 파일을 자동으로 인덱싱하여 분석합니다.

하지만 보안이 중요한 파일이나 불필요한 파일이 AI에 노출되지 않도록 .cursorignore를 사용해 제어할 수 있습니다.

 

예시

# 가상 환경 및 의존성 파일 제외
.venv/
node_modules/

# 환경 변수 및 보안 파일 제외
.env
config/settings_secret.py

# 로그 파일 및 캐시 파일 제외
*.log
__pycache__/

 

  • .env 파일과 config/settings_secret.py를 제외하여 보안 강화
  • node_modules/, .venv/ 등 불필요한 의존성 파일을 AI 분석에서 제외

적용 효과

민감한 정보 보호 (API 키, DB 설정 등)
불필요한 파일 분석 방지로 AI 성능 최적화

2. .cursorindexingignore 파일 

 

Cursor가 검색과 컨텍스트 기능을 위해 파일을 인덱싱하는데, AI 분석에는 포함하되, 인덱싱에서만 제외하고 싶은 경우 이 파일을 사용합니다

예시

# 대용량 생성 파일 제외
build/
dist/

# 바이너리 파일 제외
*.exe
*.dll
*.so

# 테스트 커버리지 파일 제외
coverage/
htmlcov/

build/, dist/ 디렉토리 제외하여 검색 속도 향상
.exe, .dll 같은 실행 파일 제외하여 불필요한 리소스 사용 방지


적용 효과

✅ 코드 검색 속도 최적화
✅ 불필요한 바이너리 파일 인덱싱 방지

 

 

4. 세 파일의 차이점 비교

파일명 AI 분석 포함 검색 인덱싱 포함 주요 용도
.cursor/rules/ ✅ 포함 ✅ 포함 특정 파일별 AI 행동 정의
Global Rules ✅ 포함 ✅ 포함 모든 프로젝트에서 공통 적용
.cursorrules ✅ 포함 ✅ 포함 프로젝트 전체 AI 동작 정의 (곧 제거 예정)
.cursorignore ❌ 제외 ❌ 제외 AI 및 인덱싱에서 제외 (보안 보호)
.cursorindexingignore ✅ 포함 ❌ 제외 검색 최적화, 불필요한 파일 인덱싱 방지

5. Python 프로젝트 예제와 설정 적용

.cursorrules 사라지기 이전 버전

my_python_project/
├── .cursorignore
├── .cursorindexingignore
├── .cursorrules
├── src/
│   ├── main.py
│   ├── utils.py
├── build/
├── dist/
├── config/
│   ├── settings.py
│   ├── settings_secret.py
├── .venv/
├── .gitignore
└── .env

.cursorrules 사라지기 이후 버전 (.cursor/rules)

my_python_project/
├── .cursorignore
├── .cursorindexingignore
├── .cursor/rules/
│   ├── python.json
│   ├── security.json
├── src/
│   ├── main.py
│   ├── utils.py
├── build/
├── dist/
├── config/
│   ├── settings.py
│   ├── settings_secret.py
├── .venv/
├── .gitignore
└── .env

 

 

마무리

이번에 cursor에서 기본적으로 설정하면 유용한 파일들에 대해서 알아봤다.

결국 이런 cursor를 통해 내가 잘 모르는 분야에 대해서도 코딩을 할 수 있지만, 그런 분야에 내가 원하는 rule을 잘 주려면 결국 프로그래밍언어 공부나 아니면 일반적인 지식에 대한 공부는 계속 필요하다는 생각이 들었다.

MCP 부분은 실제로 좀 써보고 업데이트 해야할 것 같다.

 

 

  링크
CURSOR-MCP https://cursor.directory/mcp
CURSOR-MCP https://glama.ai/mcp/servers
CURSOR-MCP https://smithery.ai/
CURSOR-2025-3-3 업데이트 설명  https://youtu.be/f2ibNsDdJ0U?si=XvISIG6qoeV0ZeAJ
Sequential Thinking(Smithery) https://smithery.ai/server/@smithery-ai/server-sequential-thinking
rule https://docs.cursor.com/context/rules-for-ai

 

728x90

데이터분석뉴비님의
글이 좋았다면 응원을 보내주세요!