에이전트로 새 파일 생성하기
Cursor의 AI 에이전트는 새 파일을 생성하고 관리하는 강력한 도구입니다. 이 가이드에서는 에이전트를 사용하여 파일을 효율적으로 생성하는 방법을 설명합니다.
기본 사용법
1. 파일 생성 명령
# 기본 파일 생성
/agent create file [파일명]
# 특정 경로에 파일 생성
/agent create file [경로/파일명]
# 템플릿 사용
/agent create file [파일명] --template [템플릿명]
2. 파일 유형 지정
# React 컴포넌트 생성
/agent create file components/Button.tsx --type react
# API 라우트 생성
/agent create file api/users.ts --type api
# 테스트 파일 생성
/agent create file tests/Button.test.tsx --type test
고급 기능
1. 템플릿 사용
// React 컴포넌트 템플릿
interface ComponentTemplate {
name: string;
props?: Record<string, any>;
children?: boolean;
}
// 템플릿 적용
/agent create file Button.tsx --template react-component --props "color:string,size:number"
2. 파일 구조 생성
# 전체 디렉토리 구조 생성
/agent create structure src/components/Button
# 결과:
# src/components/Button/
# ├── index.ts
# ├── Button.tsx
# ├── Button.test.tsx
# └── Button.module.css