Part III: Vibe-Coding and AI-Native Prototyping
Chapter 12.2

Prompts, Rules, Skills, Templates, Memory

The vocabulary of AI interaction overlaps confusingly. Understanding the distinction between prompts, rules, skills, templates, and memory clarifies when to use each.

The Building Block Model

Think of AI interaction as composing building blocks. Each block type has different properties, costs, and use cases. The skill is in selecting the right block for each situation.

Building Block Overview

Think of AI interaction as composing building blocks, each with different properties, costs, and use cases. Prompts are direct requests for AI output, the atomic unit of AI interaction. Rules are persistent constraints on AI behavior that define boundaries the AI should not cross. Skills are reusable, composable AI capabilities that bundle prompts, rules, and context into portable units. Templates are parameterized prompt structures that define the shape of a prompt with slots for variable content. Memory is information retained across interactions, emerging from interaction history rather than being explicitly defined.

Prompts

Prompts are direct requests for AI output. They are the atomic unit of AI interaction. Every other building block is composed of prompts.

Prompt Properties

Prompts have several key properties. They are contextual, meaning their effectiveness depends heavily on surrounding context. They are ephemeral, not retained unless explicitly saved to a more durable form. They are specific, addressing particular tasks or questions rather than general capabilities.

When to Use Prompts

Prompts are appropriate for one-off tasks without reuse expectations, exploratory interactions where you are learning about a problem space, quick questions or generation requests that do not warrant formalization, and initial prompting before extracting patterns that emerge repeatedly.

QuickShip: Prompt Examples

Exploratory prompt:

"What are common patterns in logistics exception handling?"

Specific task prompt:

"Classify this email as: delayed, damaged, wrong address, refused, or other: [email content]"

Generative prompt:

"Generate 10 example customer emails about delivery exceptions, two for each category: delayed, damaged, wrong address, refused, other"

Rules

Rules are persistent constraints on AI behavior. They define boundaries that the AI should not cross regardless of the specific request.

Rule Properties

Rules have three key properties. They are persistent, applying across multiple interactions rather than single exchanges. They are constraining, limiting rather than directing output to preserve flexibility within boundaries. They are universal, applying regardless of context or task so the AI never violates them.

Rule Examples

Common rules include never logging personally identifiable information, always validating input parameters before processing, returning errors in JSON format with code and message fields, and escalating to human review when confidence falls below a specified threshold.

Rule Writing

Rules should be declarative, stating what is true rather than prescribing how to achieve it. They should be falsifiable, having clear conditions for being violated so violations can be detected. They should be minimal, including only essential constraints rather than comprehensive guidelines.

Skills

Skills are reusable, composable AI capabilities. They bundle prompts, rules, and context into portable units that can be shared and combined.

Skill Properties

Skills have three defining properties. They are reusable, designed for multiple invocations rather than single-use. They are composable, able to be combined with other skills to address complex scenarios. They are portable, transferring across tools and contexts without requiring fundamental redesign.

Skill Structure

Skill: [Name]
Purpose: [What this skill does]
Inputs: [What it requires]
Outputs: [What it produces]
Rules: [Constraints that apply]
Context: [Required context elements]
Examples: [Sample invocations]
        
QuickShip: Email Classification Skill
Skill: EmailExceptionClassifier
Purpose: Classify customer emails about delivery exceptions
Inputs: Email text, subject line
Outputs: {category, confidence, reasoning}
Rules:
  - Return classification within 5 seconds
  - Confidence must reflect actual certainty
  - Never store email content, only classification
Context:
  - Exception categories and definitions
  - Recent classification examples for calibration
Examples:
  - [See skill documentation for full examples]
            

Templates

Templates are parameterized prompt structures. They define the shape of a prompt with slots for variable content.

Template Properties

Templates have three key properties. They are parameterized, including slots for variable content that get filled in at invocation time. They are reusable, maintaining the same structure across different content. They are testable, able to be evaluated across parameter variations to ensure consistent quality.

Template Example

Template: ClassificationPrompt
Structure:
  "Classify the following {content_type} as {categories}.
   Content: {content}
   Confidence required: {min_confidence}%
   
   Return in JSON format:
   {{
     "classification": "...,
     "confidence": ...,
     "reasoning": "..."
   }}"
Parameters:
  - content_type: email, message, feedback
  - categories: comma-separated list
  - content: the text to classify
  - min_confidence: number 0-100
        

Memory

Memory is information retained across interactions. Unlike prompts, rules, skills, and templates which are explicitly defined, memory emerges from interaction history.

Memory patterns include session memory within a single conversation, cross-session memory across multiple conversations, semantic memory representing generalized knowledge from training, and episodic memory of specific experiences or events that inform future interactions.

Memory in Production Systems

For production systems, memory management becomes explicit and critical. See Chapter 18: Session State and User Memory for patterns on implementing durable memory in AI applications.

Choosing the Right Building Block

Choose the right building block based on the situation. For one-off tasks with no reuse expected, use a prompt. For persistent constraints across tasks, use a rule. For reusable capabilities requiring multiple invocations, use a skill. For the same prompt structure with different content, use a template. For information from past interactions that needs to inform current work, use memory.

Key Takeaways

Prompts, rules, skills, templates, and memory are distinct building blocks, each designed for different situations. Prompts are ephemeral, specific, direct requests suited for one-off tasks. Rules are persistent constraints that limit behavior across interactions. Skills are reusable, composable capability units designed for repeated invocation. Templates are parameterized prompt structures that enable reuse across similar but not identical tasks. Memory retains information across interactions, allowing past context to inform current work. Choose the building block that fits the situation rather than forcing a mismatch between problem and solution.

Exercise: Classifying Your AI Interactions

Review your recent AI interactions and classify each by answering several diagnostic questions. First, identify which were one-off prompts that could have been skills, suggesting they represent repeated patterns worth formalizing. Second, consider which would benefit from explicit rules, particularly those involving constraints that should consistently apply. Third, examine which involve repeated patterns that should be templates for consistency and efficiency. Fourth, reflect on where memory would improve the interaction by retaining relevant context from past exchanges.

What's Next

In Section 12.3, we examine Repository Conventions for Teams, exploring how to structure AI interaction artifacts for team collaboration.