feat: add Claude Code project settings (.claude/settings.json)#37
feat: add Claude Code project settings (.claude/settings.json)#37martinydeAI wants to merge 1 commit into
Conversation
Adds .claude/settings.json so the team shares the same Claude Code harness configuration: a permission allowlist for common safe commands, a deny list for destructive actions and secrets, an ask list for state-changing git/gh/docker operations, project hooks (auto-start Docker, block lock-file edits, run php-cs-fixer/phpstan/twig-cs-fixer/ composer normalize/prettier after edits, lint Symfony DI container on stop), and a set of enabled Claude plugins. Adds .claude/settings.local.json to .gitignore so local-only overrides stay out of version control. Closes #6
yepzdk
left a comment
There was a problem hiding this comment.
How often does the "PostToolUse" run? Match on Write/Edit sounds excessive for running commands that check coding standards etc.
I have not used it, so can't say how it is in real life, just flagging it, as a potential burn of time/tokens.
| "Bash(diff:*)", | ||
| "Bash(echo:*)", | ||
| "Bash(find:*)", | ||
| "Bash(gh:*)", |
There was a problem hiding this comment.
I don't think we should just allow all from gh or git
There was a problem hiding this comment.
There was a problem hiding this comment.
I have also worked on a settings.json in economics:
https://github.com/itk-dev/economics/pull/317/changes
There was a problem hiding this comment.
Note that the rules for deny, ask, allow are evaluated in that order. So when we also have say gh repo deleteunder deny that will always trigger before the broader rule under allow
Rules are evaluated in order: deny, then ask, then allow. The first match in that order determines the outcome, and rule specificity does not change the order. A matching ask rule prompts even when a more specific allow rule also matches the same call.
https://code.claude.com/docs/en/permissions#manage-permissions
That said, I agree with @tuj that we shouldn't default to allow like this. Allow rules should be scoped to non-commands of "view" or "list" in nature.
Yeah i asked @turegjorup about that in a different project. If i understand correctly they run on every prompt, so quite often, but he mentioned he didn't experience much overhead, so i allowed it in. But i'm also a bit iffy about it. I guess we can just try it and see how it works. |
Example from Claude Code docs:
https://code.claude.com/docs/en/hooks documents what is currently available |
Summary
Adds a committed
.claude/settings.jsonso the whole team shares the same Claude Code harness configuration for this repo (#6). The configuration is taken from itk-dev/devops_itksites#62 and includes a permission allowlist, deny/ask rules, hooks, and a set of enabled plugins.Features Added
cat,ls,grep,find,head,tail,wc,tree,diff,which,pwd,echo),git,gh,task, and read-onlydocker composesubcommands (exec,run,up,ps,logs,top,config,pull,images) plusdocker network.rm -rf,gh issue/release/repo/label delete, and reads of.env.local,.env.local.*,config/secrets/*.SessionStart: runsdocker compose up --detachso the dev stack is ready.PreToolUse: blocks Edit/Write tocomposer.lock,yarn.lock, and.env.local*.PostToolUse: runsphp-cs-fixerandphpstanon*.php,twig-cs-fixeron*.twig,composer normalizeoncomposer.json, andprettieron*.{js,css,scss,yaml,yml,md}— all inside the container.Stop: runsbin/console lint:containerto validate Symfony DI wiring at end of session.php-lsp,code-simplifier,context7,code-review,security-guidance,playwright,feature-dev, anditkdev-skills..claude/settings.local.jsonis gitignored so per-user tweaks/secrets stay out of version control.Files Changed
.claude/settings.json(new) — committed, team-shared Claude Code harness configuration..gitignore— ignore.claude/settings.local.json.CHANGELOG.md— note the addition under[Unreleased] / Added.Test Plan
git status,task --list) — should execute without a permission prompt.rm -rf some/path) — should be refused.git push,gh pr create) — should prompt for confirmation.*.phpfile and verifyphp-cs-fixer/phpstanrun via thephpfpmservice.*.mdfile and verifyprettierruns via thenodeservice.composer.lock— should be blocked by the PreToolUse hook..claude/settings.local.jsonis ignored by git (create the file, rungit status).Closes #6