SETTINGS · tooling-foundation

Day-one settings for a Java team

A starter .claude/settings.json: prompt-free build/test/commit loop, deny rules for the obvious hazards, team MCP approval, and Java formatting on every edit.

✓ verified 2026-06-10 · stack: claude-code, java · source

The committed project settings for a team’s first week with Claude Code. Design intent: the everyday Maven/Gradle/git loop runs without prompts, the baseline MCP servers connect without per-developer approval, and Java formatting happens on every edit without occupying prompt-space. It is deliberately a starter: once the team has real usage to calibrate against, graduate to the cautious permission profile, which adds credential-path denies, sandbox denyRead, and scoped AWS CLI allows.

.claude/settings.json
{
"$schema": "https://json.schemastore.org/claude-code-settings.json",
"enableAllProjectMcpServers": true,
"permissions": {
"allow": [
"Bash(mvn *)",
"Bash(./gradlew *)",
"Bash(git status)",
"Bash(git diff *)",
"Bash(git log *)",
"Bash(git add *)",
"Bash(git commit *)"
],
"deny": [
"Bash(rm -rf *)",
"Read(./.env*)",
"Read(./secrets/**)"
]
},
"hooks": {
"PostToolUse": [
{
"matcher": "Edit|Write",
"hooks": [
{
"type": "command",
"command": "jq -r '.tool_input.file_path' | { read f; case \"$f\" in *.java) \"${CLAUDE_PROJECT_DIR}\"/gradlew spotlessApply -PspotlessIdeHook=\"$f\" --quiet ;; esac; }"
}
]
}
]
}
}

Maven-only teams: swap the hook command’s Gradle call for your formatter equivalent, and drop the ./gradlew allow.

What it does

  • Build and commit without prompts. Maven, the Gradle wrapper, and the read-plus-commit subset of git are pre-approved. Deliberately absent: git push. Pushing is a decision, so it prompts every time.
  • Team MCP servers connect on clone. enableAllProjectMcpServers: true auto-approves servers in the committed .mcp.json, on the basis that they were reviewed when the PR added them.
  • Deny rules that cannot be overridden. A deny at any scope beats an allow at every scope, so no developer’s personal settings can re-allow rm -rf, dotenv reads, or the secrets directory.
  • Formatting as a property of the system. The PostToolUse hook runs Spotless on every .java file Claude edits, single-file via the Gradle IDE hook. Full mechanics and failure modes are in the format-on-edit artifact; the enforcement philosophy is in the deterministic policy pillar.
  • Tool Search stays effective. Nothing here sets alwaysLoad, so MCP tool schemas remain deferred and the baseline servers cost almost nothing until used.

Failure modes

  • This is a starter, not a security posture. There are no credential-path denies for ~/.aws/ or ~/.ssh/, no sandbox, and no AWS CLI rules. On an AWS-credentialled workstation, adopt the cautious profile rather than extending this file ad hoc.
  • Bash(mvn *) is broad. Compound commands are parsed per subcommand, so mvn verify && curl ... still prompts for the curl, but any Maven goal, including deploy, is covered. Narrow to Bash(mvn verify*) and friends if your POM can reach production.
  • jq absent breaks the hook quietly. The hook errors non-blocking and the edit proceeds unformatted. Assert command -v jq in onboarding or a SessionStart hook.
  • enableAllProjectMcpServers trusts the repo. Anyone who can merge to .mcp.json can add a server every developer auto-runs. Put .claude/ and .mcp.json behind CODEOWNERS. See CI as the outer gate.
  • Argument-pattern denies are friction, not enforcement. Bash(rm -rf *) stops the honest mistake, not a determined dodge; real containment is the sandbox layer in the cautious profile.

Verified against the settings file reference (scopes, precedence, enableAllProjectMcpServers, hooks key) at code.claude.com/docs/en/settings, 2026-06-10.