Add claude-code-spring module: CLAUDE.md, a path-scoped rule, two skills, four hooks run against real hook JSON, project .mcp.json from the claude mcp CLI, and tests that lint the setup on Spring Boot 4.2.0
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b86yyhhudsSLnwNUFY
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
a620d91d0a
commit
3aa20a1dce
@@ -0,0 +1,47 @@
|
||||
# claude-code-spring
|
||||
|
||||
Companion code for *Claude Code for Java and Spring Boot Developers: CLAUDE.md, Skills, Hooks, MCP and IntelliJ*
|
||||
on [ankurm.com](https://ankurm.com). It is a small Spring Boot 4.2 orders service with a complete, committed
|
||||
Claude Code setup around it, plus the tests and scripts that check that setup.
|
||||
|
||||
Open a terminal **in this folder** and run `claude` there: Claude Code reads `.claude/`, `CLAUDE.md` and
|
||||
`.mcp.json` from the directory you start it in.
|
||||
|
||||
## Run
|
||||
|
||||
```bash
|
||||
export JAVA_HOME=/path/to/jdk-25
|
||||
mvn -B spring-boot:run
|
||||
curl -s -X POST localhost:8080/orders -H 'Content-Type: application/json' \
|
||||
-d '{"customer":"asha","quantity":10,"unitPrice":10.00}'
|
||||
curl -s localhost:8080/orders/1
|
||||
```
|
||||
|
||||
Ten or more units earn a 10 percent discount, so the first call returns a total of `90.00`.
|
||||
|
||||
## What is where
|
||||
|
||||
| Path | Claude Code feature |
|
||||
|---|---|
|
||||
| `CLAUDE.md` | Project instructions loaded every session |
|
||||
| `.claude/rules/testing.md` | Rule scoped by `paths:` to `src/test/**/*.java` |
|
||||
| `.claude/skills/new-endpoint/`, `.claude/skills/review-diff/` | Skills (`/new-endpoint`, `/review-diff`) |
|
||||
| `.claude/settings.json` | Permissions and hook registration (shared with the team) |
|
||||
| `.claude/hooks/*.sh`, `GuardBash.java` | Hook scripts |
|
||||
| `.mcp.json` | Project-scoped MCP servers, generated by `claude mcp add --scope project` |
|
||||
|
||||
## Tests and transcripts
|
||||
|
||||
| Command | Writes |
|
||||
|---|---|
|
||||
| `mvn -B -q test` | `output/01-config-lint.txt`, `output/02-conventions.txt` |
|
||||
| `scripts/hook-tour.sh` | `output/03` to `output/06` (the four hooks, fed real hook JSON) |
|
||||
| `scripts/hook-latency.sh` | `output/07-hook-latency.txt` (indicative, changes every run) |
|
||||
| `scripts/mcp-tour.sh` | `output/08-mcp-cli.txt` (real `claude mcp` output, in a throwaway directory) |
|
||||
| `scripts/run-all.sh` | all of the above |
|
||||
|
||||
Claude Code itself is not run here: it needs a signed-in account and a model. The hooks are run with the same
|
||||
JSON on stdin that the documentation describes, and everything about what Claude Code *does* with a hook's exit
|
||||
code or JSON comes from its documentation, not from a run.
|
||||
|
||||
Verified with Spring Boot 4.2.0, Claude Code 2.1.330, JDK 25 (Temurin 25.0.5.1), JUnit 6.1.3, `jq` 1.7.
|
||||
Reference in New Issue
Block a user