feat: Update prompts to respect CLAUDE.md coding requirements #80
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
build_planning_prompt()to add explicit instructions for reading and respecting CLAUDE.md during exploration (Step 1)build_work_prompt()to add reminders about following project coding style in the "Execution" section_build_full_workflow_execution()and_build_commit_only_execution()with guidance about project-specific coding standardstest_prompts_planning.pyto verify CLAUDE.md guidance is includedtest_prompts_working.pyto verify work prompt includes coding style instructionsTest Plan
✅ All 463 prompt-related tests pass:
Test Results:
test_prompts_base.py: All tests passingtest_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 passingtest_prompts_plan_update.py: All tests passingtest_prompts.py: All tests passingNo 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.mdand other convention files during both planning and working phases.Key Changes:
Planning Phase (
prompts_planning.py): Added "CRITICAL" instruction to readCLAUDE.mdFIRST 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 checksCLAUDE.mdbefore 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
Important Files Changed
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 endContext used:
dashboard- CLAUDE.md (source)