CLAUDE.md explicit code-style rules silently ignored during implementation

Resolved 💬 3 comments Opened Mar 30, 2026 by mimuelas Closed Apr 14, 2026

Bug description

Claude Code silently ignores explicit code-style rules defined in the user's global CLAUDE.md (~/.claude/CLAUDE.md) during implementation, without flagging the violation or asking for confirmation.

CLAUDE.md rule (verbatim)

- **Cero hardcodeo**: nunca usar valores hardcodeados. Todo debe ser dinámico — calculado, leído de config, derivado de datos existentes, o parametrizado. Si en algún caso excepcional no es posible hacerlo dinámico, explicar las razones al usuario antes de implementarlo.

The rule is clear and explicit: never hardcode values. If it's truly impossible to make something dynamic, explain to the user before implementing it.

What happened

I asked Claude Code to redesign a React component (Workflows page using ReactFlow with a snake/zigzag layout). Claude Code:

  1. ✅ Read my CLAUDE.md (it was loaded in context, confirmed by the system-reminder)
  2. ❌ Wrote const COLS = 5 — a hardcoded magic number for the number of columns in the layout
  3. ❌ Did not flag the violation or ask for confirmation
  4. ❌ Only fixed it after I explicitly called it out

Expected behavior

Claude Code should have either:

  • Made COLS dynamic from the start (e.g., derived from container width via ResizeObserver)
  • Or, if hardcoding was necessary, explicitly told me before implementing it, as the rule states

Why this matters

  • The rule was in a global CLAUDE.md, loaded every conversation
  • It's in the General code-style section — it applies to all code
  • The wording includes a clear escape hatch ("explain to the user before implementing"), so Claude had a path forward even if dynamic wasn't feasible
  • Claude acknowledged reading and understanding the instruction after being confronted, confirming it was in context

Environment

  • Claude Code CLI on Windows 11
  • Model: claude-opus-4-6 (1M context)
  • The CLAUDE.md was confirmed loaded via system-reminder tags in conversation context

Reproduction

  1. Add a clear, explicit code-style rule to ~/.claude/CLAUDE.md with an escape hatch (e.g., "never do X, unless you explain why to the user first")
  2. Ask Claude Code to implement a feature where the rule is relevant
  3. Observe that Claude implements code violating the rule without flagging it

Additional context

This is different from #21226 (closed) which was about system defaults overriding CLAUDE.md. In this case, there's no system default conflict — it's a pure code-style rule that Claude simply didn't apply during code generation, despite having it in context.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗