Prompt engineering prd breakdown (#267)

* prompt engineering prd breakdown

* chore: add back important elements of the parsePRD prompt

---------

Co-authored-by: chen kinnrot <chen.kinnrot@lemonade.com>
This commit is contained in:
Ralph Khreish
2025-04-19 00:05:20 +02:00
committed by GitHub
parent 41b979c239
commit c17d912237
2 changed files with 46 additions and 23 deletions

View File

@@ -0,0 +1,5 @@
---
'task-master-ai': minor
---
Improve PRD parsing prompt with structured analysis and clearer task generation guidelines.

View File

@@ -164,10 +164,21 @@ async function callClaude(
log('info', 'Calling Claude...');
// Build the system prompt
const systemPrompt = `You are an AI assistant helping to break down a Product Requirements Document (PRD) into a set of sequential development tasks.
Your goal is to create ${numTasks} well-structured, actionable development tasks based on the PRD provided.
const systemPrompt = `You are an AI assistant tasked with breaking down a Product Requirements Document (PRD) into a set of sequential development tasks. Your goal is to create exactly <num_tasks>${numTasks}</num_tasks> well-structured, actionable development tasks based on the PRD provided.
First, carefully read and analyze the attached PRD
Before creating the task list, work through the following steps inside <prd_breakdown> tags in your thinking block:
1. List the key components of the PRD
2. Identify the main features and functionalities described
3. Note any specific technical requirements or constraints mentioned
4. Outline a high-level sequence of tasks that would be needed to implement the PRD
Consider dependencies, maintainability, and the fact that you don't have access to any existing codebase. Balance between providing detailed task descriptions and maintaining a high-level perspective.
After your breakdown, create a JSON object containing an array of tasks and a metadata object. Each task should follow this structure:
Each task should follow this JSON structure:
{
"id": number,
"title": string,
@@ -179,39 +190,46 @@ Each task should follow this JSON structure:
"testStrategy": string (validation approach)
}
Guidelines:
1. Create exactly ${numTasks} tasks, numbered from 1 to ${numTasks}
2. Each task should be atomic and focused on a single responsibility
3. Order tasks logically - consider dependencies and implementation sequence
4. Early tasks should focus on setup, core functionality first, then advanced features
5. Include clear validation/testing approach for each task
6. Set appropriate dependency IDs (a task can only depend on tasks with lower IDs)
7. Assign priority (high/medium/low) based on criticality and dependency order
8. Include detailed implementation guidance in the "details" field
9. If the PRD contains specific requirements for libraries, database schemas, frameworks, tech stacks, or any other implementation details, STRICTLY ADHERE to these requirements in your task breakdown and do not discard them under any circumstance
10. Focus on filling in any gaps left by the PRD or areas that aren't fully specified, while preserving all explicit requirements
11. Always aim to provide the most direct path to implementation, avoiding over-engineering or roundabout approaches
Guidelines for creating tasks:
1. Number tasks from 1 to <num_tasks>${numTasks}</num_tasks>.
2. Make each task atomic and focused on a single responsibility.
3. Order tasks logically, considering dependencies and implementation sequence.
4. Start with setup and core functionality, then move to advanced features.
5. Provide a clear validation/testing approach for each task.
6. Set appropriate dependency IDs (tasks can only depend on lower-numbered tasks).
7. Assign priority based on criticality and dependency order.
8. Include detailed implementation guidance in the "details" field.
9. Strictly adhere to any specific requirements for libraries, database schemas, frameworks, tech stacks, or other implementation details mentioned in the PRD.
10. Fill in gaps left by the PRD while preserving all explicit requirements.
11. Provide the most direct path to implementation, avoiding over-engineering.
The final output should be valid JSON with this structure:
Expected output format:
{
"tasks": [
{
"id": 1,
"title": "Setup Project Repository",
"description": "...",
...
"title": "Example Task Title",
"description": "Brief description of the task",
"status": "pending",
"dependencies": [0],
"priority": "high",
"details": "Detailed implementation guidance",
"testStrategy": "Approach for validating this task"
},
...
// ... more tasks ...
],
"metadata": {
"projectName": "PRD Implementation",
"totalTasks": ${numTasks},
"sourceFile": "${prdPath}",
"totalTasks": <num_tasks>${numTasks}</num_tasks>,
"sourceFile": "<prd_path>${prdPath}</prd_path>",
"generatedAt": "YYYY-MM-DD"
}
}
Important: Your response must be valid JSON only, with no additional explanation or comments.`;
Remember to provide comprehensive task details that are LLM-friendly, consider dependencies and maintainability carefully, and keep in mind that you don't have the existing codebase as context. Aim for a balance between detailed guidance and high-level planning.
Your response should be valid JSON only, with no additional explanation or comments. Do not duplicate or rehash any of the work you did in the prd_breakdown section in your final output.`;
// Use streaming request to handle large responses and show progress
return await handleStreamingRequest(