Skip to content

Conversation

@sebyx07
Copy link
Collaborator

@sebyx07 sebyx07 commented Jan 25, 2026

Summary

This PR updates the planning and working prompts to ensure Claude respects project-specific coding requirements defined in CLAUDE.md during both planning and implementation phases.

Changes:

  • Updated build_planning_prompt() to add explicit instructions for reading and respecting CLAUDE.md during exploration (Step 1)
  • Updated build_work_prompt() to add reminders about following project coding style in the "Execution" section
  • Updated _build_full_workflow_execution() and _build_commit_only_execution() with guidance about project-specific coding standards
  • Added comprehensive tests in test_prompts_planning.py to verify CLAUDE.md guidance is included
  • Added comprehensive tests in test_prompts_working.py to verify work prompt includes coding style instructions

Test Plan

✅ All 463 prompt-related tests pass:

pytest tests/core/test_prompts*.py -v

Test Results:

  • test_prompts_base.py: All tests passing
  • test_prompts_planning.py: All tests passing (including new CLAUDE.md guidance tests)
  • test_prompts_working.py: All tests passing (including new coding style tests)
  • test_prompts_verification.py: All tests passing
  • test_prompts_plan_update.py: All tests passing
  • test_prompts.py: All tests passing

No test failures, errors, or regressions.

🤖 Generated with Claude Code

Greptile Overview

Greptile Summary

This PR ensures Claude respects project-specific coding requirements by instructing it to read CLAUDE.md and other convention files during both planning and working phases.

Key Changes:

  • Planning Phase (prompts_planning.py): Added "CRITICAL" instruction to read CLAUDE.md FIRST in Step 1, before exploring the codebase. The prompt now instructs Claude to include relevant coding requirements in task descriptions so the working phase follows project standards.

  • Working Phase (prompts_working.py): Added Step 3 "Read project conventions FIRST" to both _build_full_workflow_execution() and _build_commit_only_execution(). This ensures Claude checks CLAUDE.md before making any code changes in both PR creation and commit-only modes.

  • Convention Files Coverage: Both prompts now reference multiple convention file locations: CLAUDE.md, .claude/instructions.md, CONTRIBUTING.md, .cursorrules, and .github/copilot-instructions.md.

  • Test Coverage: Added 21 comprehensive tests (9 for planning, 12 for working) that verify the guidance is properly positioned, uses strong language (CRITICAL, MUST), and appears consistently across all parameter combinations.

Alignment with CLAUDE.md:
The changes directly support the CLAUDE.md requirement for "Max 500 LOC per file" and "Single Responsibility" by ensuring Claude reads and follows these standards during code generation. The prompt structure matches the documented workflow in CLAUDE.md lines 277-301.

Confidence Score: 5/5

  • This PR is safe to merge with no risks - it only adds instructional text to prompts and comprehensive test coverage
  • The changes are purely additive instructions in prompt strings with no logic changes. The implementation correctly positions CLAUDE.md reading before other exploration/work steps in both planning and working phases. All 21 new tests pass and verify the guidance appears consistently across all code paths. The changes align perfectly with the project's CLAUDE.md guidelines and the existing architecture documented in lines 96-102 (tool configurations by phase).
  • No files require special attention

Important Files Changed

Filename Overview
src/claude_task_master/core/prompts_planning.py Added CLAUDE.md reading instructions to planning phase, properly positioned before other exploration steps with CRITICAL emphasis
src/claude_task_master/core/prompts_working.py Added coding conventions reading step to both full and commit-only workflows, positioned before making changes
tests/core/test_prompts_planning.py Added comprehensive test suite (9 tests) verifying CLAUDE.md guidance is properly included in planning prompts
tests/core/test_prompts_working.py Added comprehensive test suite (12 tests) verifying coding style guidance appears in work prompts across all parameter combinations

Sequence Diagram

sequenceDiagram
    participant Orchestrator
    participant PlanningPhase
    participant WorkingPhase
    participant CLAUDE_md

    Note over Orchestrator: User initiates task

    Orchestrator->>PlanningPhase: build_planning_prompt(goal)
    activate PlanningPhase
    
    Note over PlanningPhase: Step 1: Explore Codebase
    PlanningPhase->>CLAUDE_md: Read CLAUDE.md (FIRST - CRITICAL)
    CLAUDE_md-->>PlanningPhase: Coding requirements & conventions
    
    PlanningPhase->>PlanningPhase: Read .claude/instructions.md, CONTRIBUTING.md, etc.
    PlanningPhase->>PlanningPhase: Explore codebase (README, configs, patterns)
    
    Note over PlanningPhase: Step 2: Create Task List
    PlanningPhase->>PlanningPhase: Include coding requirements in task descriptions
    PlanningPhase-->>Orchestrator: Return plan with embedded conventions
    deactivate PlanningPhase
    
    Note over Orchestrator: Execute tasks

    loop For each task
        Orchestrator->>WorkingPhase: build_work_prompt(task, create_pr)
        activate WorkingPhase
        
        Note over WorkingPhase: Step 3: Read conventions FIRST
        WorkingPhase->>CLAUDE_md: Read CLAUDE.md
        CLAUDE_md-->>WorkingPhase: Coding standards to follow
        
        WorkingPhase->>WorkingPhase: Read .claude/instructions.md, CONTRIBUTING.md, etc.
        
        Note over WorkingPhase: Step 4: Make changes
        WorkingPhase->>WorkingPhase: Apply code changes following CLAUDE.md standards
        WorkingPhase->>WorkingPhase: Match existing patterns
        
        Note over WorkingPhase: Steps 5-8: Verify, Commit, Push, PR
        WorkingPhase-->>Orchestrator: Task complete with PR URL
        deactivate WorkingPhase
    end
Loading

Context used:

  • Context from dashboard - CLAUDE.md (source)

sebyx07 and others added 4 commits January 24, 2026 22:44
- Update build_planning_prompt() in prompts_planning.py to explicitly
  instruct Claude to read CLAUDE.md and similar convention files FIRST
  during the exploration phase
- List common convention file paths to check (.claude/instructions.md,
  CONTRIBUTING.md, .cursorrules, .github/copilot-instructions.md)
- Emphasize that coding requirements found in these files MUST be
  respected when creating tasks
- Instruct Claude to include relevant requirements in task descriptions
  so the working phase follows project standards

Co-Authored-By: Claude <noreply@anthropic.com>
- Added step 3 "Read project conventions FIRST" in both full workflow
  and commit-only execution sections
- Updated "Make changes" step to explicitly reference CLAUDE.md and
  conventions files for coding style
- Re-numbered subsequent steps to accommodate new step
- Ensures Claude reads and follows project-specific coding standards
  during the work phase when making changes

Co-Authored-By: Claude <noreply@anthropic.com>
- Add new TestClaudeMdGuidance test class with 9 comprehensive tests
- Verify planning prompt instructs Claude to read CLAUDE.md FIRST
- Verify CRITICAL marker emphasizes reading project conventions
- Verify alternative convention files are listed (.claude/instructions.md, etc.)
- Verify coding requirements MUST be followed
- Verify requirements should be included in task descriptions
- Verify architecture AND coding standards both mentioned
- Verify conventions reading positioned before other exploration
- Verify "if exists" conditional for CLAUDE.md
- All 101 tests in test_prompts_planning.py pass

Co-Authored-By: Claude <noreply@anthropic.com>
- Add TestClaudeMdGuidance class to test_prompts_working.py
- Verify CLAUDE.md reading instruction is present
- Test that CLAUDE.md is mentioned before making changes
- Verify alternative convention files are listed
- Test coding standards must be followed
- Verify follow project coding style in "Make changes" section
- Test match existing patterns instruction
- Verify conventions in both create_pr and commit-only modes
- Test read conventions step before make changes step
- Verify conventions files in repository root
- Test coding requirements context preserved
- Verify both workflows have same coding guidance
- All 11 new tests pass, total 122 tests pass
- prompts_working.py coverage now 100%

Co-Authored-By: Claude <noreply@anthropic.com>
@sebyx07 sebyx07 added the claudetm PRs created by Claude Task Master label Jan 25, 2026
- Add `list[dict[str, Any]]` type annotation to `test_cases` variable
- Import `Any` from typing module
- Fixes mypy error: "Argument after ** must be a mapping, not object"

Co-Authored-By: Claude <noreply@anthropic.com>
@sebyx07 sebyx07 merged commit 47b026c into main Jan 25, 2026
9 checks passed
@sebyx07 sebyx07 deleted the feat/respect-claude-md-coding-requirements branch January 25, 2026 04:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

claudetm PRs created by Claude Task Master

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants