Skip to main content
Glama

refactor_guidance

Provides structured guidance for implementing code changes during the WRITE/REFACTOR phase to enforce disciplined programming practices.

Instructions

Get guidance for the WRITE/REFACTOR phase - implementing changes

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Dispatch handler for refactor_guidance (and other phase guidance tools). Invokes the shared handlePhaseGuidance function with the tool name and session manager.
    case 'setup_guidance': case 'audit_inventory_guidance': case 'compare_analyze_guidance': case 'question_determine_guidance': case 'refactor_guidance': case 'lint_guidance': case 'iterate_guidance': case 'present_guidance': return { content: [{ type: 'text', text: JSON.stringify(await handlePhaseGuidance(name, sessionManager), null, 2) }] };
  • Tool schema definition including name, description, and input schema for refactor_guidance.
    { name: 'refactor_guidance', description: 'Get guidance for the WRITE/REFACTOR phase - implementing changes', inputSchema: { type: 'object', properties: {} }
  • src/index.ts:145-147 (registration)
    Registration of phase guidance tools (including refactor_guidance) in the main tools array.
    // Phase guidance tools ...createPhaseGuidanceTools(), // Handles both suggestive and directive modes createTestGuidanceTool(), // TEST phase guidance
  • Core handler function for all phase guidance tools, including refactor_guidance. Determines mode (directive/suggestive) and routes to appropriate guidance generator.
    export async function handlePhaseGuidance( phaseName: string, sessionManager: SessionManager ): Promise<PhaseGuidance> { const session = sessionManager.getSession(); const isDirectiveMode = session?.workflowConfig !== undefined; // Route to appropriate guidance based on mode if (isDirectiveMode) { return getDirectiveGuidance(phaseName, sessionManager); } else { return getSuggestiveGuidance(phaseName, sessionManager); } }
  • Specific guidance content and instructions for refactor_guidance tool in suggestive mode.
    refactor_guidance: { phase: 'WRITE_OR_REFACTOR', objective: 'Implement the planned changes', instructions: [ 'Follow your implementation plan from DETERMINE_PLAN', 'Use your file editing tools to make changes', 'Remember: you must read files before modifying them', 'Make changes incrementally', 'Test frequently if possible', 'Keep track of what you\'ve changed' ], suggestedApproach: [ 'Start with one logical unit of change', 'Verify it works before moving on', 'Make related changes together', 'Use version control effectively', 'Comment on any non-obvious changes' ], importantNotes: [ 'If you haven\'t read a file yet, read it first', 'Don\'t try to change everything at once', 'Keep a list of files you\'ve modified' ], expectedOutput: { filesModified: 'Complete list of changed files', changesPerFile: 'Summary of changes in each file', testsRun: 'Any tests executed during refactoring', issues: 'Any problems encountered', deviations: 'Any changes from the original plan' }, nextPhase: 'Use lint_guidance to verify your changes', prerequisites: { completed: ['AUDIT_INVENTORY', 'QUESTION_DETERMINE'], warning: session && !session.completedPhases.includes('AUDIT_INVENTORY') ? 'Consider completing AUDIT_INVENTORY phase first to avoid unexpected issues' : null } },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/kingdomseed/structured-workflow-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server