Add .claude/ Claude Code tooling and root CLAUDE.md#770
Conversation
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`.
| @@ -1,4 +1,4 @@ | |||
| /CLAUDE.md | |||
| CLAUDE.local.md | |||
There was a problem hiding this comment.
Ignore local claude context file.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
| - Qt-based GUI (pilot) for spatial data visualization | ||
| - Integrated runtime profiler for performance analysis | ||
|
|
||
| ## Claude Code Tooling |
There was a problem hiding this comment.
Explain the tooling contents in the new .claude/ directory.
| in `contrib/prompt/general-rule.md` (not auto-imported). This section indexes | ||
| the tools. | ||
|
|
||
| ### Slash commands (`.claude/commands/`) |
There was a problem hiding this comment.
Add commands for concrete operations.
|
|
||
| All commands end with `verdict: clean | issues found | blocking`. | ||
|
|
||
| ### Subagents (`.claude/agents/`) |
There was a problem hiding this comment.
Start with reviewing subagents. We can and will add more later.
|
|
||
| ## Code Style | ||
|
|
||
| `STYLE.md` is the canonical source. At a glance: |
There was a problem hiding this comment.
Point to the canonical style guide.
|
|
||
| ### Running Single Tests | ||
|
|
||
| Prefer the slash commands (`/pytest <path or args>`, |
There was a problem hiding this comment.
Describe testing operations in the slash commands. Here only list basic examples.
|
|
||
| modmesh uses a dual-layer hybrid architecture: | ||
|
|
||
| 1. **C++ Core** (`cpp/modmesh/`): High-performance numerical code |
There was a problem hiding this comment.
Remove the static list and point to the directory structure.
|
|
||
| ### C++ Component Structure | ||
|
|
||
| C++ core lives in `cpp/modmesh/`. Load-bearing pieces: |
There was a problem hiding this comment.
Claude rephrased this and it looks clearer to me.
There was a problem hiding this comment.
The file is shorten from 363 lines to 276 lines.
|
Merged. @chestercheng @tigercosmos feel free to comment. Points you raise will be addressed in future PRs. |
| 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 |
There was a problem hiding this comment.
I prefer to use opus directly. Maybe it's better to put inherit here.
| @@ -0,0 +1,77 @@ | |||
| --- | |||
There was a problem hiding this comment.
This file sounds more like a skill. A reviewer agent will call the C++ style skill and the python style skill.
There was a problem hiding this comment.
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.
| logs. | ||
|
|
||
| End with: `verdict: clean | issues found | blocking`. `blocking` | ||
| iff the build failed. |
| @@ -0,0 +1,18 @@ | |||
| --- | |||
There was a problem hiding this comment.
These commands have no more information than Makefile. I think we can just use a skill describe how to use the make file.
| in `contrib/prompt/general-rule.md` (not auto-imported). This section indexes | ||
| the tools. | ||
|
|
||
| ### Slash commands (`.claude/commands/`) |
There was a problem hiding this comment.
As CLAUDE.md describes how to use make commands. All files in .claudes/commands seems redundant.
There was a problem hiding this comment.
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.
| @@ -1,4 +1,4 @@ | |||
| /CLAUDE.md | |||
| CLAUDE.local.md | |||
There was a problem hiding this comment.
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.
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 tocpp/modmesh/, Code Style at-a-glance (full rules inSTYLE.md), PR guidelines, development notes, and common development patterns.Remove the now-redundant
contrib/prompt/CLAUDE.mdand update gitignore entry for the rootCLAUDE.local.md..claude/:settings.json: permission allow/deny scoped to the Makefile workflow (maketargets,cmake,pytest, lint/format tools, read-onlygit/gh). Destructive operations (force push, hard reset,git clean -fd,rm -rf /and~,sudo) blocked;make clean/cmakecleandeliberately prompt. Wires the hook and the status line below.hooks/check-source.sh: PostToolUse onWrite|Editof source files (*.py,*.cpp,*.hpp, ...). Deterministic checks for non-ASCII bytes, trailing whitespace, missing modeline, and Python>79chars; exits 2 withpath:line -- rule -- fix.statusline.sh: reads session JSON viajq; prints<model> | <project> | <branch>[*if dirty] | ctx <%>.commands/{build,pytest,gtest,lint,format}.md: slash commands wrapping the correspondingmaketargets. Each ends withverdict: clean | issues found | blocking.agents/{cpp,python}-style-reviewer.md-- judgment-call style reviewers (m_prefix in context, function-body placement,SimpleCollectorpreference, pybind11 binding split, test intent, naming). Scoped togit diff; pinnedmodel: sonnet. Defer toSTYLE.mdas canonical; hooks own the deterministic rules.Aslo add a standalone reference file
contrib/prompt/general-rule.mdwithout automaticaly imported intoCLAUDE.md.