Skip to content

Add .claude/ Claude Code tooling and root CLAUDE.md#770

Merged
yungyuc merged 1 commit into
solvcon:masterfrom
yungyuc:dev/claude-dir
May 12, 2026
Merged

Add .claude/ Claude Code tooling and root CLAUDE.md#770
yungyuc merged 1 commit into
solvcon:masterfrom
yungyuc:dev/claude-dir

Conversation

@yungyuc
Copy link
Copy Markdown
Member

@yungyuc yungyuc commented May 12, 2026

Set up project-tuned Claude Code configuration so the agent loads the project-specific guidance and uses the right wrappers, subagents, and deterministic checks when working on this codebase.

Root CLAUDE.md (replacing the gitignored placeholder): project overview, Claude Code Tooling index (slash commands, subagents, hooks, settings, status line), Build Commands quick reference and configuration, Architecture summary with load-bearing pieces and a pointer to cpp/modmesh/, Code Style at-a-glance (full rules in STYLE.md), PR guidelines, development notes, and common development patterns.

Remove the now-redundant contrib/prompt/CLAUDE.md and update gitignore entry for the root CLAUDE.local.md.

.claude/:

  • settings.json: permission allow/deny scoped to the Makefile workflow (make targets, cmake, pytest, lint/format tools, read-only git/gh). Destructive operations (force push, hard reset, git clean -fd, rm -rf / and ~, sudo) blocked; make clean/cmakeclean deliberately prompt. Wires the hook and the status line below.
  • hooks/check-source.sh: PostToolUse on Write|Edit of source files (*.py, *.cpp, *.hpp, ...). Deterministic checks for non-ASCII bytes, trailing whitespace, missing modeline, and Python >79 chars; exits 2 with path:line -- rule -- fix.
  • statusline.sh: reads session JSON via jq; prints <model> | <project> | <branch>[*if dirty] | ctx <%>.
  • commands/{build,pytest,gtest,lint,format}.md: slash commands wrapping the corresponding make targets. Each ends with verdict: clean | issues found | blocking.
  • agents/{cpp,python}-style-reviewer.md -- judgment-call style reviewers (m_ prefix in context, function-body placement, SimpleCollector preference, pybind11 binding split, test intent, naming). Scoped to git diff; pinned model: sonnet. Defer to STYLE.md as canonical; hooks own the deterministic rules.

Aslo add a standalone reference file contrib/prompt/general-rule.md without automaticaly imported into CLAUDE.md.

Set up project-tuned Claude Code configuration so the agent loads the
project-specific guidance and uses the right wrappers, subagents, and
deterministic checks when working on this codebase.

Root `CLAUDE.md` (replacing the gitignored placeholder): project overview,
Claude Code Tooling index (slash commands, subagents, hooks, settings, status
line), Build Commands quick reference and configuration, Architecture summary
with load-bearing pieces and a pointer to `cpp/modmesh/`, Code Style
at-a-glance (full rules in `STYLE.md`), PR guidelines, development notes, and
common development patterns.

Remove the now-redundant `contrib/prompt/CLAUDE.md` and update gitignore entry
for the root `CLAUDE.local.md`.

`.claude/`:

- `settings.json`: permission allow/deny scoped to the Makefile workflow
  (`make` targets, `cmake`, `pytest`, lint/format tools, read-only `git`/`gh`).
  Destructive operations (force push, hard reset, `git clean -fd`, `rm -rf /`
  and `~`, `sudo`) blocked; `make clean`/`cmakeclean` deliberately prompt.
  Wires the hook and the status line below.
- `hooks/check-source.sh`: PostToolUse on `Write|Edit` of source files (`*.py`,
  `*.cpp`, `*.hpp`, ...). Deterministic checks for non-ASCII bytes, trailing
  whitespace, missing modeline, and Python `>79` chars; exits 2 with `path:line
  -- rule -- fix`.
- `statusline.sh`: reads session JSON via `jq`; prints `<model> | <project> |
  <branch>[*if dirty] | ctx <%>`.
- `commands/{build,pytest,gtest,lint,format}.md`: slash commands wrapping the
  corresponding `make` targets. Each ends with `verdict: clean | issues found |
  blocking`.
- `agents/{cpp,python}-style-reviewer.md` -- judgment-call style reviewers
  (`m_` prefix in context, function-body placement, `SimpleCollector`
  preference, pybind11 binding split, test intent, naming). Scoped to `git
  diff`; pinned `model: sonnet`.  Defer to `STYLE.md` as canonical; hooks own
  the deterministic rules.

Aslo add a standalone reference file `contrib/prompt/general-rule.md` without
automaticaly imported into `CLAUDE.md`.
@yungyuc yungyuc self-assigned this May 12, 2026
@yungyuc yungyuc added the documentation Improvements or additions to documentation label May 12, 2026
Comment thread .gitignore
@@ -1,4 +1,4 @@
/CLAUDE.md
CLAUDE.local.md
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ignore local claude context file.

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.

Per https://www.reddit.com/r/ClaudeAI/comments/1nuunhu/is_claudelocalmd_deprecated/, CLAUDE.local.md is deprecated so it's no need to put this line.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It's not deprecated: https://code.claude.com/docs/en/memory#choose-where-to-put-claude-md-files

CLAUDE.md and CLAUDE.local.md files in the directory hierarchy above the working directory are loaded in full at launch. Files in subdirectories load on demand when Claude reads files in those directories. See How CLAUDE.md files load for the full resolution order.

Comment thread CLAUDE.md
- Qt-based GUI (pilot) for spatial data visualization
- Integrated runtime profiler for performance analysis

## Claude Code Tooling
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Explain the tooling contents in the new .claude/ directory.

Comment thread CLAUDE.md
in `contrib/prompt/general-rule.md` (not auto-imported). This section indexes
the tools.

### Slash commands (`.claude/commands/`)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Add commands for concrete operations.

Comment thread CLAUDE.md

All commands end with `verdict: clean | issues found | blocking`.

### Subagents (`.claude/agents/`)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Start with reviewing subagents. We can and will add more later.

Comment thread CLAUDE.md

## Code Style

`STYLE.md` is the canonical source. At a glance:
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Point to the canonical style guide.

Comment thread CLAUDE.md

### Running Single Tests

Prefer the slash commands (`/pytest <path or args>`,
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Describe testing operations in the slash commands. Here only list basic examples.

Comment thread CLAUDE.md

modmesh uses a dual-layer hybrid architecture:

1. **C++ Core** (`cpp/modmesh/`): High-performance numerical code
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Remove the static list and point to the directory structure.

Comment thread CLAUDE.md

### C++ Component Structure

C++ core lives in `cpp/modmesh/`. Load-bearing pieces:
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Claude rephrased this and it looks clearer to me.

Comment thread CLAUDE.md
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The file is shorten from 363 lines to 276 lines.

@yungyuc yungyuc marked this pull request as ready for review May 12, 2026 13:03
@yungyuc yungyuc merged commit 0ce99ed into solvcon:master May 12, 2026
14 checks passed
@yungyuc yungyuc deleted the dev/claude-dir branch May 12, 2026 21:57
@yungyuc
Copy link
Copy Markdown
Member Author

yungyuc commented May 12, 2026

Merged. @chestercheng @tigercosmos feel free to comment. Points you raise will be addressed in future PRs.

Copy link
Copy Markdown
Collaborator

@tigercosmos tigercosmos left a comment

Choose a reason for hiding this comment

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

@yungyuc Reviewed.

name: cpp-style-reviewer
description: Judgment-call C++ review for modmesh (m_ prefix, function-body placement, SimpleCollector preference, pybind11 binding split, const_cast). Use proactively after editing files in cpp/.
tools: Read, Grep, Glob, Bash
model: sonnet
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 prefer to use opus directly. Maybe it's better to put inherit here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Sounds good to me.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Tracked in issue #774.

@@ -0,0 +1,77 @@
---
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.

This file sounds more like a skill. A reviewer agent will call the C++ style skill and the python style skill.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I am OK to make it a skill. I am not familiar with either (sub-)agent nor skill and do not mind to change between them back and forth to experiment.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Tracked in issue #774.

Comment thread .claude/commands/build.md
logs.

End with: `verdict: clean | issues found | blocking`. `blocking`
iff the build failed.
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.

iff?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Comment thread .claude/commands/build.md
@@ -0,0 +1,18 @@
---
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.

These commands have no more information than Makefile. I think we can just use a skill describe how to use the make file.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Sounds good to me.

Comment thread CLAUDE.md
in `contrib/prompt/general-rule.md` (not auto-imported). This section indexes
the tools.

### Slash commands (`.claude/commands/`)
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.

As CLAUDE.md describes how to use make commands. All files in .claudes/commands seems redundant.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Right, and putting all the make uses in CLAUDE.md may be more concise for both human and machine minds. We can change it back.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Tracking in issue #773

Comment thread .gitignore
@@ -1,4 +1,4 @@
/CLAUDE.md
CLAUDE.local.md
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.

Per https://www.reddit.com/r/ClaudeAI/comments/1nuunhu/is_claudelocalmd_deprecated/, CLAUDE.local.md is deprecated so it's no need to put this line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants