Intro to Prompt Engineering

Learn how to craft better prompts

The Art of Effective Prompting

Although Cascade already does a good job of understanding your intent, prompt engineering is the key to unlocking Cascade's full potential. By communicating your intentions clearly, you help Cascade understand exactly what you need, resulting in faster and more accurate outputs with less back-and-forth.

Core Principles for Better Results

Effective prompts follow three fundamental principles that dramatically improve Cascade's ability to assist you:

Define Clear Objectives - Be explicit about what you want to accomplish:

  • Specify the task type (refactor, generate, explain, debug)
  • Describe the expected outcome
  • Include success criteria when applicable

Provide Relevant Context - Help Cascade understand where to focus:

  • Point to specific files, functions, or code blocks
  • Mention related components that might be affected
  • Direct Cascade to use tools like mcp or @web when additional context is needed

Establish Constraints - Set boundaries to guide Cascade's approach:

  • Specify technical requirements or frameworks to follow
  • Mention libraries or patterns to use or avoid
  • Include performance considerations when relevant

Before and After: Prompt Transformations

Code Explanation Example

Ineffective: "Explain this."

Effective: "Explain how the handleSubmit function validates form data and manages error states in this TypeScript React component."

The effective prompt specifies exactly which function to analyze and what aspects to focus on, resulting in a targeted explanation.

Feature Implementation Example

Ineffective: "Add a company field to the form."

Effective: "Add a required 'Company Name' input field below the Email field in the contact form. Update the form schema, validation logic in handleSubmit, and ensure proper error handling."

The effective prompt provides specific placement, validation requirements, and integration points, enabling Cascade to implement the feature correctly on the first attempt.