Skip to content

Add CLAUDE.md for TemplateProject#25

Merged
olilarkin merged 1 commit into
masterfrom
template-claude-md
May 17, 2026
Merged

Add CLAUDE.md for TemplateProject#25
olilarkin merged 1 commit into
masterfrom
template-claude-md

Conversation

@olilarkin

Copy link
Copy Markdown
Member

Summary

  • Documents the responsive IGraphics layout pattern in TemplateProject.cpp (two-branch mLayoutFunc keyed off NControls(), SetLayoutOnResize(true), corner resizer).
  • Adds a checklist for the easy-to-miss steps when adding a new control (tag, IRECT from current bounds, SetTargetAndDrawRECTs in the resize branch, AttachControl in the initial branch).
  • Brief notes on the relevant files, config.h size/ID fields, and what to keep vs. replace after running duplicate.py.

Test plan

  • Skim rendered Markdown on GitHub

@claude

claude Bot commented May 17, 2026

Copy link
Copy Markdown

Code Review — PR #25: Add CLAUDE.md for TemplateProject

Overview: This is a documentation-only PR that adds a CLAUDE.md to TemplateProject/, explaining the responsive IGraphics layout pattern and providing a checklist for adding controls. I verified the documentation against the actual source (TemplateProject.cpp, TemplateProject.h, config.h). Overall this is accurate, well-structured, and exactly the kind of non-obvious context a CLAUDE.md should capture.


Factual accuracy

Everything cross-checks correctly against the source except one minor framing issue:

  1. First call (pGraphics->NControls() == 0): one-time setup
  2. Subsequent calls (resize): recompute every control's IRECT …

The semantics are correct, but the order is the opposite of how the code is structured: the if (pGraphics->NControls()) block (resize path) appears first in the code and ends with an early return. The initial-attach code is the fall-through below that block — not an else.

A reader who opens TemplateProject.cpp after reading the doc may be briefly confused because they'll see the resize branch listed first. Suggest adding a one-liner note:

In the code, the resize branch is the `if` block (with an early `return`);
the initial-attach code is the fall-through below it.

Also worth explicitly mentioning the return — it's the mechanism that prevents re-attaching controls on resize and is easy to accidentally delete.


Suggestions

  • NControls() == 0 is implicit, not explicit in the code. The actual guard is if (pGraphics->NControls()), so writing (pGraphics->NControls() == 0) as the parenthetical for the first-call branch, while correct logically, could mislead readers into thinking there's an == 0 check in source. Consider rephrasing to something like:

    First call (when NControls() returns 0 — no controls attached yet): …

  • The return in the resize branch is load-bearing. A note like "the resize branch returns early to skip re-attaching controls" would make the checklist even more foolproof.

  • SetLayoutOnResize(true) is called in the initial branch, not outside if. The doc implies it's a "key piece" of the overall setup, but readers might wonder where in the code to find it. A small pointer ("set in the initial-attach branch, line ~33") would help.


What's done well

  • The adding a new control checklist is the most valuable part. Steps 1–4 are complete and correctly ordered, and the "forgetting step 3 is the common mistake" callout is exactly right.
  • IRECTs computed once at the top is correctly highlighted — this is a real footgun if misunderstood.
  • The Files of interest section accurately reflects the actual directory structure.
  • The When duplicating section is appropriately brief and actionable.
  • The doc stays focused on non-obvious information rather than restating things derivable from the code itself — good discipline for a CLAUDE.md.

Minor nits

  • build-mac/ and build-win/ are listed under "Files of interest" — confirm these directories ship in the template (they're not visible in the diff context but are presumably present).
  • No issues with the Markdown formatting; renders cleanly.

Verdict: Approve with the branch-ordering clarification as the one substantive fix. The rest are minor suggestions that would improve navigation but aren't blockers.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 11bc828019

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread TemplateProject/CLAUDE.md Outdated

## When duplicating

`../duplicate.py` rewrites names and IDs across the project tree. After duplication, the layout pattern above is what you keep; the parameters, control tags, and DSP are what you replace.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Ensure duplicated CLAUDE.md is renamed

When a new plugin is created with duplicate.py, this new file is copied from TemplateProject but its contents are not rewritten because duplicate.py explicitly lists CLAUDE.md in FILTERED_FILE_NAMES. That leaves the copied project's agent instructions still saying TemplateProject and claiming names were rewritten, so agents working in the duplicated plugin get stale project context. Either allow this file to go through the rename pass or note/exclude it from copied project instructions.

Useful? React with 👍 / 👎.

@claude

claude Bot commented May 17, 2026

Copy link
Copy Markdown

Code Review

Overview

This PR adds a TemplateProject/CLAUDE.md that documents the responsive IGraphics layout pattern, and adjusts duplicate.py so that CLAUDE.md is not excluded from the string-replacement pass during project duplication. The result is that every project created with duplicate.py will carry its own correctly-named copy of this documentation.


duplicate.py change

Correct and intentional. Removing "CLAUDE.md" from FILTERED_FILE_NAMES allows the file to be copied and have its contents string-replaced (e.g. TemplateProjectMyPlugin), which is exactly what the callout in the new CLAUDE.md describes. This is the right approach.

One edge-case worth confirming: FILTERED_FILE_NAMES matches on bare filename, not path, so it would have suppressed replacement in any CLAUDE.md encountered during a duplication run — including the root-level one if it happened to be in scope. Since the root CLAUDE.md is outside the source directory being duplicated, this is harmless in practice, but it's good that the filter is now narrower.

Suggestion (minor): Add a brief comment in duplicate.py next to FILTERED_FILE_NAMES explaining why CLAUDE.md is intentionally included in the replacement pass, so a future contributor doesn't re-add it thinking it was an accidental omission:

# CLAUDE.md is intentionally NOT listed here — it should be copied and string-replaced
# so that filenames like TemplateProject.cpp resolve correctly in the duplicated project.
FILTERED_FILE_NAMES = [".DS_Store", "duplicate.py"]

TemplateProject/CLAUDE.md content

The documentation is accurate, well-structured, and targets exactly the right pain points.

Strengths:

  • The two-branch mLayoutFunc explanation (resize-branch-first + early return being "load-bearing") is precise and will save developers real debugging time.
  • The four-step checklist for adding a control is actionable, and calling out step 3 as "the common mistake" is the right emphasis.
  • The callout block explaining that the file itself gets string-replaced during duplication is a nice meta-touch that prevents confusion.
  • File-of-interest list covers all the places a new developer needs to touch.

Suggestions:

  1. Callout wording — path clarity. The line:

    This file is duplicated by ../duplicate.py along with the rest of the project

    The ../duplicate.py relative path makes sense from within TemplateProject/, but may read oddly to someone viewing the file from the repo root. Consider:

    This file is duplicated by \duplicate.py` (repo root) along with the rest of the project`

  2. Post-duplication guidance. The callout explains that filenames get rewritten, but doesn't tell developers what to do with the "TemplateProject was the original project" context that will no longer apply. Consider adding one sentence, e.g.:

    After duplication, update or remove this callout — it describes the template origin, not the duplicated project.

  3. OnHostRequestingSupportedViewConfiguration reference. This method name is mentioned inline without a file reference. Since the checklist is otherwise very precise, it might be helpful to note it lives in TemplateProject.cpp (or .h) so a reader can jump straight to it.

  4. Test plan gap. The test plan only covers rendering the Markdown. Given the duplicate.py change, a one-liner smoke test would add confidence:

    - [ ] Run `./duplicate.py TemplateProject MyPlugin MyMfr` and verify `MyPlugin/CLAUDE.md` contains `MyPlugin.cpp` (not `TemplateProject.cpp`)
    

Summary

Area Assessment
Correctness ✅ The duplicate.py change is correct and well-motivated
Documentation quality ✅ Accurate, concise, and targets real pain points
Project conventions ✅ Consistent with the root CLAUDE.md style
Test coverage ⚠️ Consider adding a duplication smoke-test to the checklist
Security ✅ No concerns

This is a solid, low-risk addition. The minor suggestions above are all optional polish — nothing blocks merging.

Documents the responsive IGraphics layout pattern (two-branch mLayoutFunc
keyed off NControls(), SetLayoutOnResize, corner resizer) and gives a
checklist for adding new controls without breaking resize behavior.
@olilarkin olilarkin force-pushed the template-claude-md branch from 13b41ba to 472ea1b Compare May 17, 2026 19:37
@olilarkin olilarkin merged commit ef419b2 into master May 17, 2026
3 checks passed
@olilarkin olilarkin deleted the template-claude-md branch May 17, 2026 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant