🐢

ClaudeCodeが高いからCursorで再現できるか試してみた(2025/06)

に公開

はじめに

最近、AI開発ツールとして注目を集めているClaudeCodeですが、ClaudeCode Maxプランのコスト面から全エンジニアに配布するのが難しい状況がありますよね。今年に入って開発ツールのサブスク費用がめちゃくちゃ増えているため、節約術を模索しています。(Cursorを定額で使い倒したい!

そんな中、一日のほとんどをCursorと過ごしている私は、ふとこんなことを思いました。🤔

「ClaudeCodeの優秀なワークフロー(Explore → Plan → Code)を、CursorのRules機能で再現できないだろうか?」

この疑問を解決すべく、ClaudeCodeを使ってCursor Rulesを生成し、Agentモードで開発を試してみました。

この記事では、その試行錯誤の過程と結果、そして実際に使ってみて感じたことをお伝えします。

ClaudeCodeの効果的なワークフローとは

ClaudeCodeでは、以下の4段階のワークフローが効果的とされています。

  1. Explore(探索): プロジェクトの理解とコードベースの分析
  2. Plan(計画): 実装方針の策定と詳細な計画立案
  3. Code(実装): 実際のコード生成と実装
  4. Commit(コミット): 変更内容の整理とバージョン管理

ただし、今回の検証ではCommitフェーズはスルーし、主要な開発ワークフローである最初の3段階に焦点を当てて検証を行いました。このワークフローは多くの問題に適用でき、単純なコード生成ではなく、より体系的で品質の高い開発を可能にするとされています。

Cursor Rulesとは

Cursor Rulesは、AIエージェントの振る舞いを制御するための仕組みです。現在、Cursorでは以下の種類のRulesがサポートされています。

Project Rules

.cursor/rulesディレクトリに配置される、プロジェクト固有のルール。MDC(.mdc)形式で記述し、バージョン管理の対象となります。

※ 従来の.cursorrulesファイル(レガシー)から .cursor/rulesディレクトリを使った新しい形式への移行 が推奨されています。

Rule Types

  • Always: 常にモデルコンテキストに含まれる
  • Auto Attached: 指定されたglobパターンにマッチするファイルが参照された際に適用
  • Agent Requested: AIが必要に応じて選択する(description必須)
  • Manual: @ruleNameで明示的に呼び出した場合のみ適用

User Rules

Cursor設定で定義される全プロジェクト共通のルール。

Memories

チャット履歴から自動生成されるルール。

実際にやってみた手順

以下が、私がClaudeCodeを使ってCursor Rulesを作成した際の手順です。

1. 準備(ターミナル)

既存のルールをクリア(必ずバックアップは取っておいてくださいね!)

rm .cursor/rules/*

ClaudeCode起動

claude

2. ClaudeCodeでの操作

プロジェクトを要約

> summarize this project

CLAUDE.mdファイルを作成(思考拡張モードを活用)

> /init ultrathink

Cursor Rules作成を依頼(思考拡張モードを活用)

> Explore → Plan → Code のワークフローをCursorで実現したい。Rules(`.cursor/rules/*.mdc`)を作成してください。 ultrathink

生成されたRules

ClaudeCodeが以下の4つのRulesファイルを生成してくれました。
メインのワークフローは常に参照され、各ステップの詳細ガイドは必要に応じて参照される、よく考えられた構成になっています。

ファイル 役割 概要 適用タイミング
workflow.mdc ワークフローの定義 フェーズ宣言コマンドと段階移行ルール Always(常時)
explore.mdc 探索段階の詳細ガイド プロジェクト調査チェックリストと分析手法 Agent Requested
plan.mdc 計画段階の詳細ガイド 実装計画テンプレートとリスク評価 Agent Requested
code.mdc 実装段階の詳細ガイド 技術スタック規約と実装シーケンス Agent Requested

※ 詳細なソースコードは記事末尾に掲載しています。

動作確認

生成されたRulesがちゃんと動作するか、CursorのAgentモードで検証してみました。(プロジェクト固有の情報を一部修正しています)

プロンプト: 「MyCleanupタスクをLaravel標準の機能を使って実装し直してください。」


🔍 EXPLORATION PHASE

MyCleanupタスクの現在の実装状況を調査します。まず、既存のクリーンアップコマンドを確認しましょう。

  • app/Console/Commands/MyCleanupCommand.php の読み込み
  • 関連モデル(SampleUser、SamplePost、SampleComment等)の確認
  • Laravelのスケジュール設定(routes/console.php)の確認
  • Prunableトレイトの適用状況調査

📋 PLANNING PHASE

現在の状況を整理し、Laravel標準機能を使った実装変更計画を立てます。

現在の状況分析:

  1. 現在の実装:

    • MyCleanupCommand は独自のコマンドクラス
    • 複雑な論理でSampleUser、SamplePost、SampleCommentを削除
    • 外部ストレージファイルの削除も含む
    • スケジュール: 毎日夜間に実行
  2. Laravel標準機能の活用可能性:

    • Prunable/MassPrunableトレイト
    • model:pruneコマンド
    • ファイル削除処理はpruning()メソッドで実装

実装変更計画:

  1. SampleUserモデルにMassPrunableトレイトを追加
  2. prunable()メソッドで期限切れ条件を定義
  3. pruning()メソッドで関連データと外部ストレージファイル削除処理を実装
  4. スケジュール設定をmodel:pruneコマンドに変更
  5. 古いMyCleanupCommandを削除

💻 CODING PHASE

まずSampleUserモデルを修正します:

  1. SampleUserモデルの最後にPrunable関連のメソッドを追加
  2. スケジュール設定を更新
  3. 古いMyCleanupCommandを削除

実装結果:

  • 保守性の向上: Laravel標準のPrunableトレイトを使用
  • パフォーマンス最適化: MassPrunableトレイトによる効率的な一括削除
  • コードの簡素化: 複雑なカスタムコマンドからシンプルなモデルメソッドに変更
  • 一貫性: Laravel標準のmodel:pruneコマンドで統一的に管理

期待どおりのワークフローで進行し、既存の機能は維持しつつ、フレームワーク標準の慣例に従った実装に改善してくれました。なかなかいい感じです!

他にもいくつか試してみましたが、どうもExplore(探索)Plan(計画)の部分はClaudeCodeの方が優秀で、完全再現とはいかないようです。

また、小さなコード変更をお願いしたときも常にこのワークフローが発動してしまい、開発スピードが遅くなってしまうので、その辺りはどうにかしたいところです。

試してみて分かったこと

良かったこと

  • ✅ ClaudeCodeには及ばないものの、似たような挙動を再現できた
  • ✅ 自分で一から考えるよりはるかに良いルールが生成された

伸びしろ

  • 常にこのワークフローになってしまうので、何かしら切り替えできる工夫が必要

試してみた感想

ClaudeCodeのワークフローをCursorで再現してみた結果、完全に同じレベルには到達しませんでしたが、使いどころによっては良い開発体験を得ることができました。

特に、適切にカスタマイズされたRulesを作ることで、より体系的で品質の高い開発環境を構築できることが分かったのは大きな収穫でした。

ただ、この実験を通して感じたのは、やはりClaudeCode本体の方が圧倒的にスムーズだということです。コスト面を考えると悩ましいところですが、開発効率を重視するなら素直にMaxプランを導入した方がいいかもしれませんね。

とはいえ、ClaudeCodeは使えるけどMaxプランは厳しいという方や、CursorでもClaudeCodeのようなワークフローを試してみたい方には、このアプローチは一つの選択肢になるかもしれません。

生成されたRulesファイル

実際に生成されたRulesファイルの詳細です。(プロジェクト固有の情報を一部修正しています)

.cursor/rules/workflow.mdc
---
description: 
globs: 
alwaysApply: true
---
# Exploration → Planning → Coding Workflow

Follow this sequential workflow for all development tasks:

1. **Exploration Phase** - Understand the codebase and requirements
2. **Planning Phase** - Design the solution and create implementation plan  
3. **Coding Phase** - Implement the planned solution

## Phase Definitions

### 1. Exploration Phase
**Objective**: Thoroughly understand the current codebase, requirements, and context.

**Activities**:
- Read and analyze relevant files using @filename references
- Understand existing patterns and conventions
- Identify related components and dependencies
- Research business logic and data flow

**Exit Criteria**:
- Clear understanding of current implementation
- Identified all affected components
- Understood business requirements

### 2. Planning Phase  
**Objective**: Create a detailed, actionable plan before writing code.

**Activities**:
- Define specific changes required
- Break down work into sequential steps
- Identify potential risks and edge cases
- Plan testing approach

### 3. Coding Phase
**Objective**: Implement the planned solution systematically.

## Workflow Commands
Use these explicit phase declarations:

🔍 EXPLORATION PHASE
📋 PLANNING PHASE  
💻 CODING PHASE
.cursor/rules/explore.mdc
---
description: Detailed guidelines for the Exploration phase - understanding codebase, dependencies, and business logic before implementation
globs:
alwaysApply: false
---
# Exploration Phase Guidelines

## Exploration Objectives
1. **Understand Current Implementation**: Analyze existing code structure
2. **Identify Dependencies**: Map relationships between components
3. **Understand Business Logic**: Grasp domain-specific requirements

## Project Architecture Checklist

### Backend (Laravel) Components
**Models & Relationships**:
- @app/Models/SampleUser.php - User management and authentication  
- @app/Models/ExamplePost.php - Core domain model
- @app/Models/SampleComment.php - Related content management
- Check model relationships and custom timestamp patterns

**Controllers & Routes**:
- @routes/web.php - Main application routes
- @app/Http/Controllers/ - Business logic implementation
- Route model binding patterns

### Frontend (React + TypeScript) Components  
**Pages & Layouts**:
- @resources/js/pages/ - Page components
- @resources/js/layouts/ - Layout components
- @resources/js/components/ - Reusable UI components

## Exploration Methodology
### 1. Start with Core Domain Model
🔍 First, understand the core business entity:
1. Read main domain model file
2. Check database migrations for table structure
3. Understand relationships between entities

### 2. Follow Data Flow
🔍 Trace data flow from request to response:
1. Check routes for route definition
2. Find corresponding controller
3. Identify middleware chain
4. Check frontend page component
.cursor/rules/plan.mdc
---
description: Comprehensive planning guidelines for creating detailed implementation plans, risk assessment, and testing strategies
globs:
alwaysApply: false
---
# Planning Phase Guidelines

## Planning Objectives
1. **Create Detailed Implementation Plan**: Break down work into actionable steps
2. **Identify Dependencies**: Map all required changes across the stack
3. **Plan Risk Mitigation**: Anticipate and plan for potential issues
4. **Design Testing Strategy**: Ensure quality through comprehensive testing

## Planning Framework

### 1. Database & Migration Planning
**Migration Strategy**:
```
📋 Database Changes Plan:
1. New tables needed: [table_name with columns]
2. Existing table modifications: [alterations needed]
3. Foreign key relationships: [new relationships]
4. Migration order: [dependency-aware sequence]
5. Rollback strategy: [how to undo changes]
```

### 2. Backend Implementation Planning
**Model Layer Plan**:
```
📋 Model Changes:
1. New models: [ModelName with relationships]
2. Model updates: [existing models to modify]
3. Custom route key names: [route key patterns]
4. Validation rules: [new or updated rules]
5. Observers needed: [for automated actions]
```

**Controller Layer Plan**:
```
📋 Controller Implementation:
1. New controllers: [with action methods]
2. Controller updates: [existing methods to modify]
3. Request validation: [FormRequest classes needed]
4. Middleware requirements: [auth, role, permission checks]
5. API vs Web routes: [endpoint planning]
```

### 3. Frontend Implementation Planning
**Component Architecture Plan**:
```
📋 Frontend Components:
1. New page components: [Framework pages]
2. Reusable UI components: [shared components]
3. Layout modifications: [header, sidebar, nav changes]
4. Modal components: [popup interfaces]
5. Form components: [input handling and validation]
```

**Type Definitions Plan**:
```
📋 TypeScript Types:
1. New interfaces: [data structure types]
2. Type updates: [existing interface modifications]
3. Page props: [page props structure]
4. Form types: [validation and submission types]
5. API response types: [backend data contracts]
```

### 4. Testing Strategy Planning
**Test Coverage Plan**:
```
📋 Testing Implementation:
1. Feature tests: [end-to-end user flows]
2. Unit tests: [isolated component testing]
3. API tests: [endpoint validation]
4. Database tests: [migration and model tests]
5. Frontend tests: [component and integration tests]
```

## Implementation Planning Template
```
📋 IMPLEMENTATION PLAN

## Overview
- **Feature**: [Brief description]
- **Complexity**: [High/Medium/Low]
- **Estimated Steps**: [Number of major steps]
- **Dependencies**: [External factors]

## Step-by-Step Plan
### Phase 1: Database & Models
1. [ ] Create migration for [table_name]
2. [ ] Create/update [ModelName] model
3. [ ] Add relationships and validation
4. [ ] Run migration and test

### Phase 2: Backend Logic
1. [ ] Create [ServiceName] service
2. [ ] Create/update [ControllerName] controller
3. [ ] Add routes
4. [ ] Implement validation rules

### Phase 3: Frontend Implementation
1. [ ] Create TypeScript interfaces
2. [ ] Create page component [PageName]
3. [ ] Create reusable components
4. [ ] Implement form handling

### Phase 4: Integration & Testing
1. [ ] Write feature tests
2. [ ] Write unit tests
3. [ ] Test user flows
4. [ ] Verify backwards compatibility

## Risk Assessment
### High Risk Areas
- [Identify complex or risky changes]
- [Authentication/authorization changes]
- [Data migration requirements]

### Mitigation Strategies
- [How to handle each risk]
- [Backup plans]
- [Testing approaches]
```

## Planning Completion Criteria**Ready to code when:**
- Detailed step-by-step plan exists
- All dependencies identified and resolved
- Risk mitigation strategies defined
- Testing approach specified
- Quality criteria established
.cursor/rules/code.mdc
---
description: Implementation guidelines with coding standards, conventions, and quality requirements
globs:
alwaysApply: false
---
# Coding Phase Guidelines

## Coding Objectives
1. **Follow Planned Implementation**: Execute systematically
2. **Maintain Code Quality**: Follow established patterns
3. **Ensure Robustness**: Include proper error handling

## Laravel Backend Conventions
**Model Implementation**:
```php
// Use custom route key names where established
public function getRouteKeyName(): string
{
    return 'slug';
}

// Follow relationship naming patterns
public function sampleComments(): HasMany
{
    return $this->hasMany(SampleComment::class);
}
```

**Controller Implementation**:
```php
// Use framework responses for web routes
return Inertia::render('SamplePage', [
    'posts' => $posts,
    'meta' => $meta
]);

// Use consistent validation patterns
$validated = $request->validate([
    'title' => 'required|string|max:255'
]);
```

## React + TypeScript Frontend Conventions
**Component Structure**:
```tsx
interface Props {
    user: SampleUser;
    post: ExamplePost;
    meta?: MetaData;
}

export default function SampleComponent({ user, post, meta }: Props) {
    return (
        <AppLayout user={user}>
            {/* Component content */}
        </AppLayout>
    );
}
```

## Implementation Sequence
### Step 1: Database Foundation
1. Create Migration
2. Implement Migration following existing patterns
3. Test Migration

### Step 2: Model Layer  
1. Create/Update Model
2. Implement Model Features
3. Test Model relationships

### Step 3: Service Layer
1. Create Service Classes with business logic
2. Use dependency injection
3. Handle errors gracefully

### Step 4: Controller Layer
1. Create/Update Controllers
2. Implement Controller Actions
3. Add Routes

### Step 5: Frontend Implementation
1. Create TypeScript Interfaces
2. Create Page Components
3. Create UI Components

### Step 6: Testing Implementation
1. Write Feature Tests
2. Write Unit Tests

参考

https://docs.cursor.com/context/rules

https://docs.anthropic.com/en/docs/claude-code/quickstart

https://www.anthropic.com/engineering/claude-code-best-practices

AUN Tech Blog

Discussion