Skip to content

refactor: rework claude files#22473

Merged
ludamad merged 1 commit intonextfrom
claudebox/f18c94945cd45704-3
Apr 23, 2026
Merged

refactor: rework claude files#22473
ludamad merged 1 commit intonextfrom
claudebox/f18c94945cd45704-3

Conversation

@AztecBot
Copy link
Copy Markdown
Collaborator

@AztecBot AztecBot commented Apr 10, 2026

Summary

Reworks .claude/ layout and CLAUDE.md files across the monorepo. Takes inspiration from the claude system prompt (XML tags) and a other repos (e.g. a lack of rules files). Included a few wishlist items from the team, and rearranged according to the new idea of claude organization.

@AztecBot AztecBot added ci-draft Run CI on draft PRs. claudebox Owned by claudebox. it can push to this PR. labels Apr 10, 2026
@AztecBot AztecBot force-pushed the claudebox/f18c94945cd45704-3 branch 2 times, most recently from fc1876c to d92d6f6 Compare April 10, 2026 18:05
@AztecBot AztecBot changed the title chore: add root CLAUDE.md and .claude/aztec-rules for cross-cutting Claude guidance chore: add shared Claude rules via native .claude/rules/ path Apr 10, 2026
Comment thread .claude/rules/common-mistakes.md Outdated
Comment thread .claude/rules/common-mistakes.md Outdated
Comment thread .claude/rules/common-mistakes.md Outdated
Comment thread .claude/rules/monorepo.md Outdated
Comment thread .claude/rules/git-workflow.md Outdated
Comment thread .claude/rules/attribution.md Outdated
Comment thread .claude/rules/session-analysis.md Outdated
Comment thread .claude/rules/common-mistakes.md Outdated
@ludamad
Copy link
Copy Markdown
Collaborator

ludamad commented Apr 14, 2026

/claudebox please iterate on feedback here

@AztecBot
Copy link
Copy Markdown
Collaborator Author

AztecBot commented Apr 14, 2026

Run #1 — Session completed (5m)
Live status

Pushed review feedback fixes to #22473 — addressed all 6 comments (merge-train generalization, PR diff guidance, post-edit hook note, removed duplicate commit messages section, removed retrospective agent). Details: https://gist.github.com/AztecBot/72f1d7499c23bbde6304503cac391d6f

@ludamad ludamad force-pushed the claudebox/f18c94945cd45704-3 branch from 370261e to 264878d Compare April 14, 2026 20:46
@ludamad ludamad changed the title chore: add shared Claude rules via native .claude/rules/ path chore(.claude): rework layout, format hook, and narrow rules cribbed from prior art Apr 15, 2026
ludamad added a commit that referenced this pull request Apr 16, 2026
…neric rules

Delete yarn-project/.claude/rules/ entirely — same treatment as the root
.claude/rules/ deletion in the first commit. The directory had unreliable
auto-loading semantics confirmed experimentally on PR #22473. Content is
now inlined into yarn-project/CLAUDE.md as XML-tagged sections:

  <typescript_style> with nested <type_safety>, <type_colocation>,
  <data_structures>, <error_handling>, <class_style>, <jsdoc>,
  <enums_and_unions>, <resource_management>, <kv_store_transactions>,
  <general_style>, <code_duplication>, <collections_and_maps>, <logging>,
  <import_organization>, <event_handling>

  <ci_config> for the flaky-test pattern markup

Code examples from the original typescript-style.md are dropped in favor
of concise rule statements — the rules are actionable on their own, and
the codebase itself serves as the canonical example set.

Root CLAUDE.md gains five new generic XML sections:

  <test_behavior_not_mocks> — sourced from selfxyz/self CLAUDE.md:
    "Prefer tests that validate behavior. Avoid tests that only assert
     mocks were called unless that is the behavior being validated."
  <reuse_before_writing> — sourced from selfxyz/self CLAUDE.md:
    "Before writing new code, search for existing utilities/components/
     flows and reuse or refactor to shared modules."
  <making_decisions> — sourced from selfxyz/self CLAUDE.md:
    "Make decisions, not options."
  <preserve_todos> — sourced from ShieldBattery/ShieldBattery AGENTS.md:
    "Preserve TODO(context) and NOTE(context) comments unless completing
     the TODO."
  <no_single_file_folders> — sourced from selfxyz/self CLAUDE.md:
    "Do not create a folder that exists only to hold one markdown file."

yarn-project/CLAUDE.md also gains a <type_colocation> rule sourced from
ShieldBattery/ShieldBattery AGENTS.md, and the Dependency Management
section now explains the tsconfig project-references regeneration
workflow via yarn prepare, sourced from MetaMask/ocap-kernel AGENTS.md.
@ludamad
Copy link
Copy Markdown
Collaborator

ludamad commented Apr 20, 2026

@spalladino some changes here, still needs some tweaking but I appreciate your feedback

@spalladino
Copy link
Copy Markdown
Contributor

@ludamad my feedback is why are you working on this PR at 9pm while on vacation

image

Comment thread .claude/scripts/format-file.sh Outdated
Comment on lines +2 to +5
# Regression test for the layout rule: every subdir that owns its own .claude/
# must symlink agents/ to the repository root's .claude/agents/. Without the
# symlink, Claude Code's upward-walk stops at the subdir .claude/ and silently
# shadows every root agent.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good catch. Does this apply to other folders as well, like skills?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It would cause skills to be loaded multiple times I think. They are loaded dynamically just fine

Comment thread .claude/README.md Outdated
Comment thread .claude/README.md Outdated
Comment thread yarn-project/CLAUDE.md

```

<typescript_style>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why the move to these tags? I understand why no shared rules in top-level, but why not here?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Rules just don't compose well. These way they get naturally included as yp is mentioned. It's better imo. I'd defer to you

Copy link
Copy Markdown
Collaborator

@ludamad ludamad Apr 20, 2026

Choose a reason for hiding this comment

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

Imo let's use rules only if we use front matter which Claude.md can't do. Are you okay with that rule?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I genuinely believe that XML tags work best here. Anthropic would have abandoned them for their system prompt if not.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I have no idea of which of the two works best. I like rules because they are split across multiple files and are easier for humans to parse. But if this works better for Claude, let's stick with this.

Comment thread CLAUDE.md
Comment thread CLAUDE.md
Comment thread CLAUDE.md Outdated
@ludamad
Copy link
Copy Markdown
Collaborator

ludamad commented Apr 20, 2026

@ludamad my feedback is why are you working on this PR at 9pm while on vacation

It hasn't been pushed to in a while! Trying to do my friend Claude a favour

@ludamad
Copy link
Copy Markdown
Collaborator

ludamad commented Apr 20, 2026

But ofc everyone do as palla says not as I do

@ludamad
Copy link
Copy Markdown
Collaborator

ludamad commented Apr 22, 2026

@spalladino okay it should be ready for another look. Eager to get this in, but want to get it in right, so don't feel bad if you think anything needs rethinking

@ludamad ludamad changed the title chore(.claude): rework layout, format hook, and narrow rules cribbed from prior art chore(.claude): layout, format hook Apr 22, 2026
@ludamad ludamad changed the title chore(.claude): layout, format hook refactor: rework claude files Apr 22, 2026
Copy link
Copy Markdown
Contributor

@spalladino spalladino left a comment

Choose a reason for hiding this comment

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

LGTM!

@ludamad ludamad marked this pull request as ready for review April 23, 2026 17:21
@ludamad ludamad enabled auto-merge April 23, 2026 17:22
## Summary

Reworks `.claude/` layout and CLAUDE.md files across the monorepo. Takes inspiration from the claude system prompt (XML tags) and a other repos (e.g. a lack of rules files). Included a few wishlist items from the team, and rearranged according to the new idea of claude organization.

Co-authored-by: ludamad <adam.domurad@gmail.com>
@AztecBot AztecBot force-pushed the claudebox/f18c94945cd45704-3 branch from f0142da to d6e2372 Compare April 23, 2026 17:52
@ludamad ludamad added this pull request to the merge queue Apr 23, 2026
Merged via the queue into next with commit de146bd Apr 23, 2026
19 checks passed
@ludamad ludamad deleted the claudebox/f18c94945cd45704-3 branch April 23, 2026 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-draft Run CI on draft PRs. claudebox Owned by claudebox. it can push to this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants