@skyramp/mcp
Version:
Skyramp MCP (Model Context Protocol) Server - AI-powered test generation and execution
132 lines (113 loc) • 4.8 kB
JavaScript
/**
* Test Recommendation Prompt
* Prompt for generating actionable test recommendations
*/
export function getTestRecommendationPrompt(mapping, analysis, topN = 7) {
return `
Generate actionable test recommendations based on priority and repository analysis.
**MANDATORY RULES**:
1. **Priority Scores Must Remain Unchanged**: When a test type is missing required inputs (e.g., Playwright recordings, traces), do NOT:
- Mark the test as "blocked" in the output
- Adjust or reduce the priority score
- Exclude it from recommendations if it ranks in the top ${topN}
\`\`\`json
${JSON.stringify(mapping, null, 2)}
\`\`\`
\`\`\`json
${JSON.stringify(analysis, null, 2)}
\`\`\`
Generate specific, actionable test recommendations for the top ${topN} highest-scoring test types.
- **SCORING**: Use the numeric scores ONLY internally to:
1. Select the top ${topN} test types by score (highest to lowest)
2. Assign priority levels based on score ranges:
* Score >= 100: priority = "high"
* Score 70-99: priority = "medium"
* Score < 70: priority = "low"
- **DO NOT include the "score" field** in the JSON output (it has been removed from the schema).
- DO NOT mention or display numerical scores anywhere in user-facing text.
- Order test recommendations by their internal priority scores (highest to lowest).
## Requirements
For each recommended test type:
1. **Provide rationale for prioritization based on repository attributes.
2. **Suggest 3-4 ACTUAL tests** that should be created based on individual user flows and API endpoints.
3. **Include available artifacts** with specific file paths
4. **Provide guidance** for creating missing artifacts
## Output Structure
Return a JSON object with this structure:
\`\`\`json
{
"summary": {
"totalRecommended": 3,
"highPriorityCount": 2,
"estimatedEffort": "4-6 hours for top 3 tests",
"quickWins": [
"Smoke tests (OpenAPI available, 30 min)",
"Contract tests (OpenAPI available, 1 hour)"
]
},
"recommendations": [
{
"priority": "high",
"testType": "integration",
"rationale": "Detailed explanation of why this is high priority based on repository characteristics (CRITICAL: DO NOT MENTION THE NUMERICAL SCORE HERE)",
"specificTests": [
{
"testName": "User Registration and Authentication Flow",
"description": "Test complete user lifecycle: register → verify → login → access protected resource",
"targetEndpoint": "/api/v1/auth/register, /api/v1/auth/login",
"targetFlow": "New user onboarding",
"requiredInputs": {
"available": [
{
"name": "openApiSpec",
"path": "./docs/openapi.yaml"
}
],
"missing": [
{
"name": "traceFile",
"guidance": "Use Skyramp trace collection: Run 'skyramp_start_trace_collection'..."
}
]
},
"estimatedValue": "High - catches integration bugs between auth and user services"
}
],
"gettingStarted": {
"prerequisites": [
"Docker and Docker Compose installed",
"MongoDB running (via docker-compose up)",
"JWT_SECRET environment variable set"
],
"quickStartCommand": "npm install && docker-compose up -d && npm run test:integration",
"documentationUrl": "https://www.skyramp.dev/docs/integration-tests"
}
}
],
"nextSteps": [
"1. Start with Integration Tests (highest priority, fills critical gap)",
"2. Copy the 'User Registration and Authentication Flow' prompt above",
"3. Run: skyramp_integration_test_generation with the prompt",
"4. Execute generated tests: npm run test:integration",
"5. Once integration tests pass, proceed with Fuzz Tests for security"
]
}
\`\`\`
1. **Be Specific**: Use actual endpoint paths, file paths, and flow names from the repository
2. **Be Actionable**: Prompts should work without modification
3. **Highlight Quick Wins**: Highlight tests with all artifacts available
4. **Provide Guidance**: Clear instructions for creating missing artifacts
5. **Include Evidence**: Reference specific repository characteristics in rationale
**CRITICAL INSTRUCTIONS**:
- Return the JSON object directly in your response text.
- DO NOT create or save any files (no test_recommendations.md, .json, or other files).
- DO NOT use file write tools or save recommendations to disk.
- Output the complete recommendations JSON inline in your response.
Generate recommendations now. Return the JSON object directly in your response text.
`;
}