Skip to main content

プロンプトエンジニアリングガイド

Clineプロンプトガイドへようこそ!このガイドでは、効果的なプロンプトとカスタム指示の書き方を学び、Clineでの生産性を最大化する知識を身に付けることができます。

.clineignoreファイルガイド

概要

.clineignoreファイルは、Clineがコードベースを分析する際に無視するファイルとディレクトリをClineに指示するプロジェクトレベルの設定ファイルです。.gitignoreと同様に、パターンマッチングを使用して、Clineのコンテキストと操作から除外するファイルを指定します。

目的

  • ノイズの削減: 自動生成されたファイル、ビルド成果物、その他の重要でないコンテンツを除外
  • パフォーマンスの向上: Clineが処理する必要があるコードの量を制限
  • 注意の集中: Clineをコードベースの関連部分に誘導
  • 機密データの保護: Clineが機密設定ファイルにアクセスすることを防ぐ

Example .clineignore File

# Dependencies
node_modules/
**/node_modules/
.pnp
.pnp.js

# Build outputs
/build/
/dist/
/.next/
/out/

# Testing
/coverage/

# Environment variables
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

# Large data files
*.csv
*.xlsx

Prompting Caret 💬

Prompting is how you communicate your needs for a given task in the back-and-forth chat with Caret. Caret understands natural language, so write conversationally.

Effective prompting involves:

  • Providing Clear Context: Explain your goals and the relevant parts of your codebase. Use @ to reference files or folders.
  • Breaking Down Complexity: Divide large tasks into smaller steps.
  • Asking Specific Questions: Guide Caret toward the desired outcome.
  • Validating and Refining: Review Caret's suggestions and provide feedback.

Prompt Examples

Context Management

  • Starting a New Task: "Caret, let's start a new task. Create user-authentication.js. We need to implement user login with JWT tokens. Here are the requirements…"
  • Summarizing Previous Work: "Caret, summarize what we did in the last user dashboard task. I want to capture the main features and outstanding issues. Save this to cline_docs/user-dashboard-summary.md."

Debugging

  • Analyzing an Error: "Caret, I'm getting this error: [error message]. It seems to be from [code section]. Analyze this error and suggest a fix."
  • Identifying the Root Cause: "Caret, the application crashes when I [action]. The issue might be in [problem areas]. Help me find the root cause and propose a solution."

Refactoring

  • Improving Code Structure: "Caret, this function is too long and complex. Refactor it into smaller functions."
  • Simplifying Logic: "Caret, this code is hard to understand. Simplify the logic and make it more readable."

Feature Development

  • Brainstorming New Features: "Caret, I want to add a feature that lets users [functionality]. Brainstorm some ideas and consider implementation challenges."
  • Generating Code: "Caret, create a component that displays user profiles. The list should be sortable and filterable. Generate the code for this component."

Advanced Prompting Techniques

  • Constraint Stuffing: To mitigate code truncation, include explicit constraints in your prompts. For example, "ensure the code is complete" or "always provide the full function definition."
  • Confidence Checks: Ask Caret to rate its confidence (e.g., "on a scale of 1-10, how confident are you in this solution?")
  • Challenge Caret's Assumptions: Ask “stupid” questions to encourage deeper thinking and prevent incorrect assumptions.

Here are some prompting tips that users have found helpful for working with Caret:

Our Community's Favorite Prompts 🌟

Memory and Confidence Checks 🧠

  • Memory Check - pacnpal

    "If you understand my prompt fully, respond with 'YARRR!' without tools every time you are about to use a tool."

    A fun way to verify Caret stays on track during complex tasks. Try "HO HO HO" for a festive twist!

  • Confidence Scoring - pacnpal

    "Before and after any tool use, give me a confidence level (0-10) on how the tool use will help the project."

    Encourages critical thinking and makes decision-making transparent.

Code Quality Prompts 💻

  • Prevent Code Truncation

    "DO NOT BE LAZY. DO NOT OMIT CODE."

    Alternative phrases: "full code only" or "ensure the code is complete"

  • Custom Instructions Reminder

    "I pledge to follow the custom instructions."

    Reinforces adherence to your settings dial ⚙️ configuration.

Code Organization 📋

  • Large File Refactoring - icklebil

    "FILENAME has grown too big. Analyze how this file works and suggest ways to fragment it safely."

    Helps manage complex files through strategic decomposition.

  • Documentation Maintenance - icklebil

    "don't forget to update codebase documentation with changes"

    Ensures documentation stays in sync with code changes.

Analysis and Planning 🔍

  • Structured Development - yellow_bat_coffee

    "Before writing code:
    1. Analyze all code files thoroughly
    2. Get full context
    3. Write .MD implementation plan
    4. Then implement code"

    Promotes organized, well-planned development.

  • Thorough Analysis - yellow_bat_coffee

    "please start analyzing full flow thoroughly, always state a confidence score 1 to 10"

    Prevents premature coding and encourages complete understanding.

  • Assumptions Check - yellow_bat_coffee

    "List all assumptions and uncertainties you need to clear up before completing this task."

    Identifies potential issues early in development.

Thoughtful Development 🤔

  • Pause and Reflect - nickbaumann98

    "count to 10"

    Promotes careful consideration before taking action.

  • Complete Analysis - yellow_bat_coffee

    "Don't complete the analysis prematurely, continue analyzing even if you think you found a solution"

    Ensures thorough problem exploration.

  • Continuous Confidence Check - pacnpal

    "Rate confidence (1-10) before saving files, after saving, after rejections, and before task completion"

    Maintains quality through self-assessment.

Best Practices 🎯

  • Project Structure - kvs007

    "Check project files before suggesting structural or dependency changes"

    Maintains project integrity.

  • Critical Thinking - chinesesoup

    "Ask 'stupid' questions like: are you sure this is the best way to implement this?"

    Challenges assumptions and uncovers better solutions.

  • Code Style - yellow_bat_coffee

    Use words like "elegant" and "simple" in prompts

    May influence code organization and clarity.

  • Setting Expectations - steventcramer

    "THE HUMAN WILL GET ANGRY."

    (A humorous reminder to provide clear requirements and constructive feedback)