Skip to content

Conversation

@dapplion
Copy link
Collaborator

@dapplion dapplion commented Jan 28, 2026

Summary

  • Add CRITICAL section at top of CLAUDE.md to ensure Claude always runs formatting and linting after code changes
  • Add .claude/settings.json with post-tool-call hook to remind about formatting and linting after Edit/Write operations

This helps ensure Claude Code consistently follows the project's code quality requirements.

Test plan

  • Verify CLAUDE.md changes are visible
  • Verify hook configuration is valid JSON

🤖 Generated with Claude Code

(Lion here)

Claude recognizes that it ignored Claude.md most of the time, and recommends this edits to actually lint and format when doing changes.

- Add CRITICAL section at top of CLAUDE.md to ensure Claude always runs
  `cargo fmt --all && make lint-fix` and `cargo check` after code changes
- Add .claude/settings.json with post-tool-call hook to remind about
  formatting and linting after Edit/Write operations

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@dapplion dapplion requested a review from jimmygchen January 28, 2026 19:23
"post-tool-call": [
{
"matcher": "Edit|Write",
"command": "echo '\n[Reminder] Run: cargo fmt --all && make lint-fix && cargo check'"
Copy link
Member

Choose a reason for hiding this comment

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

I can't find post-tool-call on claude documentation, is this documented somewhere else?

https://code.claude.com/docs/en/hooks#common-json-fields

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hmm should be post-tool-use?

@michaelsproul
Copy link
Member

I thought the plan was to add a commit hook that checks cargo fmt, so this is enforced by Git and not vibes

@dapplion
Copy link
Collaborator Author

dapplion commented Feb 5, 2026

I thought the plan was to add a commit hook that checks cargo fmt, so this is enforced by Git and not vibes

Do we want to have git hooks that apply to everyone?

]
}
]
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated this format until my local claude CLI accepted the format.

Cargo.toml Outdated
# Turn off c-kzg's default features which include `blst/portable`. We can turn on blst's portable
# feature ourselves when desired.
c-kzg = { version = "2.1", default-features = false }
cargo-husky = { version = "1", default-features = false, features = ["precommit-hook", "run-cargo-fmt"] }
Copy link
Member

Choose a reason for hiding this comment

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

hmm I'm not sure if it's worth introducing a dependency for this. It's also unmaintained, but I see benefits over native git hooks - without devs having to manually set it up.

Now i feel like it might be better to just include it in the AI file you originally suggested.

With cargo-husky requiring at least a cargo task to trigger, i think there might be a chance that this never gets run, e.g. AI-generated PRs etc.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I can add a make command to add it your local dir, and then we expect team members to add it

"hooks": [
{
"type": "command",
"command": "echo '\n[Reminder] Run: cargo fmt --all && make lint-fix && cargo check'"
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we need cargo check if we already run clippy

Copy link
Member

@pawanjay176 pawanjay176 left a comment

Choose a reason for hiding this comment

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

@dapplion I'm wondering why we can't have our own local versions of the settings.json. Why does this need to be committed for everyone?

@jking-aus
Copy link
Member

jking-aus commented Feb 10, 2026

@dapplion I'm wondering why we can't have our own local versions of the settings.json. Why does this need to be committed for everyone?

settings.json at project level is good for sharing hooks and tooling across the team. Your .claude/settings.local.json is not committed and overrides the project level settings

https://code.claude.com/docs/en/settings

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.

6 participants