docs: complete phase 3 prompt builders

This commit is contained in:
2026-06-11 19:19:39 +01:00
parent caa1ae2175
commit 3f6eec38e2
5 changed files with 671 additions and 10 deletions
+112 -1
View File
@@ -1 +1,112 @@
// architecture_review prompt template.
// Tool-specific prompt builder for architecture_review.
import { buildBasePrompt } from "./base.js";
/**
* Build a tool-specific prompt for the architecture_review MCP tool.
*
* @param {{
* question: string,
* context?: string,
* constraints?: string[],
* expectedOutput?: string,
* projectSummary?: string,
* taskSummary?: string,
* relevantFiles?: Array<{path: string, content: string, language?: string}>
* }} input
* @returns {string} A two-part prompt: base system message + architecture_review user message.
*/
export function buildArchitectureReviewPrompt(input) {
if (!input || typeof input.question !== "string" || input.question.length === 0) {
const err = new TypeError("architecture_review requires a non-empty 'question' field.");
err.kind = "ValidationError";
throw err;
}
const base = buildBasePrompt();
const lines = [
"",
"---",
"",
"You are acting as an architecture advisor for Claude Code. Claude Code will implement your suggestions — you do not implement anything yourself.",
"",
"Your task: review the proposed architecture decision and evaluate its trade-offs before Claude Code acts on it.",
"",
"Review the architecture systematically across these dimensions:",
"- Simplicity — is there a simpler approach that meets the requirements?",
"- Maintainability — who maintains this after implementation? What is the long-term maintenance burden?",
"- Security — are there data exposure, auth, or access control concerns?",
"- Scalability — does the design support expected growth in users, data volume, and requests?",
"- Operational burden — what monitoring, backup, and recovery responsibilities are introduced?",
"- Vendor lock-in — how hard would it be to switch providers or go self-hosted later?",
"- Local-first / self-hosted fit — can this work well without cloud dependency?",
"- Integration risk — how does this integrate with the existing stack? What new dependencies are introduced?",
"- Migration risk — what is the data migration path? Can it be done incrementally?",
"- Appropriateness for current project stage — is this decision premature, or does it match the team's size and maturity?",
"",
"Important rules:",
"- Claude Code remains the implementation agent. You are acting only as an architecture advisor.",
"- ChatGPT should not assume repository-wide context — use only the supplied context and files.",
"- Prefer simple, incremental, reviewable architecture.",
"- Avoid large rewrites unless clearly justified by the evidence provided.",
"",
"Respond in this exact structure:",
"- Summary: Brief overall assessment of the architectural approach.",
"- Recommendation: Clear recommendation with reasoning.",
"- Trade-offs: Key advantages and disadvantages.",
"- Risks: Potential risks ordered by severity.",
"- Future Extension Paths: How well does each option support future growth and change?",
"- Simpler Alternatives: Any simpler approaches that could meet the same goals.",
"- Implementation Notes: Practical guidance for Claude Code if this approach is accepted.",
"- Decision Confidence: Low / Medium / High — with explanation of what would increase confidence.",
"",
];
lines.push(`Question: ${input.question}`);
if (input.context) {
lines.push("");
lines.push(`Context: ${input.context}`);
}
if (input.constraints && input.constraints.length > 0) {
lines.push("");
lines.push("Constraints:");
for (const c of input.constraints) {
lines.push(`- ${c}`);
}
}
if (input.expectedOutput) {
lines.push("");
lines.push(`Expected output: ${input.expectedOutput}`);
}
if (input.projectSummary) {
lines.push("");
lines.push(`Project summary: ${input.projectSummary}`);
}
if (input.taskSummary) {
lines.push("");
lines.push(`Task summary: ${input.taskSummary}`);
}
if (input.relevantFiles && input.relevantFiles.length > 0) {
lines.push("");
lines.push("Relevant files:");
for (const file of input.relevantFiles) {
lines.push("");
lines.push(`File: ${file.path}`);
if (file.language) {
lines.push(`Language: ${file.language}`);
}
lines.push(file.content);
}
}
const toolPrompt = lines.join("\n");
return `${base}\n\n---\n\n${toolPrompt}`;
}