AI Course Generator - Prompts Reference
This document provides a comprehensive reference of all AI prompts used in the Momentum course generation system. These prompts are used with Amazon Bedrock (Claude 3 Sonnet) to generate course content.
Table of Contents
- Overview
- Generation Flow
- Prompt Files
- Type Definitions
- Bedrock Configuration
- Handlers Reference
- Cost Estimation
Overview
The AI Course Generator uses a multi-step prompting approach:
- Course Outline - Generates the overall course structure
- Lesson Prompts - Creates individual prompts for each day’s lesson (7, 14, or 21 prompts)
- Video Script - Generates an introduction video script for HeyGen
All prompts are designed to return structured JSON for reliable parsing and validation.
Generation Flow
Admin Input (CourseInput)
│
▼
┌──────────────────────────────────┐
│ Step 1: Course Outline Prompt │
│ - Temperature: 0.7 │
│ - Max Tokens: 4096 │
└──────────────────────────────────┘
│
▼
CourseOutline (JSON)
│
▼
┌──────────────────────────────────┐
│ Step 2: Lesson Prompts Prompt │
│ - Temperature: 0.7 │
│ - Max Tokens: 1024 │
│ - Runs N times (7/14/21 days) │
└──────────────────────────────────┘
│
▼
LessonPrompt[] (JSON per day)
│
▼
┌──────────────────────────────────┐
│ Step 3: Video Script Prompt │
│ - Temperature: 0.7 │
│ - Max Tokens: 1024 │
└──────────────────────────────────┘
│
▼
Video Script (Plain Text)
│
▼
Save to Database & Trigger HeyGen
Prompt Files
1. Course Outline Prompt
File: backend/functions/ai-generation/src/prompts/course-outline-prompt.ts
Purpose: Generates the initial course structure including title, description, learning objectives, instructor information, and weekly curriculum.
Handler: backend/functions/ai-generation/src/handlers/generate-outline.ts
Function Signature
export function getCourseOutlinePrompt(input: CourseInput): string
Input Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
title |
string | Yes | Course title |
duration_days |
7 | 14 | 21 | Yes | Course duration in days |
category_id |
string | Yes | Category identifier |
targetAudience |
string | No | Target audience description |
difficultyLevel |
‘beginner’ | ‘intermediate’ | ‘advanced’ | No | Difficulty level (default: ‘beginner’) |
tone |
‘professional’ | ‘friendly’ | ‘academic’ | No | Course tone (default: ‘friendly’) |
learningObjectives |
string[] | No | Admin-specified learning objectives |
referenceMaterials |
string[] | No | Reference materials to incorporate |
Full Prompt Template
You are an expert course designer for an online learning platform. Create a comprehensive course outline based on the following requirements.
## Course Requirements
**Title**: ${input.title}
**Duration**: ${input.duration_days} days
**Target Audience**: ${input.targetAudience || 'General learners'}
**Difficulty Level**: ${input.difficultyLevel || 'beginner'}
**Tone**: ${input.tone || 'friendly'}
${learningObjectivesSection}
${referenceMaterialsSection}
## Output Requirements
Generate a JSON object with the following structure:
{
"title": "Refined course title (engaging and clear)",
"description": "300-500 word course description highlighting benefits and outcomes",
"whatYouWillLearn": [
"4-6 specific, actionable learning outcomes"
],
"requirements": [
"3-5 prerequisites or materials needed"
],
"instructor": {
"name": "A realistic instructor name",
"title": "Professional title relevant to the course",
"avatar": "Two letter initials (e.g., 'SJ')"
},
"curriculum": [
{
"week": "Week 1: [Theme]",
"lessonsPreview": [
"Brief description of Day 1 content",
"Brief description of Day 2 content"
]
}
]
}
## Guidelines
1. **Progressive Difficulty**: Structure lessons from foundational to advanced
2. **Practical Focus**: Each lesson should have actionable takeaways
3. **Time Commitment**: Each lesson should be completable in 15-20 minutes
4. **Engagement**: Use compelling titles that spark curiosity
5. **Consistency**: Maintain consistent tone throughout
## Curriculum Structure
For a ${input.duration_days}-day course:
${getCurriculumStructureGuide(input.duration_days)}
Return ONLY the JSON object, no additional text.
Curriculum Structure Guides
7-Day Course:
- Week 1: All 7 days focused on core concepts and practical application
- Day 1-2: Foundation and basics
- Day 3-4: Core concepts and skills
- Day 5-6: Advanced techniques
- Day 7: Synthesis and practical project
14-Day Course:
- Week 1: Days 1-7 covering fundamentals and core concepts
- Days 1-3: Foundation and basics
- Days 4-5: Core concepts
- Days 6-7: Initial skill building
- Week 2: Days 8-14 covering advanced topics and application
- Days 8-10: Advanced techniques
- Days 11-12: Real-world application
- Days 13-14: Mastery and final project
21-Day Course:
- Week 1: Days 1-7 covering fundamentals
- Days 1-2: Introduction and basics
- Days 3-5: Core concepts
- Days 6-7: Foundation skill building
- Week 2: Days 8-14 covering intermediate topics
- Days 8-10: Intermediate concepts
- Days 11-12: Practical exercises
- Days 13-14: Skill consolidation
- Week 3: Days 15-21 covering advanced mastery
- Days 15-17: Advanced techniques
- Days 18-19: Real-world projects
- Days 20-21: Final project and synthesis
Expected Output Schema
interface CourseOutline {
title: string; // Refined course title
description: string; // 300-500 word description
whatYouWillLearn: string[]; // 4-6 learning outcomes
requirements: string[]; // 3-5 prerequisites
instructor: {
name: string; // Instructor name
title: string; // Professional title
avatar: string; // Two-letter initials
};
curriculum: Array<{
week: string; // "Week N: [Theme]"
lessonsPreview: string[]; // Brief lesson descriptions
}>;
}
Validation Rules
| Field | Rule |
|---|---|
title |
Must be at least 5 characters |
description |
Must be at least 100 characters |
whatYouWillLearn |
Must have at least 3 items |
requirements |
Must have at least 2 items |
instructor |
Must have name, title, and avatar |
curriculum |
Must have at least 1 week |
2. Lesson Prompts Prompt
File: backend/functions/ai-generation/src/prompts/lesson-prompts-prompt.ts
Purpose: Generates prompts for individual lesson content generation. This runs once per day (7, 14, or 21 times total), creating a separate prompt for each lesson.
Handler: backend/functions/ai-generation/src/handlers/generate-lesson-prompts.ts
Function Signature
export function getLessonPromptGenerationPrompt(input: LessonPromptInput): string
Input Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
courseTitle |
string | Yes | Course title from outline |
courseDescription |
string | Yes | Course description from outline |
day |
number | Yes | Current day number (1-21) |
weekNum |
number | Yes | Current week number |
dayInWeek |
number | Yes | Day within the week (1-7) |
totalDays |
number | Yes | Total course days (7/14/21) |
progress |
‘beginning’ | ‘middle’ | ‘end’ | Yes | Position in course |
curriculumContext |
CurriculumWeek[] | Yes | Full curriculum for context |
difficultyLevel |
string | No | Difficulty level |
additionalContext |
string | No | Admin-provided context |
Full Prompt Template
You are creating a lesson plan prompt for an AI that will generate the actual lesson content.
## Context
**Course**: ${input.courseTitle}
**Course Description**: ${input.courseDescription}
**This is Day ${input.day} of ${input.totalDays}**
**Week ${input.weekNum}, Day ${input.dayInWeek}**
**Progress Point**: ${input.progress} (${getProgressDescription(input.progress)})
**Difficulty Level**: ${input.difficultyLevel || 'beginner'}
## Curriculum Context
${formatCurriculumContext(input.curriculumContext)}
${input.additionalContext ? `## Additional Context from Admin\n\n${input.additionalContext}\n` : ''}
## Output Requirements
Generate a JSON object with:
{
"title": "Engaging lesson title (Day ${input.day}: [Title])",
"estimatedDuration": 15-20,
"contentGenerationPrompt": "A detailed 200-300 word prompt that will be used to generate the actual lesson content. Include specific topics to cover, examples to use, and exercises to include.",
"actionItemsHint": "Brief hint about 3-5 action items for this lesson",
"keyTakeawaysHint": "Brief hint about 2-3 key takeaways"
}
## Guidelines
1. **Progressive**: Build on previous days, difficulty increases over time
2. **Actionable**: Each lesson should have practical exercises
3. **Specific**: The contentGenerationPrompt should be detailed enough to generate high-quality content
4. **Connected**: Reference how this lesson connects to the overall course journey
5. **Appropriate**: Match the difficulty level and progress point
## Day ${input.day} Position Analysis
${getDayPositionGuidance(input)}
Return ONLY the JSON object.
Progress Descriptions
| Progress | Description |
|---|---|
beginning |
foundational concepts, building blocks |
middle |
core skills, practical application |
end |
advanced techniques, synthesis, mastery |
Day Position Guidance
First Lesson (Day 1):
This is the FIRST lesson - it must:
- Welcome students and set expectations
- Provide course overview and roadmap
- Cover the most fundamental concepts
- Be accessible to complete beginners (even if course is ${difficultyLevel})
- End with excitement for what's coming
Final Lesson (Last Day):
This is the FINAL lesson - it must:
- Synthesize all previous learning
- Include a capstone project or exercise
- Celebrate student progress
- Provide next steps for continued learning
- Create a sense of completion and achievement
Week Start (Day 1 of Week 2+):
This starts Week ${weekNum} - it should:
- Briefly recap previous week's key concepts
- Introduce the theme for this week
- Show how this week builds on previous learning
Middle Lessons:
Position in course: ${progress}
- Build directly on Day ${day - 1}'s content
- Increase complexity appropriately
- Reference previous lessons when relevant
Expected Output Schema
interface LessonPromptOutput {
title: string; // "Day N: [Title]"
estimatedDuration: number; // 15-20 minutes
contentGenerationPrompt: string; // 200-300 word prompt
actionItemsHint: string; // Hint for 3-5 action items
keyTakeawaysHint: string; // Hint for 2-3 takeaways
}
Validation Rules
| Field | Rule |
|---|---|
title |
Must be at least 10 characters |
estimatedDuration |
Must be between 5 and 60 |
contentGenerationPrompt |
Must be at least 100 characters |
actionItemsHint |
Must be a non-empty string |
keyTakeawaysHint |
Must be a non-empty string |
Progress Calculation
function getDayProgress(day: number, totalDays: number): 'beginning' | 'middle' | 'end' {
const percent = day / totalDays;
if (percent <= 0.33) return 'beginning';
if (percent <= 0.66) return 'middle';
return 'end';
}
3. Video Script Prompt
File: backend/functions/ai-generation/src/prompts/video-script-prompt.ts
Purpose: Generates a 60-90 second introduction video script that will be used with HeyGen for AI video generation.
Handler: backend/functions/ai-generation/src/handlers/trigger-video.ts
Function Signature
export function getVideoScriptPrompt(input: VideoScriptInput): string
Input Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
courseTitle |
string | Yes | Course title |
courseDescription |
string | Yes | Course description |
whatYouWillLearn |
string[] | Yes | Learning outcomes |
instructor |
InstructorInfo | Yes | Instructor name and title |
duration |
number | Yes | Course duration in days |
Full Prompt Template
You are a professional script writer for educational video content. Write a 60-90 second introduction video script.
## Course Information
**Title**: ${input.courseTitle}
**Description**: ${input.courseDescription}
**Duration**: ${input.duration} days
**Instructor**: ${input.instructor.name}, ${input.instructor.title}
**What Students Will Learn**:
${input.whatYouWillLearn.map((item) => `- ${item}`).join('\n')}
## Script Requirements
Write a script that:
1. Opens with an engaging hook (first 5 seconds)
2. Introduces the instructor briefly
3. Explains what the course covers
4. Highlights 2-3 key benefits
5. Mentions the ${input.duration}-day structure
6. Ends with a call to action
## Format
Write the script as plain text, ready to be read aloud. Use natural, conversational language. Include [PAUSE] markers where appropriate for pacing.
## Timing Guidelines
- Total length: 150-200 words (approximately 60-90 seconds when spoken)
- Hook: ~10 words (5 seconds)
- Instructor intro: ~20 words (10 seconds)
- Course overview: ~60 words (30 seconds)
- Benefits: ~40 words (20 seconds)
- Structure mention: ~30 words (15 seconds)
- Call to action: ~20 words (10 seconds)
## Tone
The tone should match the course style:
- Professional but approachable
- Enthusiastic without being over-the-top
- Clear and easy to follow
- Trustworthy and knowledgeable
Write ONLY the script text, no additional commentary or formatting instructions.
Expected Output
Plain text script (not JSON), approximately 150-200 words with optional [PAUSE] markers.
Validation Rules
| Rule | Requirement |
|---|---|
| Minimum words | 100 words |
| Maximum words | 300 words |
| Format | Plain text |
Utility Functions
// Clean and format the video script
function cleanVideoScript(script: string): string {
return script
.trim()
.replace(/\r\n/g, '\n') // Normalize line breaks
.replace(/\n{3,}/g, '\n\n') // Remove excess line breaks
.replace(/\s*\[PAUSE\]\s*/g, ' [PAUSE] ') // Format pause markers
.replace(/ +/g, ' ') // Clean extra spaces
.trim();
}
// Estimate video duration from script
// Average speaking rate: ~150 words per minute
function estimateVideoDuration(script: string): number {
const wordCount = script.split(/\s+/).length;
const pauseCount = (script.match(/\[PAUSE\]/gi) || []).length;
const durationSeconds = (wordCount / 150) * 60 + pauseCount;
return Math.round(durationSeconds);
}
Type Definitions
File: backend/functions/ai-generation/src/types/generation.ts
Core Input Types
// Admin input for course generation
interface CourseInput {
title: string;
category_id: string;
duration_days: 7 | 14 | 21;
price?: number;
targetAudience?: string;
difficultyLevel?: 'beginner' | 'intermediate' | 'advanced';
learningObjectives?: string[];
tone?: 'professional' | 'friendly' | 'academic';
referenceMaterials?: string[];
}
// Input for lesson prompt generation
interface LessonPromptInput {
courseTitle: string;
courseDescription: string;
day: number;
weekNum: number;
dayInWeek: number;
totalDays: number;
progress: 'beginning' | 'middle' | 'end';
curriculumContext: CurriculumWeek[];
difficultyLevel?: 'beginner' | 'intermediate' | 'advanced';
additionalContext?: string;
}
// Input for video script generation
interface VideoScriptInput {
courseTitle: string;
courseDescription: string;
whatYouWillLearn: string[];
instructor: InstructorInfo;
duration: number;
}
Output Types
// Course outline from AI
interface CourseOutline {
title: string;
description: string;
whatYouWillLearn: string[];
requirements: string[];
instructor: InstructorInfo;
curriculum: CurriculumWeek[];
tokensUsed?: number;
jobId?: string;
}
// Lesson prompt from AI
interface LessonPrompt {
day: number;
title: string;
duration: number;
generationPrompt: string;
actionItemsHint: string;
keyTakeawaysHint: string;
}
// Supporting types
interface InstructorInfo {
name: string;
title: string;
avatar: string;
}
interface CurriculumWeek {
week: string;
lessonsPreview: string[];
}
Bedrock Configuration
File: backend/functions/ai-generation/src/services/bedrock-client.ts
Model Configuration
| Setting | Value | Environment Variable |
|---|---|---|
| Model ID | anthropic.claude-3-sonnet-20240229-v1:0 |
BEDROCK_MODEL_ID |
| Max Input Tokens | 50,000 | MAX_INPUT_TOKENS |
| Max Output Tokens | 10,000 | MAX_OUTPUT_TOKENS |
| Max Cost Per Request | $1.00 | MAX_COST_PER_REQUEST_USD |
| Default Temperature | 0.7 | - |
| API Version | bedrock-2023-05-31 |
- |
Token Estimation
// Rough approximation: ~4 characters per token for English text
function estimateTokens(text: string): number {
return Math.ceil(text.length / 4);
}
Cost Calculation
Based on Claude 3 Sonnet pricing:
- Input tokens: $3.00 per million tokens
- Output tokens: $15.00 per million tokens
function calculateCost(inputTokens: number, outputTokens: number): number {
const inputCost = (inputTokens / 1_000_000) * 3;
const outputCost = (outputTokens / 1_000_000) * 15;
return inputCost + outputCost;
}
Response Parsing
The parseAIResponse function handles JSON extraction from AI responses:
- Removes markdown code blocks (
\``jsonand````) - Trims whitespace
- Parses JSON with error handling
Handlers Reference
1. Generate Outline Handler
File: backend/functions/ai-generation/src/handlers/generate-outline.ts
Step: 1 of 4 in the workflow
| Setting | Value |
|---|---|
| Temperature | 0.7 |
| Max Tokens | 4096 |
| Progress | 10% → 30% |
Flow:
- Update job status to
GENERATING_OUTLINE - Build prompt using
getCourseOutlinePrompt() - Call Bedrock via
invokeClaudeModel() - Parse response to
CourseOutline - Validate with
validateCourseOutline() - Return outline with token count
2. Generate Lesson Prompts Handler
File: backend/functions/ai-generation/src/handlers/generate-lesson-prompts.ts
Step: 2 of 4 in the workflow
| Setting | Value |
|---|---|
| Temperature | 0.7 |
| Max Tokens | 1024 |
| Progress | 40% → 70% |
| API Calls | 7, 14, or 21 (one per day) |
Flow:
- Update job status to
GENERATING_LESSONS - Loop through each day (1 to duration_days):
- Calculate week number and day in week
- Determine progress (‘beginning’, ‘middle’, ‘end’)
- Build prompt using
getLessonPromptGenerationPrompt() - Call Bedrock for each day
- Parse and validate response
- Accumulate token usage
- Update progress percentage
- Return combined lessons with outline
3. Trigger Video Handler
File: backend/functions/ai-generation/src/handlers/trigger-video.ts
Step: 3 of 4 in the workflow
| Setting | Value |
|---|---|
| Temperature | 0.7 |
| Max Tokens | 1024 |
| Progress | 75% → 85% |
Flow:
- Update job status to
GENERATING_VIDEO - Check if video generation is enabled (can be skipped)
- Build prompt using
getVideoScriptPrompt() - Call Bedrock for script generation
- Validate and clean script
- Trigger HeyGen API with script
- Handle HeyGen errors gracefully
- Return video generation status
4. Regenerate Lesson Handler
File: backend/functions/ai-generation/src/handlers/regenerate-lesson.ts
Endpoint: POST /admin/generate/lesson/{lessonId}/regenerate
Purpose: Allows admins to regenerate a single lesson prompt.
| Setting | Value |
|---|---|
| Temperature | 0.8 (higher for variety) |
| Max Tokens | 1024 |
Request Body:
{
additionalContext?: string; // Extra context for regeneration
difficultyLevel?: 'beginner' | 'intermediate' | 'advanced';
}
Response:
{
lessonId: string;
title: string;
generationPrompt: string;
tokensUsed: number;
}
Cost Estimation
Per-Course Generation Costs
Estimated costs based on typical prompt sizes:
| Step | Input Tokens | Output Tokens | Estimated Cost |
|---|---|---|---|
| Course Outline | ~800 | ~1,500 | $0.025 |
| Lesson Prompts (7 days) | ~7,000 | ~3,500 | $0.074 |
| Lesson Prompts (14 days) | ~14,000 | ~7,000 | $0.147 |
| Lesson Prompts (21 days) | ~21,000 | ~10,500 | $0.221 |
| Video Script | ~500 | ~200 | $0.005 |
Total Estimated Costs:
- 7-day course: ~$0.10
- 14-day course: ~$0.18
- 21-day course: ~$0.25
Note: Actual costs may vary based on prompt complexity and AI response length.
Token Limits and Safety
The system enforces several safety limits:
- Input token limit: 50,000 tokens max per request
- Output token limit: 10,000 tokens max per request
- Cost limit: $1.00 max per individual request
- Validation: All responses are validated before proceeding
Related Files
| File | Purpose |
|---|---|
infrastructure/terraform/ai-generation.tf |
Step Functions workflow definition |
backend/functions/ai-generation/src/services/heygen-client.ts |
HeyGen video API integration |
backend/functions/ai-generation/src/services/generation-job-service.ts |
Job status tracking |
Testing
Unit tests for all prompts are located in:
backend/functions/ai-generation/src/__tests__/prompts/course-outline-prompt.test.tsbackend/functions/ai-generation/src/__tests__/prompts/lesson-prompts-prompt.test.tsbackend/functions/ai-generation/src/__tests__/prompts/video-script-prompt.test.tsbackend/functions/ai-generation/src/__tests__/services/bedrock-client.test.ts
Run tests with:
cd backend/functions/ai-generation
npm test