# Writing Good Prompts

{% embed url="<https://youtu.be/YXK7YpQamiw>" %}

Writing clear, effective prompts is a foundational skill when building workflows in MindStudio. Whether you're using AI to generate text, images, audio, or video, how you instruct the model makes a significant impact on the result. This guide walks through prompt types, strategies, formatting, and structure.

## Understanding Prompt Types

### System Prompts

System prompts define the **overall role** and **expectations** of the AI agent. They're usually written once per workflow and serve as a blueprint for how the AI should behave.

A good system prompt includes:

* **Role of the assistant** (e.g., "You are a blog post generator.")
* **General responsibilities** (e.g., "Research, write, and optimize content.")
* **Formatting guidelines** (e.g., "Use markdown.")
* **Tone/style preferences** (e.g., "Professional and concise.")
* **Constraints** (e.g., "Today’s date is June 1, 2025.")

Use the "Generate Prompt" feature in MindStudio to create a structured draft, and edit it to suit your workflow.

> Tip: Use `/* */` to add comments in the system prompt that the AI will ignore.

### Task Prompts

Task prompts are written inside individual blocks like **Generate Text**, **Generate Image**, etc. These should be **specific** to the action that block is performing.

For example:

```
Write a long-form blog post about the following topic: {{topic}}
```

Add structure and context with templating or example output to improve quality.

## Prompt Writing Techniques

### Templating with Tags

Use custom tags like `<example_output>` to show the AI what the desired output looks like.

Example:

```
<example_output>
# Title of the Post
Opening paragraph with a compelling hook.

## Section Header
Several paragraphs of information.

- Key point one
- Key point two

## Conclusion
Summarize the article.
</example_output>
```

### Using Variables

Embed variables using `{{ }}`:

```
Write a blog post about: {{topic}}
```

## Markdown Formatting

Markdown lets you structure AI-generated text for easy display in apps or websites.

Common markdown syntax:

* `#` H1 header
* `##` H2 header
* `**bold**`, `*italic*`
* `-` Bullet list
* `[link text](https://example.com)`

Markdown is especially useful in display blocks or when instructing the AI to output structured content.

## Controlling Tone

Add tone instructions to shape the AI’s voice:

* `Professional`: formal, structured
* `Casual`: friendly, conversational
* `Spartan`: brief, to-the-point

You can mix tones too:

```
Use a Spartan, professional tone.
```

Compare results by previewing the AI's response with and without tone instructions to see the impact.

## Creating Structured Outputs (JSON)

For advanced workflows, use structured outputs to extract usable data from AI responses. Switch the output schema to **JSON**.

Example JSON template:

```json
{
  "game": "Chess",
  "book": "1984",
  "dog": "Beagle"
}
```

Now the output can be parsed and reused in other blocks by referencing specific fields.

## Summary

Good prompts lead to better AI behavior. Keep these best practices in mind:

* Use system prompts for agent-wide behavior.
* Use task prompts for specific actions.
* Include example outputs and formatting instructions.
* Use variables to make prompts dynamic.
* Apply markdown for clean, structured results.
* Experiment with tone and JSON outputs for flexibility.

Mastering prompt writing will significantly improve the precision and performance of your AI agents in MindStudio.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://university.mindstudio.ai/1-core-building-principles/writing-good-prompts.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
