From 83706bb6a81b511b0c5cde4543383fc055c09c99 Mon Sep 17 00:00:00 2001 From: Madhura68 Date: Sun, 26 Apr 2026 23:09:19 +0200 Subject: [PATCH] feat(ST-709): implement_next_story prompt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit End-to-end workflow prompt for Claude Code: fetch context, log a plan, walk the tasks (in_progress → done), run tests, log result, commit. Takes product_id as the only argument. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/index.ts | 3 +- src/prompts/implement-next-story.ts | 65 +++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 src/prompts/implement-next-story.ts diff --git a/src/index.ts b/src/index.ts index 72870d6..4bdb489 100644 --- a/src/index.ts +++ b/src/index.ts @@ -10,6 +10,7 @@ import { registerLogImplementationTool } from './tools/log-implementation.js' import { registerLogTestResultTool } from './tools/log-test-result.js' import { registerLogCommitTool } from './tools/log-commit.js' import { registerCreateTodoTool } from './tools/create-todo.js' +import { registerImplementNextStoryPrompt } from './prompts/implement-next-story.js' const VERSION = '0.1.0' @@ -32,7 +33,7 @@ async function main() { registerLogTestResultTool(server) registerLogCommitTool(server) registerCreateTodoTool(server) - // prompts in ST-709. + registerImplementNextStoryPrompt(server) const transport = new StdioServerTransport() await server.connect(transport) diff --git a/src/prompts/implement-next-story.ts b/src/prompts/implement-next-story.ts new file mode 100644 index 0000000..03e7b9f --- /dev/null +++ b/src/prompts/implement-next-story.ts @@ -0,0 +1,65 @@ +import { z } from 'zod' +import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js' + +const argsSchema = { + product_id: z.string().min(1).describe('Scrum4Me product id (use list_products to find one)'), +} + +const PROMPT_BODY = (productId: string) => ` +You are helping a developer execute the next story in a Scrum4Me product. + +Workflow: + +1. Call \`get_claude_context\` with product_id="${productId}". + - Read the active sprint, the next story (acceptance_criteria included) + and the open todos for context. + +2. If next_story is null, stop and tell the user there is nothing in flight. + +3. Plan the implementation against the story's acceptance_criteria. + Consider task ordering and the product's definition_of_done. + +4. Call \`log_implementation\` with story_id and a concise plan + (markdown). Include metadata like { "branch": "feat/" }. + +5. For each task in the returned tasks array (already in sort_order): + a. Call \`update_task_status\` with status="in_progress" + b. Implement the task — write/modify files, run scripts as needed + c. Call \`update_task_status\` with status="done" + d. If you discovered something worth recording, call + \`update_task_plan\` with the implementation_plan markdown + +6. Run the relevant tests for the changes. + - Call \`log_test_result\` with status="PASSED" or "FAILED" and a short + summary in content. + +7. Make the git commit referencing the story code. + - Call \`log_commit\` with commit_hash, commit_message and + metadata: { "branch": "" }. + +Rules: +- Always finish each task by setting it to "done" before starting the + next one. Do not parallelise within a story. +- If a task blocks on missing info, set it back to "todo" and stop. +- Use lowercase status values (todo, in_progress, review, done). +`.trim() + +export function registerImplementNextStoryPrompt(server: McpServer) { + server.registerPrompt( + 'implement_next_story', + { + title: 'Implement the next Scrum4Me story', + description: + 'End-to-end workflow: fetch context, log a plan, walk the tasks, run tests, commit.', + argsSchema, + }, + async ({ product_id }) => ({ + messages: [ + { + role: 'user', + content: { type: 'text', text: PROMPT_BODY(product_id) }, + }, + ], + }), + ) +}