Skip to content

chore: add CLAUDE.md and AGENTS.md for AI coding assistants#1930

Merged
peppescg merged 4 commits intomainfrom
chore/add-claude-agents-md
Apr 7, 2026
Merged

chore: add CLAUDE.md and AGENTS.md for AI coding assistants#1930
peppescg merged 4 commits intomainfrom
chore/add-claude-agents-md

Conversation

@peppescg
Copy link
Copy Markdown
Collaborator

@peppescg peppescg commented Apr 7, 2026

Summary

  • Add CLAUDE.md with Claude Code-specific project guidance (build commands, architecture, conventions, testing patterns)
  • Add AGENTS.md as a tool-agnostic equivalent for other AI assistants (Cursor, Copilot, Codex, etc.)
  • Aligns with the pattern already established in stacklok/toolhive

What's included in both files:

  • Project overview and essential commands
  • Pre-commit requirements (lint + type-check)
  • Electron three-process architecture overview
  • Code conventions (kebab-case files, path aliases, named exports)
  • Testing patterns (Vitest + Testing Library + MSW)
  • Pointers to existing documentation

CLAUDE.md vs AGENTS.md

  • CLAUDE.md is read automatically by Claude Code at conversation start — includes more detail on architecture and feature organization
  • AGENTS.md follows the emerging multi-tool standard — slightly more concise, works with Cursor, Copilot, Codex, etc.

Test plan

  • Verify CLAUDE.md is loaded by Claude Code in a new conversation
  • Verify AGENTS.md is picked up by other AI assistants
  • Review content for accuracy and completeness
  • Ensure no sensitive information is included

🤖 Generated with Claude Code

@github-actions github-actions Bot added the size/S label Apr 7, 2026
@peppescg peppescg self-assigned this Apr 7, 2026
Add project-level instruction files for AI coding assistants:
- CLAUDE.md: Claude Code-specific guidance with project overview,
  build commands, architecture, conventions, and testing patterns
- AGENTS.md: Tool-agnostic equivalent for other AI assistants
  (Cursor, Copilot, Codex, etc.)

Both files document essential commands, pre-commit requirements,
Electron architecture, code conventions, and testing patterns to
reduce repetitive context-setting across conversations.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@peppescg peppescg force-pushed the chore/add-claude-agents-md branch from 05d5e55 to 860dd15 Compare April 7, 2026 11:12
Add sections identified from best practices research:

CLAUDE.md (106 → 150 lines):
- Auto-generated code rules (never edit manually)
- IPC communication patterns (main ↔ renderer)
- External services (ToolHive API, Sentry, AI Chat)
- Database (SQLite in main process)
- Common gotchas (Docker, Node version, native modules)
- Deep links protocol

AGENTS.md (87 → 110 lines):
- Auto-generated code rules
- Boundaries section (standard AGENTS.md spec)
- Common gotchas
- Electron test runner note

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@peppescg peppescg marked this pull request as ready for review April 7, 2026 11:57
Copilot AI review requested due to automatic review settings April 7, 2026 11:57
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds repository guidance files for AI coding assistants to standardize how automated tools interact with the ToolHive Studio codebase (commands, architecture, conventions, and testing/mocking patterns).

Changes:

  • Add CLAUDE.md with Claude Code-oriented repository guidance.
  • Add AGENTS.md with tool-agnostic guidance for other assistants.
  • Document project commands, Electron architecture, code conventions, and testing patterns.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
CLAUDE.md Adds detailed Claude Code guidance including commands, architecture, conventions, and testing notes.
AGENTS.md Adds concise, tool-agnostic assistant guidance covering the same key areas.

Comment thread CLAUDE.md Outdated
Comment thread CLAUDE.md Outdated
Comment thread AGENTS.md Outdated
Comment thread AGENTS.md Outdated
Copy link
Copy Markdown
Contributor

@JAORMX JAORMX left a comment

Choose a reason for hiding this comment

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

Thanks for putting this together! Having a CLAUDE.md here makes a lot of sense, especially since we already have one in the toolhive backend repo. There are a few things worth fixing before merging though.

Bug: wrong path for route-tree.gen.ts

Both files say renderer/src/routes/route-tree.gen.ts. The actual file lives at renderer/src/route-tree.gen.ts (one level up, not inside routes/). This is the kind of mistake that would actively send Claude in the wrong direction... which is the opposite of what we want from a corrections file.

CLAUDE.md is too long

So, the thing about CLAUDE.md is that it's a correction file, not documentation. It exists to fix what Claude gets wrong without it. Every line should earn its place by preventing a real mistake. Right now it's at 150 lines. Target should be around 60-100.

A lot of what's here is stuff Claude can figure out by reading package.json, the directory structure, and the existing docs:

  • The "Feature Organization" directory tree... Claude can just ls for this.
  • "IPC Communication" section... this is how every Electron app works. Claude knows.
  • "External Services" section... derivable from package.json dependencies.
  • "Database" section... discoverable from the code.
  • "Key Documentation" section at the bottom... Claude can find docs/ on its own.

The highest-value sections are "Common Gotchas" and "Auto-Generated Code." Those are the things that will bite you without being told. The rest is padding that'll drift out of date and add noise.

AGENTS.md maintenance story

I get the intent (Cursor, Copilot, Codex compatibility), but maintaining two files with ~80% overlap is going to lead to drift. When someone updates one and forgets the other, they'll contradict each other. Worth considering whether AGENTS.md should just reference CLAUDE.md for shared content, or whether the overlap should be extracted somewhere common.

Also, AGENTS.md pins specific major versions ("React 19, TypeScript 6, Electron 41, and Vite 8") that will go stale the moment any of them bumps. CLAUDE.md wisely avoids this. AGENTS.md should do the same.

Nits

  • The # CLAUDE.md and # AGENTS.md headings at the top of each file are unnecessary. Claude (and other tools) already know what file they're reading.
  • The gotchas section is the highest-ROI part of a CLAUDE.md but it's buried at the bottom. Consider making it more prominent.
  • lint-staged in package.json already enforces lint + format on commit via husky, so the "always run lint before committing" instruction is partially redundant with the hook setup. Worth noting that the hook exists so Claude doesn't manually re-run what the hook already does.

What's good

  • Commands section is clean and correct. All scripts verified against package.json.
  • The auto-generated code warnings are correct and high-value.
  • Conventional commits mention is useful since CI enforces it.
  • The .claude/skills/deep-links/ pointer is a nice touch.

Overall the bones are good... just needs the path fix, some pruning, and a think about the two-file maintenance story.

@peppescg
Copy link
Copy Markdown
Collaborator Author

peppescg commented Apr 7, 2026

Thanks for putting this together! Having a CLAUDE.md here makes a lot of sense, especially since we already have one in the toolhive backend repo. There are a few things worth fixing before merging though.

Bug: wrong path for route-tree.gen.ts

Both files say renderer/src/routes/route-tree.gen.ts. The actual file lives at renderer/src/route-tree.gen.ts (one level up, not inside routes/). This is the kind of mistake that would actively send Claude in the wrong direction... which is the opposite of what we want from a corrections file.

CLAUDE.md is too long

So, the thing about CLAUDE.md is that it's a correction file, not documentation. It exists to fix what Claude gets wrong without it. Every line should earn its place by preventing a real mistake. Right now it's at 150 lines. Target should be around 60-100.

A lot of what's here is stuff Claude can figure out by reading package.json, the directory structure, and the existing docs:

  • The "Feature Organization" directory tree... Claude can just ls for this.
  • "IPC Communication" section... this is how every Electron app works. Claude knows.
  • "External Services" section... derivable from package.json dependencies.
  • "Database" section... discoverable from the code.
  • "Key Documentation" section at the bottom... Claude can find docs/ on its own.

The highest-value sections are "Common Gotchas" and "Auto-Generated Code." Those are the things that will bite you without being told. The rest is padding that'll drift out of date and add noise.

AGENTS.md maintenance story

I get the intent (Cursor, Copilot, Codex compatibility), but maintaining two files with ~80% overlap is going to lead to drift. When someone updates one and forgets the other, they'll contradict each other. Worth considering whether AGENTS.md should just reference CLAUDE.md for shared content, or whether the overlap should be extracted somewhere common.

Also, AGENTS.md pins specific major versions ("React 19, TypeScript 6, Electron 41, and Vite 8") that will go stale the moment any of them bumps. CLAUDE.md wisely avoids this. AGENTS.md should do the same.

Nits

  • The # CLAUDE.md and # AGENTS.md headings at the top of each file are unnecessary. Claude (and other tools) already know what file they're reading.
  • The gotchas section is the highest-ROI part of a CLAUDE.md but it's buried at the bottom. Consider making it more prominent.
  • lint-staged in package.json already enforces lint + format on commit via husky, so the "always run lint before committing" instruction is partially redundant with the hook setup. Worth noting that the hook exists so Claude doesn't manually re-run what the hook already does.

What's good

  • Commands section is clean and correct. All scripts verified against package.json.
  • The auto-generated code warnings are correct and high-value.
  • Conventional commits mention is useful since CI enforces it.
  • The .claude/skills/deep-links/ pointer is a nice touch.

Overall the bones are good... just needs the path fix, some pruning, and a think about the two-file maintenance story.

Thanks for the review 🙌
I don't know why claude code referred to a wrong routes path 😆

Changes based on JAORMX and Copilot review:
- Fix wrong path: route-tree.gen.ts is at renderer/src/, not renderer/src/routes/
- Trim CLAUDE.md from 150 to 104 lines (remove Feature Organization tree,
  IPC Communication, External Services, Database, Key Documentation sections)
- Trim AGENTS.md from 110 to 62 lines (remove Architecture table, Key Libraries,
  Feature Structure — reduce overlap with CLAUDE.md)
- Move Common Gotchas up (right after Environment Requirements)
- Remove redundant headings (# CLAUDE.md, # AGENTS.md)
- Remove pinned versions from AGENTS.md (React 19, TypeScript 6, etc.)
- Fix lint description: "Run ESLint" instead of "--max-warnings 0"
- Fix test description: "watch mode" instead of "interactive, requires display"
- Fix .env.local reference (not gitignored — removed)
- Clarify pre-commit: husky covers lint+format, type-check is manual

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
JAORMX
JAORMX previously approved these changes Apr 7, 2026
Comment thread CLAUDE.md Outdated
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Comment thread CLAUDE.md
@peppescg peppescg merged commit 38ec701 into main Apr 7, 2026
21 checks passed
@peppescg peppescg deleted the chore/add-claude-agents-md branch April 7, 2026 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants