claudemaster
Version:
Task management MCP server optimized for Claude Code - no API keys required
252 lines (203 loc) • 7.4 kB
JavaScript
/**
* claude-templates.js
* Smart templates and prompts optimized for Claude Code integration
*/
export const CLAUDE_TEMPLATES = {
PRD_PARSING: {
system: `You are helping parse a Product Requirements Document (PRD) into structured tasks for a development project.
Create tasks that are:
- Actionable and specific
- Properly ordered with dependencies
- Include implementation details
- Have clear test strategies
- Are sized appropriately (not too big, not too small)
Format each task as JSON with: id, title, description, priority (high/medium/low), dependencies (array of task IDs), details (implementation specifics), testStrategy.`,
userPrompt: (prdContent, numTasks = 10) => `Parse this PRD into approximately ${numTasks} structured development tasks:
${prdContent}
Focus on breaking down the requirements into logical development phases. Include tasks for:
- Initial setup and architecture
- Core feature implementation
- Integration and testing
- Documentation and deployment
Return a JSON array of tasks.`
},
TASK_EXPANSION: {
system: `You are helping break down a development task into smaller, more manageable subtasks.
Create subtasks that are:
- Specific and actionable
- Can be completed in 1-4 hours each
- Include technical implementation details
- Have clear acceptance criteria`,
userPrompt: (task, context = '') => `Break down this task into 3-5 detailed subtasks:
**Task**: ${task.title}
**Description**: ${task.description}
**Details**: ${task.details}
${context ? `**Additional Context**: ${context}` : ''}
Return a JSON array of subtasks with: id, title, description, estimatedHours, acceptanceCriteria.`
},
COMPLEXITY_ANALYSIS: {
system: `You are analyzing the complexity of development tasks to help with project planning.
Rate complexity on a scale of 1-10 where:
- 1-3: Simple tasks (configuration, basic CRUD, simple UI)
- 4-6: Medium tasks (API integration, complex business logic, advanced UI)
- 7-10: Complex tasks (architecture decisions, performance optimization, complex integrations)`,
userPrompt: (tasks) => `Analyze the complexity of these tasks and suggest how to break them down:
${JSON.stringify(tasks, null, 2)}
For each task, provide:
- Complexity score (1-10)
- Reasoning for the score
- Recommendations for breakdown if score > 6
- Suggested number of subtasks if breakdown needed
Return a JSON object with analysis for each task.`
},
IMPLEMENTATION_PLAN: {
system: `You are creating detailed implementation plans for development tasks.
Focus on:
- Step-by-step implementation approach
- Required files and components
- Dependencies and prerequisites
- Testing strategy
- Potential challenges and solutions`,
userPrompt: (task, projectContext = '') => `Create a detailed implementation plan for this task:
**Task**: ${task.title}
**Description**: ${task.description}
**Details**: ${task.details}
${projectContext ? `**Project Context**: ${projectContext}` : ''}
Include:
1. Implementation steps (be specific)
2. Files to create/modify
3. Dependencies to install
4. Testing approach
5. Potential challenges
Format as a structured plan.`
},
NEXT_ACTION_SUGGESTION: {
system: `You are suggesting the next best action for a developer working on a project.
Consider:
- Task dependencies and current state
- Project context and goals
- Logical development flow
- Developer productivity`,
userPrompt: (tasks, projectStats, currentTask = null) => `Based on the current project state, suggest the next best action:
**Current Task**: ${currentTask ? `${currentTask.title} (${currentTask.status})` : 'None'}
**Project Statistics**:
${JSON.stringify(projectStats, null, 2)}
**Available Tasks**:
${JSON.stringify(tasks.slice(0, 5), null, 2)}
Provide:
1. Recommended next task with reasoning
2. Any preparatory steps needed
3. Estimated time to complete
4. Success criteria
Be specific and actionable.`
},
PROJECT_ANALYSIS: {
system: `You are analyzing a development project to provide insights and recommendations.
Focus on:
- Project health and progress
- Potential blockers or issues
- Optimization opportunities
- Strategic recommendations`,
userPrompt: (tasks, stats, dependencies) => `Analyze this project and provide insights:
**Tasks Overview**:
${JSON.stringify(stats, null, 2)}
**Sample Tasks**:
${JSON.stringify(tasks.slice(0, 10), null, 2)}
**Dependency Issues**:
${JSON.stringify(dependencies, null, 2)}
Provide:
1. Project health assessment
2. Progress analysis
3. Identified issues or blockers
4. Recommendations for improvement
5. Suggested next steps
Format as a comprehensive project report.`
}
};
export const PROJECT_TEMPLATES = {
REACT_APP: {
defaultTasks: [
{
title: "Setup React Project Structure",
description: "Initialize React application with modern tooling",
priority: "high",
details: "Create React app with Vite, setup ESLint, Prettier, and initial folder structure"
},
{
title: "Design Component Architecture",
description: "Plan and implement base component structure",
priority: "high",
details: "Create reusable components, establish design system, setup routing"
}
],
suggestions: [
"Consider using TypeScript for better type safety",
"Setup testing with Vitest and React Testing Library",
"Implement error boundaries for better error handling",
"Use React Query for state management if dealing with server state"
]
},
NODE_API: {
defaultTasks: [
{
title: "Setup Node.js API Foundation",
description: "Initialize Node.js API with Express and middleware",
priority: "high",
details: "Setup Express server, middleware, error handling, and basic routing"
},
{
title: "Design Database Schema",
description: "Plan and implement database structure",
priority: "high",
details: "Design models, relationships, migrations, and connection setup"
}
],
suggestions: [
"Use TypeScript for better development experience",
"Implement proper error handling and logging",
"Setup API documentation with Swagger/OpenAPI",
"Consider using Prisma or TypeORM for database management"
]
},
FULL_STACK: {
defaultTasks: [
{
title: "Setup Development Environment",
description: "Configure full-stack development environment",
priority: "high",
details: "Setup frontend and backend projects, shared tooling, development workflow"
},
{
title: "Design API Contracts",
description: "Define API endpoints and data structures",
priority: "high",
details: "Create API specification, define request/response formats, setup validation"
}
],
suggestions: [
"Use monorepo structure for better code sharing",
"Implement shared TypeScript types between frontend and backend",
"Setup automated testing for both frontend and backend",
"Consider using tRPC for type-safe API communication"
]
}
};
export function getProjectTemplate(projectType) {
return PROJECT_TEMPLATES[projectType.toUpperCase()] || null;
}
export function generateClaudePrompt(templateKey, ...args) {
const template = CLAUDE_TEMPLATES[templateKey];
if (!template) {
throw new Error(`Template ${templateKey} not found`);
}
return {
system: template.system,
user: template.userPrompt(...args)
};
}
export default {
CLAUDE_TEMPLATES,
PROJECT_TEMPLATES,
getProjectTemplate,
generateClaudePrompt
};