Skip to content

docs: add CLAUDE.md and .claude folder setup for contributor productivity#7627

Merged
carlesarnal merged 12 commits intoApicurio:mainfrom
carlesarnal:issue-7626
Mar 26, 2026
Merged

docs: add CLAUDE.md and .claude folder setup for contributor productivity#7627
carlesarnal merged 12 commits intoApicurio:mainfrom
carlesarnal:issue-7626

Conversation

@carlesarnal
Copy link
Copy Markdown
Member

@carlesarnal carlesarnal commented Mar 24, 2026

Summary

Fixes #7626

Set up the .claude folder following best practices to help contributors work more effectively with the Apicurio Registry codebase using Claude Code.

Root Cause

The repository had no CLAUDE.md content and the entire .claude directory was gitignored, preventing team-shared configuration from being committed. Contributors using Claude Code had no project-specific instructions, commands, or conventions available.

Changes

  • .gitignore: Replace blanket .claude ignore with specific ignores for personal files (settings.local.json, CLAUDE.local.md) so team config can be tracked
  • CLAUDE.md (102 lines): Concise project context — build commands, architecture, storage variants, conventions, gotchas
  • .claude/settings.json: Team-shared permission policies (allow Maven/git/gh, deny destructive commands and .env reads)
  • .claude/rules/ (6 files): Path-scoped coding conventions with YAML frontmatter:
    • code-style.md — Java conventions derived from .checkstyle/checkstyle.xml
    • testing.md — Unit/integration test patterns, storage variant coverage
    • api-conventions.md — REST API patterns, SDK regeneration
    • storage.md — Storage layer architecture and variant guidelines
    • ui.md — React/TypeScript frontend build process
    • security.md — OIDC, secrets, TLS considerations
  • .claude/commands/ (7 files): Project-specific slash commands:
    • 5 refined: analyze-gh-issue, plan-implementation, implement-changes, review-pr, pr-description
    • 2 new: run-tests (smart test runner), debug-ci-failure (CI diagnosis)
  • .claude/skills/ (3 workflows): Auto-invoked when context matches:
    • security-review — triggers on auth/OIDC/secrets discussions
    • storage-variant-guide — triggers when modifying storage layer
    • sdk-update — triggers when REST API changes affect SDKs
  • .claude/agents/ (3 subagents): Specialized personas using sonnet model:
    • code-reviewer — correctness, checkstyle, storage consistency
    • security-auditor — auth, secrets, OIDC, TLS (read-only)
    • ci-debugger — GitHub Actions failure diagnosis

Test plan

  • CLAUDE.md is under 200 lines (102 lines)
  • .claude/settings.local.json is NOT tracked in git
  • All 21 new files are committed and tracked
  • Verify commands work: /project:analyze-gh-issue, /project:run-tests, /project:debug-ci-failure
  • Verify rules activate only for matching file paths
  • Verify agents spawn with correct model and tool restrictions

…curio#7626)

Replace blanket `.claude` ignore with specific ignores for personal files
(settings.local.json, CLAUDE.local.md) so team-shared config (commands,
rules, skills, agents, settings.json) can be tracked in git.
Concise project instructions (102 lines) covering build commands,
architecture, storage variants, conventions, and gotchas.
…io#7626)

Allow Maven, git read commands, and GitHub CLI. Deny destructive
commands and .env file reads.
…o#7626)

Six modular rule files with YAML frontmatter path scoping:
- code-style.md (Java conventions from checkstyle.xml)
- testing.md (unit/integration test patterns)
- api-conventions.md (REST API patterns)
- storage.md (storage layer architecture)
- ui.md (React/TypeScript frontend)
- security.md (OIDC, secrets, TLS)
…curio#7626)

Five refined commands (analyze-gh-issue, plan-implementation,
implement-changes, review-pr, pr-description) and two new commands
(run-tests, debug-ci-failure).
…#7626)

Three skills that Claude can invoke automatically when relevant:
- security-review: triggers on auth/OIDC/secrets discussions
- storage-variant-guide: triggers when modifying storage layer
- sdk-update: triggers when REST API changes affect SDKs
…o#7626)

Three agents using sonnet model for cost-efficient focused tasks:
- code-reviewer: correctness, checkstyle, storage consistency
- security-auditor: auth, secrets, OIDC, TLS (read-only)
- ci-debugger: GitHub Actions failure diagnosis
@jsenko
Copy link
Copy Markdown
Member

jsenko commented Mar 24, 2026

There is a lot of inline bash commands, which is fine but from my experience Claude is pretty good at using gh or git without guidance. It's fine to keep them, but some generic ones can be removed.

@carlesarnal
Copy link
Copy Markdown
Member Author

There is a lot of inline bash commands, which is fine but from my experience Claude is pretty good at using gh or git without guidance. It's fine to keep them, but some generic ones can be removed.

Fair, although those have been extracted from the readmes, and, generally speaking, this is meant to streamline upstream contributions to the project.

Comment on lines +11 to +12
"Bash(gh issue *)",
"Bash(gh pr *)",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this would allow issues and PR to be created, deleted, edited, etc. Do we want to allow all that by default?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, since the comments we're shipping use some of those commands, I do think it makes sense.

Comment on lines +19 to +20
"Bash(curl *)",
"Bash(wget *)",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why deny curl and wget?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

removed

- Add PreToolUse hook to block edits to target/ and .env files
- Add PostToolUse hook to auto-run checkstyle after Java file edits
- Add Notification hook for macOS desktop alerts
- Remove curl/wget from deny list (unnecessary, permission system prompts)
)

- Add attribution config to disable co-authored-by in commits and PRs
- Make notification hook cross-platform (macOS + Linux)
- Optimize checkstyle hook to check only the edited file, not full module
Comment on lines +43 to +49
"hooks": [
{
"type": "command",
"command": "$CLAUDE_PROJECT_DIR/.claude/hooks/checkstyle-after-edit.sh",
"timeout": 60,
"statusMessage": "Running checkstyle"
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How long does this take to run? I'm worried about it slowing down claude code even further.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'll change it to be executed before any git commit command executed by claude, I think that's a fair compromise, wdyt?

Comment on lines +57 to +60
{
"type": "command",
"command": "$CLAUDE_PROJECT_DIR/.claude/hooks/notify.sh"
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not sure I like this being enabled by default...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Agreed. I like it for me, but having it enabled for everyone is probably no the best idea..

@EricWittmann
Copy link
Copy Markdown
Member

I love the agents, rules, and skills. 👍

The commands can be used or not used, so those are fine. I'm a little skeptical of some of the hooks though. I added some inline comments.

- Restrict gh permissions to read-only (view, list, diff, checks)
- Remove checkstyle and notification hooks from default config
- Document hooks as opt-in via settings.local.json in CLAUDE.md
- Move checkstyle from PostToolUse (every edit) to PreToolUse (before
  git commit only), checking staged Java files per module
- Remove notification hook from default config, document as opt-in
- Remove old checkstyle-after-edit.sh, add checkstyle-before-commit.sh
@carlesarnal
Copy link
Copy Markdown
Member Author

@EricWittmann @jsenko any objection for merging this? I think it's a good compromise in it's current form, and we can evolve it over time if we think it's not serving us well.

@jsenko
Copy link
Copy Markdown
Member

jsenko commented Mar 26, 2026

I've provided my feedback in the other channel, but I don't have any blocking objections.

@EricWittmann
Copy link
Copy Markdown
Member

No objection.

@carlesarnal carlesarnal merged commit a208749 into Apicurio:main Mar 26, 2026
29 checks passed
@carlesarnal carlesarnal deleted the issue-7626 branch March 26, 2026 13:13
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.

Add CLAUDE.md and Claude Code agents for contributor productivity

3 participants