chore: add Duplication Watch (Rule of Three) section to CLAUDE.md - #37
Merged
Conversation
Codifies the rule that surfaced during the language-* edge function consolidation: before copying an entire file as a sibling, check if it's the 3rd instance of a pattern. If yes, parameterize first. Lists the known parameterized patterns in this repo so future sessions know to extend them rather than clone: - language-feedback / language-chat (parameterized by targetLang) - LanguageContext.tsx Translations type - COMPASSION_PHRASES, EMOTION_SUGGESTIONS, VAGUE_EMOTIONS, GARDEN_THEMES config arrays Also adds the spec/plan checklist question: "Does this create a 3rd instance of an existing pattern?" Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Codifies the rule that should have prevented the late
language-*edge function consolidation in #36: before copying an entire file as a sibling, stop at copy #3 and parameterize first.Why
PR #36 collapsed 4 language-specific edge functions (
french-feedback,chinese-feedback,french-chat,chinese-chat) into 2 generic ones parameterized bytargetLang. That consolidation should have happened at instance #3 (Chinese being added in PR #29), not at instance #4 (Japanese being added in #36).The lateness exposed a pre-existing bug (Spanish routes to French edge function), required a rebase + codemod sweep, and added ~2 hours of work that could have been avoided.
This CLAUDE.md section is the prevention: future sessions (and subagents that auto-load CLAUDE.md) will see the rule and flag pattern-creation at copy #3.
What's in the section
language-*edge fns,Translationstype,COMPASSION_PHRASES,EMOTION_SUGGESTIONS,VAGUE_EMOTIONS,GARDEN_THEMESTest plan
## Coding Standards, after Option Pattern, before ADHD-Friendly UX PrinciplesThis is doc-only. No code changes, no tests.
🤖 Generated with Claude Code