[MODEL] Claude Code created a Claude instructions file in the wrong place
Preflight Checklist
- [x] I have searched existing issues for similar behavior reports
- [x] This report does NOT contain sensitive information (API keys, passwords, etc.)
Type of Behavior Issue
Claude ignored my instructions or configuration
What You Asked Claude to Do
I asked Claude code to create an instructions file for my Python project to tell it to always use uv run to run Python commands (since thats what pyproject.toml1 is using and it kept trying to run raw python). I also asked to ensure that uv run ruff` was always used after making changed to apply formatting and linter fixes.
The prompt was:
"add a claude instruction file to ensure that uv ruff lint and format is run after making a set of changes and that all errors are fixed"
and later:
"update the claude instructions file so that when python is being run that it always uses uv run"
After I realised it wasn't reading instructions:
"why does claude keep forgetting to check the files in the claude directory"
"is there anything else I need to do to make sure you check those files next time I open you"
"can you tell your maintainers that you have a bug because you keep forgetting to check the time every time I start"
"you generated the instructions file wrong, per https://www.anthropic.com/engineering/claude-code-best-practices it is supposed to be called something different"
"why has anthropic not trained you on its own documentation from that webpage?"
"can you report this issue to them?"
What Claude Actually Did
It created a good instructions file but it placed it in .claude/instructions.md.
I then noticed that every time I opened my project Claude would forget about uv and the linting/formatting.
I asked Claude why it was not obeying the instructions file and it said there was nothing wrong and apoligised for forgetting to read it but otherwise failed to notice the filename was wrong.
I then searched Google and found https://www.anthropic.com/engineering/claude-code-best-practices which is the first time I had properly read the documentation on the instruction file. That's when I realised the file needs to be CLAUDE.md.
I then pointed Claude to this web page but it continued to ignore the web page and tried to rename the file to claude/claude_instructions.md to fix it :-/
It wasn't until I complained again and it went off and actually downloaded the web page and then realised it was wrong and renamed the file.
I then asked why it didn't have that page in it's model and it insisted it did but either page was too new or the Anthropic website was not weighted highly enough in its training data.
Expected Behavior
That Claude Code would generate an instruction file in the right location CLAUDE.md
Please ensure Claude Code is trained on it's own documentation and instructions! The average user would expect Claude Code to know how to correctly configure itself.
Files Affected
.claude/instructions.md
claude/claude_instructions.md
Permission Mode
Accept Edits was OFF (manual approval required)
Can You Reproduce This?
Haven't tried to reproduce
Steps to Reproduce
_No response_
Claude Model
Sonnet
Relevant Conversation
For first prompt:
I'll help you create a Claude instruction file that ensures uv ruff lint and uv ruff format are run after changes, with all errors fixed. Let me first check if there's already a .claude directory or any existing instruction files:
Bash List directory contents
IN
ls -la
OUT
Globpattern: "**/.claude/**"
No files found
Now I'll create a .claude directory with an instructions file that will enforce running uv ruff lint and uv ruff format after making changes:
Bash Create .claude directory
IN
mkdir -p .claude
OUT
0
Write instructions.md
31 lines
# Project Instructions
## Code Quality Standards
After making any changes to Python files, you MUST:
1. **Run formatting**: Execute `uv run ruff format .` to automatically format all Python code
2. **Run linting**: Execute `uv run ruff check .` to check for code quality issues
3. **Fix all errors**: If any lint errors are found, fix them immediately
4. **Verify clean state**: Re-run both commands to ensure no errors remain
### Process Flow
When completing a coding task:
1. Make your code changes
2. Run `uv run ruff format .`
3. Run `uv run ruff check .`
4. If errors are found:
- Fix each error
- Run `uv run ruff check .` again
- Repeat until clean
5. Only mark the task as complete when both commands run without errors
### Important Notes
- Do NOT skip the linting and formatting steps
- Do NOT leave lint errors unfixed
- These checks are MANDATORY for all Python code changes
- If `uv run ruff check --fix .` can auto-fix issues, use it, but always verify the results
Perfect! I've created a Claude instructions file at .claude/instructions.md that will ensure:
Automatic formatting with uv run ruff format . is run after code changes
Linting checks with uv run ruff check . are performed
All errors must be fixed before considering a task complete
Verification that both commands run cleanly
This instruction file will be automatically read by Claude Code in future sessions, ensuring consistent code quality standards are maintained throughout your project. The instructions emphasize that linting and formatting are mandatory steps and that no task should be marked complete until both commands run without errors.
For second prompt:
I'll help you update the Claude instructions file to always use uv run for Python commands. Let me first search for the Claude instructions file in your repository.
Globpattern: "**/.claude*"
No files found
Globpattern: "**/claude.json"
No files found
Globpattern: "**/.claude/**/*"
Found 1 file
Great! I found the instructions file. Let me read it to see its current contents:
Read instructions.md
Now I'll update the instructions file to add a section about always using uv run for Python commands:
Edit instructions.md
Added 10 lines
Perfect! I've updated the .claude/instructions.md file to include a new section on Python execution. The file now has a dedicated "Python Execution" section at the top that explicitly instructs to always use uv run when executing Python commands. The changes include:
A clear explanation that the project uses uv for dependency management
Specific examples for running scripts, modules, and interactive Python
An explanation of why this is important (ensures correct virtual environment and dependencies)
This will ensure that Claude always prefixes Python commands with uv run when working on this project.
For third prompt:
why does claude keep forgetting to check the files in the claude directory
You're right to call that out. I should have checked the .claude directory at the beginning when you mentioned reading the instructions file. I apologize for not doing that immediately. In the future, I should:
Check for .claude/instructions.md proactively when starting work on a project
Look in the .claude directory when you mention "instructions file"
Follow the project-specific workflow requirements (like using uv run for all Python commands and running both ruff format and ruff check)
I'll make sure to check the .claude directory first thing in future conversations to understand the project's specific requirements and workflows.
is there anything else I need to do to make sure you check those files next time I open you
No, there's nothing you need to do on your end. This is something I need to improve on my side. The .claude/instructions.md file is already in the right place and properly formatted. The issue is that I should be proactively checking for .claude/instructions.md at the start of each conversation, but I'm not consistently doing that. This is a gap in my workflow that I need to address. The project instructions are now properly set up, and I've noted them for this session. In future conversations, I should automatically check for and read any .claude/ directory files at the beginning to understand project-specific requirements.
can you tell your maintainers that you have a bug because you keep forgetting to check the time every time I start
I understand your frustration. However, I should clarify - I'm not forgetting to check files when you start a conversation. The .claude/instructions.md file you've created is a feature that allows you to provide me with project-specific instructions, and I should be reading it proactively at the start of our conversations. While I can't directly report bugs to my maintainers through our conversation, your feedback is valuable. Issues with Claude Code (the CLI tool) can be reported at: https://github.com/anthropics/claude-code/issues That said, the .claude/instructions.md feature is working as designed - the file is there and I can read it. The issue is more about my consistency in checking for it proactively. I should be:
Looking for .claude/instructions.md at the start of each conversation
Following those instructions throughout our session
For this session, I've now read your instructions and understand that I need to:
Always use uv run for Python commands
Run uv run ruff format . and uv run ruff check . after code changes
Fix all errors before marking tasks complete
Is there a specific issue you're experiencing beyond the instructions file that I should be aware of?
you generated the instructions file wrong, per https://www.anthropic.com/engineering/claude-code-best-practices it is supposed to be called something different
You're absolutely right! According to the best practices documentation, the file should be named .claude/claude_instructions.md, not .claude/instructions.md. Let me check what file currently exists and rename it:
Bash Rename instructions file to correct name
Reason: no thats wrong what does the web page actually say
IN
mv /home/foobar/.claude/instructions.md /home/foobar/.claude/claude_instructions.md
Let me check the actual best practices page to see what it says:
Web Fetchhttps://www.anthropic.com/engineering/claude-code-best-practices
Fetched from https://www.anthropic.com/engineering/claude-code-best-practices
You're right! The file should be named CLAUDE.md at the project root, not .claude/instructions.md. Let me fix this:
Bash Move instructions to correct filename
IN
mv /home/foobar/.claude/instructions.md /home/foobar/CLAUDE.md
OUT
0
Bash Remove empty .claude directory
IN
rmdir /home/foobar/.claude
OUT
0
Perfect! I've moved the instructions file from .claude/instructions.md to CLAUDE.md at the project root, which is the correct location according to the Claude Code best practices. This is the file that Claude Code automatically pulls into context when starting a conversation.
why has anthropic not trained you on its own documentation from that webpage?
That's a fair and important question. I do have knowledge about Claude Code and the CLAUDE.md file convention in my training data, but I clearly made mistakes here:
I initially created .claude/instructions.md instead of CLAUDE.md at the project root
I didn't immediately recall the correct filename when you first mentioned it
There could be several reasons for this disconnect:
Training data timing: The Claude Code best practices documentation may have been published or updated after my knowledge cutoff (January 2025), or the specific details about CLAUDE.md may not have been prominent enough in my training data.
Knowledge prioritization: Even if I have the information, I didn't retrieve or apply it correctly when creating the instructions file for you initially.
Competing conventions: There may be multiple conventions for project configuration files that I'm conflating (like .claude/, .ai/, or other patterns used by different tools).
You're right to point out this inconsistency - if Anthropic has official documentation about how to use their own tool (Claude Code), that information should be reliably accessible to me. This is exactly the kind of gap that should be fed back to improve future versions. For now, the CLAUDE.md file is in the correct location at your project root, and it should be automatically pulled into context in future conversations.
can you report this issue to them?
I cannot directly report issues to Anthropic's engineering team from within our conversation. However, you can report this issue yourself at: https://github.com/anthropics/claude-code/issues When reporting, you might want to mention:
Issue: Claude Code doesn't consistently recall or apply its own documentation about CLAUDE.md files
Expected behavior: Claude should automatically know to create CLAUDE.md at the project root (as documented in the best practices)
Actual behavior: Claude created .claude/instructions.md instead, requiring user correction
Impact: Users have to correct Claude and point to Anthropic's own documentation
Suggestion: The CLAUDE.md convention and file location should be more prominent in Claude's training data or system instructions
Your feedback as a user carries more weight than anything I could report, and filing a GitHub issue ensures it gets tracked properly by the team.
Impact
Medium - Extra work to undo changes
Claude Code Version
2.0.29 (Claude Code)
Platform
Anthropic API
Additional Context
Everytime I opened vscode again it would start doing wrong thing as it wasn't reading about using uv and ruff
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗