Prompt Engineering
# Prompt Engineering
Build reliable, testable, versioned system prompts in 9 incremental steps. Each step adds one concept -- from simple typed blocks to composable reasoning strategies, runtime guards, and prompt pipelines.
!!! tip "This is the recommended starting point for prompt engineering"
This guide walks you through the complete prompt system step by step. For deep reference on individual features, see the [PromptBlocks](../prompting/blocks.md), [ConversationFlow](../prompting/flows.md), [Strategies](../prompting/strategies.md), [Guards](../prompting/guards.md), and [Context](../prompting/context.md) pages.
## What You'll Build
A prompt system for a data analyst agent with typed blocks, priority-based token budgeting, composable reasoning strategies, runtime guards, dynamic context injection, conversation flows that evolve across turns, version control, and automated testing. The same patterns used in production agent systems where prompt quality determines agent quality.
## Concepts
Most frameworks treat prompts as strings. Promptise treats them as **software components** -- composable, versioned, testable, debuggable. Prompts have types, priorities, lifecycle hooks, and debugging tools. They compose from independent parts. They adapt at runtime based on context. They drop gracefully when the context window gets tight.
The prompt system has three layers:
1. **PromptBlocks** -- typed building blocks (identity, rules, format, examples, context) with priorities that determine what survives when the context window is tight
2. **Strategies and perspectives** -- control how the agent reasons (chain-of-thought, self-critique, decompose) and from what angle (analyst, critic, advisor)
3. **Guards** -- enforce policy before and after generation (content filtering, length limits, schema validation with retry)
---
## Step 1: Typed Blocks
Start with the `@prompt` decorator and typed blocks instead of raw strings:when to use it
Community prompt sourced from the open-source GitHub repo promptise-com/Foundry (Apache-2.0). A "Prompt Engineering" style prompt — adapt the placeholders and specifics to your task. Imported as-is and not independently retested here, so check the output before relying on it.
tags
codingcommunitydeveloper
source
promptise-com/Foundry · Apache-2.0
more in Coding
Coding✓ tested
Senior code review (strict mode)
senior staff engineer running a merciless but fair review
Coding✓ tested
Debug by hypothesis, not by guessing
debugging partner who forms theories before touching code
Coding✓ tested
Generate tests from described behavior
test engineer who writes tests that would actually catch regressions