Skip to content

SREP-4410: Claude Agent, Hooks and Skills Setup MVP#243

Open
devppratik wants to merge 2 commits intoopenshift:masterfrom
devppratik:claude-agent-hooks-setup
Open

SREP-4410: Claude Agent, Hooks and Skills Setup MVP#243
devppratik wants to merge 2 commits intoopenshift:masterfrom
devppratik:claude-agent-hooks-setup

Conversation

@devppratik
Copy link
Copy Markdown
Contributor

@devppratik devppratik commented Apr 24, 2026

What type of PR is this?

feature

What this PR does / why we need it?

This PR adds .claude folder with Skills, Agents and Hooks for starting with Agentic SDLC for OAO

Which Jira/Github issue(s) this PR fixes?

Fixes #

Special notes for your reviewer:

Pre-checks (if applicable):

  • Tested latest changes against a cluster
  • Ran make generate command locally to validate code changes
  • Included documentation changes with PR

Summary by CodeRabbit

  • Documentation

    • Added comprehensive Claude Code integration guide with workflows for feature development, pre-PR review, and code understanding
    • Added setup documentation for automated code review agents (security, lint, testing, error handling)
    • Added skill documentation for running tests, performing full code review, and regenerating CRD artifacts
  • Chores

    • Configured Claude Code environment, tool permissions, and automated hooks for pre-commit validation

@openshift-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented Apr 24, 2026

@devppratik: This pull request references SREP-4410 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the epic to target the "5.0.0" version, but no target version was set.

Details

In response to this:

What type of PR is this?

feature

What this PR does / why we need it?

This PR adds .claude folder with Skills, Agents and Hooks for starting with Agentic SDLC for OAO

Which Jira/Github issue(s) this PR fixes?

Fixes #

Special notes for your reviewer:

Pre-checks (if applicable):

  • Tested latest changes against a cluster
  • Ran make generate command locally to validate code changes
  • Included documentation changes with PR

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Apr 24, 2026
@openshift-ci openshift-ci Bot requested review from bmeng and chamalabey April 24, 2026 06:11
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Apr 24, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: devppratik
Once this PR has been reviewed and has the lgtm label, please assign tkong-redhat for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 24, 2026

Walkthrough

Introduces Claude Code integration infrastructure including configuration files, agent definitions for comprehensive code review (security, linting, testing, error handling), automation hooks for pre-commit validation and user prompts, custom skills for full reviews and CRD updates, and corresponding documentation.

Changes

Cohort / File(s) Summary
Configuration & Setup
.claude/README.md, .claude/settings.json, CLAUDE.md, docs/CLAUDE_CODE_GUIDE.md
Adds Claude Code configuration, main documentation overview, and comprehensive guide covering setup, skills, agents, hooks, workflows, and troubleshooting.
Review Agents
.claude/agents/security-reviewer.md, .claude/agents/lint-reviewer.md, .claude/agents/test-reviewer.md, .claude/agents/error-handling-reviewer.md
Defines four specialized agents for security, linting, test coverage, and error-handling reviews with specific focus areas, severity mappings, and structured reporting templates.
Automation Hooks
.claude/hooks/before-commit, .claude/hooks/user-prompt-submit
Implements pre-commit validation script running lint and test checks, and user-prompt hook suggesting test execution for Go/YAML changes.
Custom Skills
.claude/skills/full-review/SKILL.md, .claude/skills/run-tests/SKILL.md, .claude/skills/update-crds/SKILL.md
Introduces three skills for orchestrating comprehensive parallel review, sequential testing workflow (lint/unit/race detection), and CRD artifact regeneration after API changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 12
✅ Passed checks (12 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: introducing Claude Agent, Hooks, and Skills setup for the MVP phase. It directly relates to the changeset's primary objective.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed No Ginkgo test files are added or modified in this PR. The PR contains only configuration files, documentation, and hook scripts.
Test Structure And Quality ✅ Passed This PR does not modify any Ginkgo test code files, only adding Claude Code integration files and documentation.
Microshift Test Compatibility ✅ Passed The pull request does not add any new Ginkgo e2e tests. No new Go test files or files containing Ginkgo test patterns are being added.
Single Node Openshift (Sno) Test Compatibility ✅ Passed This PR does not add any new Ginkgo e2e tests, consisting solely of Claude Code configuration, documentation, hooks, and skill/agent definitions.
Topology-Aware Scheduling Compatibility ✅ Passed PR introduces Claude Code integration infrastructure with no changes to Kubernetes deployment manifests, operator controllers, or scheduling constraints.
Ote Binary Stdout Contract ✅ Passed PR introduces Claude Code integration infrastructure with markdown documentation, JSON configuration, and bash automation hooks only—no Go code or test function modifications.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed PR contains no Ginkgo e2e test files; only configuration, documentation, agent specs, skills, and hooks.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.25%. Comparing base (6fbff20) to head (5f5d4e4).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #243   +/-   ##
=======================================
  Coverage   66.25%   66.25%           
=======================================
  Files          23       23           
  Lines        1544     1544           
=======================================
  Hits         1023     1023           
  Misses        445      445           
  Partials       76       76           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 15

♻️ Duplicate comments (1)
.claude/agents/error-handling-reviewer.md (1)

8-12: ⚠️ Potential issue | 🟡 Minor

Same "main" vs master mismatch as in security-reviewer.md.

Prose says "vs the main branch" but the diff command uses master. Align the text with the actual base branch to avoid confusing the model about which ref to diff against.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.claude/agents/error-handling-reviewer.md around lines 8 - 12, The README
text in error-handling-reviewer.md mismatches the git ref: it says "vs the main
branch" while the diff command uses `master`; update the prose to consistently
reference `master` (or alternatively change the diff command to `main`) so both
the sentence and the diff command match; edit the string "vs the main branch"
(and any other occurrences) to match the chosen base branch, ensuring
consistency with the existing `git diff master...HEAD` usage in this file.
🧹 Nitpick comments (2)
.claude/agents/error-handling-reviewer.md (1)

94-94: Specify a language on the output template fence (markdownlint MD040).

Adding markdown after the opening backticks silences the lint warning and is consistent with intent.

✏️ Proposed fix
-```
+```markdown
 ## Error Handling Review Report
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.claude/agents/error-handling-reviewer.md at line 94, The code block that
begins immediately before "## Error Handling Review Report" is missing a
language specifier which triggers markdownlint MD040; update the opening fence
for that output template fence to add the language tag "markdown" (i.e., change
the triple backticks that precede the "## Error Handling Review Report" header
to ```markdown) so the linter is satisfied and the intent is explicit.
.claude/hooks/before-commit (1)

14-14: Unused LINT_EXIT / TEST_EXIT captures.

LINT_EXIT=$? (line 14) and TEST_EXIT=$? (line 30) are assigned but never referenced before the explicit exit 1. Either drop them or surface the value in the error payload for easier debugging.

🧹 Proposed cleanup
-LINT_OUTPUT=$(make lint 2>&1) || {
-    LINT_EXIT=$?
+LINT_OUTPUT=$(make lint 2>&1) || {
-TEST_OUTPUT=$(make go-test 2>&1) || {
-    TEST_EXIT=$?
+TEST_OUTPUT=$(make go-test 2>&1) || {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.claude/hooks/before-commit at line 14, The hook currently assigns LINT_EXIT
and TEST_EXIT but never uses them; either remove those unused assignments or
surface the values when failing so failures are debuggable. Update the
before-commit hook: when capturing exit codes (LINT_EXIT and TEST_EXIT) either
delete those variables and directly use the previous command's $? in your
failure handling, or include the captured values in the error output and use
them as the exit code (e.g., echo a clear message containing LINT_EXIT/TEST_EXIT
and then exit with that numeric value). Ensure you update the failure branches
that currently call exit 1 to reference the captured variable (LINT_EXIT or
TEST_EXIT) so the real failure code is propagated.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.claude/agents/lint-reviewer.md:
- Around line 84-86: The fenced code block containing
"boilerplate/openshift/golang-osd-operator/golangci.yml" is missing a language
tag which triggers MD040; add an explicit language identifier (e.g., ```yaml or
```text) on the opening fence for that snippet so the markdown linter recognizes
the block language.

In @.claude/agents/security-reviewer.md:
- Around line 8-12: The README text and the example command are inconsistent:
the prose says "vs the main branch" but the command uses `git diff
master...HEAD`; update the wording or command so they match. Either change the
prose phrase "vs the main branch" to "vs the master branch" to match the
existing command, or replace the hardcoded `master` in the `git diff
master...HEAD` command with a parameter/variable (e.g., `${BASE_BRANCH}`) and
show how to set it (or detect default branch) so the instruction works across
repos. Ensure both the descriptive text ("vs the main branch") and the command
(`git diff ...`) use the same branch identifier.

In @.claude/agents/test-reviewer.md:
- Around line 87-103: Add a fenced code language tag to the output template's
code block that starts with the triple backticks (the block containing "## Test
Review Report" etc.) so it satisfies MD040; update the opening fence (``` ) to
include a language identifier (for example ```md or ```markdown or ```txt) to
mark the block's language and prevent lint failures.
- Around line 8-10: The branch baseline strings are inconsistent—one occurrence
uses "main" and another uses "master...HEAD"; pick a single canonical baseline
(e.g., "main") and make both tokens consistent in the file by replacing
"master...HEAD" with "main...HEAD" (or vice versa if you prefer "master"), and
update any adjacent instructions/comments that reference the baseline so the
review scope is unambiguous.

In @.claude/hooks/before-commit:
- Around line 13-42: The JSON currently built in the lint and test failure
blocks is invalid when outputs contain newlines/control-chars because the sed
pipeline only escapes backslashes and quotes; replace the sed-based escaping
with proper JSON encoding via jq: capture the raw tail output into
LINT_OUTPUT/TEST_OUTPUT as before, set ERROR_SUMMARY using the tail result (keep
the variable names), then build the JSON payload with jq (for example use jq -n
--arg body "$ERROR_SUMMARY" '[{role:"user", content: "❌ Linting failed. Recent
errors:\n```\n"+$body+"\n```\n\nRun '\''make lint'\'' to see full output."}]')
for the lint branch and similarly for the test branch (use "❌ Tests failed..."
and run 'make go-test'); also remove or use the unused LINT_EXIT/TEST_EXIT
variables or delete those assignments.

In @.claude/hooks/user-prompt-submit:
- Line 9: The hook uses plain git diff --name-only which misses staged and
untracked files; update the condition that currently references git diff
--name-only so it diffs against HEAD and also includes untracked files (e.g.,
combine git diff --name-only HEAD with git ls-files --others --exclude-standard
or union both outputs) and then pipe that combined list to grep -qE
'\.(go|yaml|yml)$' so staged and new files trigger the reminder; modify the if
line that contains git diff --name-only to use this combined approach.

In @.claude/README.md:
- Around line 7-29: The fenced code block that renders the directory tree (the
triple-backtick block containing ".claude/ ├── README.md ..." ) is missing a
language identifier and triggers MD040; update the opening fence from ``` to
```text (or ```bash) so the block has a language tag, e.g. replace the existing
``` with ```text to satisfy the linter while keeping the tree formatting intact.
- Around line 139-153: The docs list permissions with wildcard-style entries
like `Bash:make *` but the actual `.claude/settings.json` uses explicit
function-like syntax (e.g., `Bash(make lint)` and `Bash(git diff *)`); update
the README section (the lines showing `Read:*, Glob:*, Grep:*, Bash:make *,
Bash:go *, Bash:git *, Bash:kubectl get/describe/explain, Bash:gh *`) to match
the real `settings.json` format and include concrete examples and a short
example snippet showing how to add a permission such as `Bash(make lint)` and
`Bash(git diff *)` under the "permissions.allow" array so users won’t produce
invalid configs.

In @.claude/settings.json:
- Around line 23-24: The auto-allow entries "Bash(make install)" and "Bash(make
uninstall)" in .claude/settings.json permit destructive cluster changes; remove
these two strings from the allow list (or move them to a separate, explicitly
confirmed actions list) so that executing make install/uninstall requires
interactive human approval rather than being pre-authorized by Claude.
- Around line 46-52: The deny list in .claude/settings.json currently has
Read(./.env) and Read(./.env.*) which only match at repo root; update the deny
array to also block nested .env files by adding recursive variants such as
Read(./**/.env) and Read(./**/.env.*) (or similar glob patterns) alongside the
existing Read(./.env) and Read(./.env.*) entries so subdirectory files like
config/.env are covered.

In @.claude/skills/full-review/SKILL.md:
- Around line 15-24: The skill text "Launch all review agents in parallel"
conflicts with the agents' frontmatter which sets isolation: worktree for the
agents security-reviewer, lint-reviewer, test-reviewer, and
error-handling-reviewer; pick one fix: either remove isolation: worktree from
those four agent definitions (security-reviewer, lint-reviewer, test-reviewer,
error-handling-reviewer) if you intend true parallel read-only runs without
worktrees, or update the skill wording to require per-agent worktree isolation
(rephrase the parallel step to spawn agents respecting each agent's isolation:
worktree); ensure the chosen approach is applied consistently across the skill
text and the four agent frontmatters so behavior is unambiguous.

In `@CLAUDE.md`:
- Line 108: Docs mismatch: update the CLAUDE.md entry for the "before-commit"
hook to match the actual hook command; change the text that currently says
"Automatically runs `make test` and `make lint`" to state it runs `make go-test`
(since `.claude/hooks/before-commit` invokes `make go-test`) so readers
searching for the exact make target find the real command.

In `@docs/CLAUDE_CODE_GUIDE.md`:
- Around line 91-96: The documentation lists the test command as `make test` but
the repository hooks/skills expect `make go-test`; update all occurrences (e.g.,
the section heading "What it runs" and the listed bullet `make test` and the
other mentions around lines referenced) to `make go-test` (or add a note that
`make test` is an alias if you prefer), and ensure the examples and any guidance
consistently use `make go-test` so copy-pasted commands match configured hooks
like the go-test skill.
- Around line 226-250: The example in the "/full-review" output (under the "##
Full Review Report" block attributed to "Claude") incorrectly states "Launches
all 5 review agents" and includes agent categories not present in the configured
set; update this example to match the actual configured 4-reviewer set by
removing or renaming the extra agent category lines (e.g., drop or combine the
Performance/Concurrency sections as appropriate), adjust the summary counts ("3
high, 3 medium") and the estimated fix time to reflect the corrected categories,
and ensure the header and inline text no longer reference "5 review agents" so
the example is consistent with the real configuration.
- Around line 61-63: Several fenced code blocks in CLAUDE_CODE_GUIDE.md lack
language identifiers and trigger MD040; update each unlabeled triple-backtick
block (e.g., the block containing "/full-review" and the other blocks noted in
the review) by adding the appropriate language tag (bash, text, or markdown)
based on the snippet content so the linter recognizes the language and MD040 is
satisfied; scan the document for other unlabeled ```...``` blocks (including the
ranges called out in the review) and add consistent language tags to all of
them.

---

Duplicate comments:
In @.claude/agents/error-handling-reviewer.md:
- Around line 8-12: The README text in error-handling-reviewer.md mismatches the
git ref: it says "vs the main branch" while the diff command uses `master`;
update the prose to consistently reference `master` (or alternatively change the
diff command to `main`) so both the sentence and the diff command match; edit
the string "vs the main branch" (and any other occurrences) to match the chosen
base branch, ensuring consistency with the existing `git diff master...HEAD`
usage in this file.

---

Nitpick comments:
In @.claude/agents/error-handling-reviewer.md:
- Line 94: The code block that begins immediately before "## Error Handling
Review Report" is missing a language specifier which triggers markdownlint
MD040; update the opening fence for that output template fence to add the
language tag "markdown" (i.e., change the triple backticks that precede the "##
Error Handling Review Report" header to ```markdown) so the linter is satisfied
and the intent is explicit.

In @.claude/hooks/before-commit:
- Line 14: The hook currently assigns LINT_EXIT and TEST_EXIT but never uses
them; either remove those unused assignments or surface the values when failing
so failures are debuggable. Update the before-commit hook: when capturing exit
codes (LINT_EXIT and TEST_EXIT) either delete those variables and directly use
the previous command's $? in your failure handling, or include the captured
values in the error output and use them as the exit code (e.g., echo a clear
message containing LINT_EXIT/TEST_EXIT and then exit with that numeric value).
Ensure you update the failure branches that currently call exit 1 to reference
the captured variable (LINT_EXIT or TEST_EXIT) so the real failure code is
propagated.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 6f32ec71-2b49-4347-bbcd-0df2266ee115

📥 Commits

Reviewing files that changed from the base of the PR and between 6fbff20 and 5f5d4e4.

📒 Files selected for processing (13)
  • .claude/README.md
  • .claude/agents/error-handling-reviewer.md
  • .claude/agents/lint-reviewer.md
  • .claude/agents/security-reviewer.md
  • .claude/agents/test-reviewer.md
  • .claude/hooks/before-commit
  • .claude/hooks/user-prompt-submit
  • .claude/settings.json
  • .claude/skills/full-review/SKILL.md
  • .claude/skills/run-tests/SKILL.md
  • .claude/skills/update-crds/SKILL.md
  • CLAUDE.md
  • docs/CLAUDE_CODE_GUIDE.md

Comment on lines +84 to +86
```
boilerplate/openshift/golang-osd-operator/golangci.yml
```
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Use a language tag for the fenced config snippet.
The code block at Line 84 should specify a language (e.g., yaml or text) to satisfy MD040.

🧰 Tools
🪛 markdownlint-cli2 (0.22.1)

[warning] 84-84: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.claude/agents/lint-reviewer.md around lines 84 - 86, The fenced code block
containing "boilerplate/openshift/golang-osd-operator/golangci.yml" is missing a
language tag which triggers MD040; add an explicit language identifier (e.g.,
```yaml or ```text) on the opening fence for that snippet so the markdown linter
recognizes the block language.

Comment on lines +8 to +12
Review all changes on the current branch vs the main branch for security issues.

IMPORTANT: Only review files and lines that appear in the diff (`git diff master...HEAD`).
You may read surrounding context in those files to understand the change, but do NOT report
findings on files or code that are not part of the changeset.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Branch name inconsistency ("main" vs master).

Line 8 says "vs the main branch" while the command on line 10 uses master. This repo's default branch is master, so either align the prose with the command (recommended) or parameterize the base branch so the agent works across repos with different defaults.

📝 Proposed fix
-Review all changes on the current branch vs the main branch for security issues.
+Review all changes on the current branch vs the `master` branch for security issues.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Review all changes on the current branch vs the main branch for security issues.
IMPORTANT: Only review files and lines that appear in the diff (`git diff master...HEAD`).
You may read surrounding context in those files to understand the change, but do NOT report
findings on files or code that are not part of the changeset.
Review all changes on the current branch vs the `master` branch for security issues.
IMPORTANT: Only review files and lines that appear in the diff (`git diff master...HEAD`).
You may read surrounding context in those files to understand the change, but do NOT report
findings on files or code that are not part of the changeset.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.claude/agents/security-reviewer.md around lines 8 - 12, The README text and
the example command are inconsistent: the prose says "vs the main branch" but
the command uses `git diff master...HEAD`; update the wording or command so they
match. Either change the prose phrase "vs the main branch" to "vs the master
branch" to match the existing command, or replace the hardcoded `master` in the
`git diff master...HEAD` command with a parameter/variable (e.g.,
`${BASE_BRANCH}`) and show how to set it (or detect default branch) so the
instruction works across repos. Ensure both the descriptive text ("vs the main
branch") and the command (`git diff ...`) use the same branch identifier.

Comment on lines +8 to +10
Review all changes on the current branch vs the main branch for test quality.

IMPORTANT: Only review files and lines that appear in the diff (`git diff master...HEAD`).
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Branch baseline is inconsistent (main vs master).
Line 8 says main, while Line 10 uses master...HEAD. Pick one canonical baseline to avoid drift in review scope.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.claude/agents/test-reviewer.md around lines 8 - 10, The branch baseline
strings are inconsistent—one occurrence uses "main" and another uses
"master...HEAD"; pick a single canonical baseline (e.g., "main") and make both
tokens consistent in the file by replacing "master...HEAD" with "main...HEAD"
(or vice versa if you prefer "master"), and update any adjacent
instructions/comments that reference the baseline so the review scope is
unambiguous.

Comment on lines +87 to +103
```
## Test Review Report

### Missing Coverage (High Priority)
[Critical untested code paths]

### Test Quality Issues
[Brittle tests, incorrect mocking, isolation problems]

### Best Practice Improvements
[Naming, organization, Go testing conventions]

### Summary
- Coverage gaps: X high, Y medium
- Quality issues: Z
- Total recommendations: N
```
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Add a fenced code language for the output template.
The block at Line 87 is missing a language tag and will fail MD040 checks.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.claude/agents/test-reviewer.md around lines 87 - 103, Add a fenced code
language tag to the output template's code block that starts with the triple
backticks (the block containing "## Test Review Report" etc.) so it satisfies
MD040; update the opening fence (``` ) to include a language identifier (for
example ```md or ```markdown or ```txt) to mark the block's language and prevent
lint failures.

Comment on lines +13 to +42
LINT_OUTPUT=$(make lint 2>&1) || {
LINT_EXIT=$?
# Show last 50 lines which typically contain the most relevant errors
ERROR_SUMMARY=$(echo "$LINT_OUTPUT" | tail -50 | sed 's/\\/\\\\/g; s/"/\\"/g')
cat <<EOF
[
{
"role": "user",
"content": "❌ Linting failed. Recent errors:\n\`\`\`\n${ERROR_SUMMARY}\n\`\`\`\n\nRun 'make lint' to see full output."
}
]
EOF
exit 1
}

# Run tests
TEST_OUTPUT=$(make go-test 2>&1) || {
TEST_EXIT=$?
# Show last 100 lines to capture multiple failures and stack traces
ERROR_SUMMARY=$(echo "$TEST_OUTPUT" | tail -100 | sed 's/\\/\\\\/g; s/"/\\"/g')
cat <<EOF
[
{
"role": "user",
"content": "❌ Tests failed. Recent output:\n\`\`\`\n${ERROR_SUMMARY}\n\`\`\`\n\nRun 'make go-test' to see full output."
}
]
EOF
exit 1
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Simulate the current escaping against multi-line input and validate the JSON with jq.
ERROR_SUMMARY=$(printf 'first line\nsecond "line" with \\backslash\nthird\n' | sed 's/\\/\\\\/g; s/"/\\"/g')
cat <<EOF | jq .
[
  {
    "role": "user",
    "content": "❌ Linting failed. Recent errors:\n\`\`\`\n${ERROR_SUMMARY}\n\`\`\`\n\nRun 'make lint' to see full output."
  }
]
EOF

Repository: openshift/ocm-agent-operator

Length of output: 184


🏁 Script executed:

#!/bin/bash
# Check if the file exists and read the relevant lines
if [ -f ".claude/hooks/before-commit" ]; then
  echo "=== File found, reading lines 13-42 ==="
  sed -n '13,42p' .claude/hooks/before-commit
  echo ""
  echo "=== Full file context ==="
  cat -n .claude/hooks/before-commit
else
  echo "File not found: .claude/hooks/before-commit"
  # Try to locate it
  find . -name "before-commit" -type f 2>/dev/null | head -20
fi

Repository: openshift/ocm-agent-operator

Length of output: 2511


JSON output is invalid whenever lint or test output spans multiple lines.

Lines 16 and 32 use sed 's/\\/\\\\/g; s/"/\\"/g' which escapes only backslashes and double quotes. The captured multi-line output from tail still contains literal newlines (and possibly tabs/control characters) that are inserted into the "content" string via the heredoc. Per RFC 8259, JSON strings cannot contain unescaped control characters, so strict JSON parsers will reject the payload—meaning the consumer (Claude Code hook runtime) discards the message and the user never sees the failure reason.

Proposed fix using jq for JSON-safe encoding
 # Run linting on changed files
 LINT_OUTPUT=$(make lint 2>&1) || {
-    LINT_EXIT=$?
-    # Show last 50 lines which typically contain the most relevant errors
-    ERROR_SUMMARY=$(echo "$LINT_OUTPUT" | tail -50 | sed 's/\\/\\\\/g; s/"/\\"/g')
-    cat <<EOF
-[
-  {
-    "role": "user",
-    "content": "❌ Linting failed. Recent errors:\n\`\`\`\n${ERROR_SUMMARY}\n\`\`\`\n\nRun 'make lint' to see full output."
-  }
-]
-EOF
+    ERROR_SUMMARY=$(printf '%s\n' "$LINT_OUTPUT" | tail -50)
+    jq -n --arg body "$ERROR_SUMMARY" '
+      [{role:"user",
+        content:("❌ Linting failed. Recent errors:\n```\n" + $body + "\n```\n\nRun '\''make lint'\'' to see full output.")}]
+    '
     exit 1
 }

Apply the same pattern to the test branch (lines 29–42). Alternatively, extend the sed pipeline to escape control characters: sed 's/\\/\\\\/g; s/"/\\"/g; s/$/\\n/g' (though this approach is less robust than jq).

Minor: LINT_EXIT and TEST_EXIT (lines 14, 30) are captured but never used.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.claude/hooks/before-commit around lines 13 - 42, The JSON currently built
in the lint and test failure blocks is invalid when outputs contain
newlines/control-chars because the sed pipeline only escapes backslashes and
quotes; replace the sed-based escaping with proper JSON encoding via jq: capture
the raw tail output into LINT_OUTPUT/TEST_OUTPUT as before, set ERROR_SUMMARY
using the tail result (keep the variable names), then build the JSON payload
with jq (for example use jq -n --arg body "$ERROR_SUMMARY" '[{role:"user",
content: "❌ Linting failed. Recent errors:\n```\n"+$body+"\n```\n\nRun '\''make
lint'\'' to see full output."}]') for the lint branch and similarly for the test
branch (use "❌ Tests failed..." and run 'make go-test'); also remove or use the
unused LINT_EXIT/TEST_EXIT variables or delete those assignments.

Comment on lines +15 to +24
2. **Launch all review agents in parallel**

Spawn each of the following agents in the background without worktree isolation. These agents are read-only reviewers and do not need isolated worktrees. IMPORTANT: Include the diff output in each agent's prompt and instruct them to ONLY review files and lines that appear in the diff — they must not explore or report on files outside the changeset:

- @security-reviewer - OWASP Top 10, RBAC, secrets management, input validation
- @lint-reviewer - Code quality, style, golangci-lint findings
- @test-reviewer - Test coverage gaps, test quality, Ginkgo/Gomega patterns
- @error-handling-reviewer - Error wrapping, logging, failure modes

Additional focus areas if specified: $ARGUMENTS
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🌐 Web query:

Claude Code agent frontmatter isolation worktree override from skill

💡 Result:

In Claude Code (Anthropic's agentic coding tool), "frontmatter isolation worktree override from skill" refers to configuring Git worktree isolation for agents and subagents via YAML frontmatter in agent definition files (.claude/agents/*.md), with known bugs where frontmatter isolation: worktree is ignored in certain invocation methods, requiring explicit overrides, sometimes via skills or tool parameters. Key concepts: - isolation: worktree in agent frontmatter creates a temporary Git worktree for the agent/subagent, providing file isolation for parallel work without conflicts. Worktrees auto-clean if no changes. - Works reliably for subagents spawned via Agent tool. - Bug: Ignored when invoking main agent via claude --agent (runs in main worktree) or plugin agents (edits main tree). - Workaround: Pass isolation: "worktree" explicitly in Agent tool calls; use --worktree CLI flag; invoke via parent session Agent tool. - Skills (/skill-name) are Markdown files in .claude/skills/ with frontmatter; they can reference or trigger worktree usage but do not directly override agent isolation (skills load shared across worktrees). Custom skills like "using-git-worktrees" automate worktree creation/management. Example agent frontmatter: --- name: issue-handler description: Handle GitHub issues in isolated worktree isolation: worktree skills: [handle-issue] --- Official docs confirm isolation field for subagents/agents. Open GitHub issues (#50357, #34775 as of Apr 2026) track frontmatter bugs; no fix confirmed in results.

Citations:


🏁 Script executed:

# Find the skill file and read the relevant lines
find . -name "SKILL.md" -path "*full-review*" | head -20

Repository: openshift/ocm-agent-operator

Length of output: 110


🏁 Script executed:

# Find the agent files referenced in the review
find . -path "*/.claude/agents/*" -name "*.md" | head -30

Repository: openshift/ocm-agent-operator

Length of output: 222


🏁 Script executed:

cat -n ./.claude/skills/full-review/SKILL.md | sed -n '1,30p'

Repository: openshift/ocm-agent-operator

Length of output: 1735


🏁 Script executed:

# Check frontmatter of each agent file
for agent in ./.claude/agents/{security-reviewer,lint-reviewer,test-reviewer,error-handling-reviewer}.md; do
  echo "=== $agent ==="
  head -20 "$agent"
  echo ""
done

Repository: openshift/ocm-agent-operator

Length of output: 3269


Skill contradicts the agent frontmatter on worktree isolation.

This skill instructs parallel launches "without worktree isolation" (line 17), but every referenced agent (security-reviewer, lint-reviewer, test-reviewer, error-handling-reviewer) declares isolation: worktree in its frontmatter. Either:

  • Remove isolation: worktree from the four agent definitions (if read-only parallel runs without isolation are the intent), or
  • Reword this skill to respect each agent's declared isolation.

Leaving both as-is creates ambiguity in expected behavior.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.claude/skills/full-review/SKILL.md around lines 15 - 24, The skill text
"Launch all review agents in parallel" conflicts with the agents' frontmatter
which sets isolation: worktree for the agents security-reviewer, lint-reviewer,
test-reviewer, and error-handling-reviewer; pick one fix: either remove
isolation: worktree from those four agent definitions (security-reviewer,
lint-reviewer, test-reviewer, error-handling-reviewer) if you intend true
parallel read-only runs without worktrees, or update the skill wording to
require per-agent worktree isolation (rephrase the parallel step to spawn agents
respecting each agent's isolation: worktree); ensure the chosen approach is
applied consistently across the skill text and the four agent frontmatters so
behavior is unambiguous.

Comment thread CLAUDE.md
### Automated Hooks

- **user-prompt-submit** - Reminds to run tests after code changes
- **before-commit** - Automatically runs `make lint` and `make test` before commits
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Doc drift: hook runs make go-test, not make test.

.claude/hooks/before-commit invokes make go-test. While make test delegates to go-test in boilerplate standard.mk, having the docs match the actual command avoids confusion when readers grep for the exact target.

📝 Proposed fix
-- **before-commit** - Automatically runs `make lint` and `make test` before commits
+- **before-commit** - Automatically runs `make lint` and `make go-test` before commits
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- **before-commit** - Automatically runs `make lint` and `make test` before commits
- **before-commit** - Automatically runs `make lint` and `make go-test` before commits
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@CLAUDE.md` at line 108, Docs mismatch: update the CLAUDE.md entry for the
"before-commit" hook to match the actual hook command; change the text that
currently says "Automatically runs `make test` and `make lint`" to state it runs
`make go-test` (since `.claude/hooks/before-commit` invokes `make go-test`) so
readers searching for the exact make target find the real command.

Comment thread docs/CLAUDE_CODE_GUIDE.md
Comment on lines +61 to +63
```
/full-review
```
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Add language tags to unlabeled fenced blocks.
Multiple fenced blocks are missing language identifiers and will keep failing MD040. Please label them (bash, text, or markdown) based on content.

Also applies to: 85-89, 104-106, 145-147, 151-153, 174-178, 195-211, 223-251, 253-261, 265-279, 283-295, 299-313, 357-359, 362-364, 379-381, 384-386

🧰 Tools
🪛 markdownlint-cli2 (0.22.1)

[warning] 61-61: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/CLAUDE_CODE_GUIDE.md` around lines 61 - 63, Several fenced code blocks
in CLAUDE_CODE_GUIDE.md lack language identifiers and trigger MD040; update each
unlabeled triple-backtick block (e.g., the block containing "/full-review" and
the other blocks noted in the review) by adding the appropriate language tag
(bash, text, or markdown) based on the snippet content so the linter recognizes
the language and MD040 is satisfied; scan the document for other unlabeled
```...``` blocks (including the ranges called out in the review) and add
consistent language tags to all of them.

Comment thread docs/CLAUDE_CODE_GUIDE.md
Comment on lines +91 to +96
**What it runs:**
- `make lint` - golangci-lint checks
- `make test` - Unit tests with coverage
- `go test -race` - Race condition detection
- `make go-build` - Build verification

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Test command names are inconsistent with configured hooks/skills.
These lines document make test, but the configured hook/skill behavior uses make go-test. Please align guide text/examples with actual commands to prevent broken copy-paste workflows.

Proposed doc fix
- - `make test` - Unit tests with coverage
+ - `make go-test` - Unit tests

-   • make test  - Run unit tests
+   • make go-test  - Run unit tests

- 2. `make test` - Tests must pass
+ 2. `make go-test` - Tests must pass

Also applies to: 186-188, 175-178

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/CLAUDE_CODE_GUIDE.md` around lines 91 - 96, The documentation lists the
test command as `make test` but the repository hooks/skills expect `make
go-test`; update all occurrences (e.g., the section heading "What it runs" and
the listed bullet `make test` and the other mentions around lines referenced) to
`make go-test` (or add a note that `make test` is an alias if you prefer), and
ensure the examples and any guidance consistently use `make go-test` so
copy-pasted commands match configured hooks like the go-test skill.

Comment thread docs/CLAUDE_CODE_GUIDE.md
Comment on lines +226 to +250
Claude: [Launches all 5 review agents in parallel]

## Full Review Report

### Security Review
✅ No critical issues found

### Performance Review
🔴 1 high severity: Inefficient API calls in reconcile loop
[Details and fix suggestions]

### Test Review
🔴 2 high severity: Missing test coverage for error paths
[Details and suggested tests]

### Error Handling Review
⚠️ 3 medium: Missing error wrapping
[Details]

### Concurrency Review
✅ No issues found

---
Summary: 3 high, 3 medium issues found
Estimated fix time: 1-2 hours
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

/full-review output example references non-existent agent categories.
The example claims “all 5 review agents” and includes Performance/Concurrency sections, but the configured agent set is 4 reviewers. This creates incorrect expectations for users.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/CLAUDE_CODE_GUIDE.md` around lines 226 - 250, The example in the
"/full-review" output (under the "## Full Review Report" block attributed to
"Claude") incorrectly states "Launches all 5 review agents" and includes agent
categories not present in the configured set; update this example to match the
actual configured 4-reviewer set by removing or renaming the extra agent
category lines (e.g., drop or combine the Performance/Concurrency sections as
appropriate), adjust the summary counts ("3 high, 3 medium") and the estimated
fix time to reflect the corrected categories, and ensure the header and inline
text no longer reference "5 review agents" so the example is consistent with the
real configuration.

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Apr 24, 2026

@devppratik: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/validate 5f5d4e4 link true /test validate

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Comment thread CLAUDE.md
- Mock interfaces for testing

Always run `make` after modifying API types to regenerate required code. No newline at end of file
Always run `make` after modifying API types to regenerate required code.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You could use a stop hook here so you can reduce context bloat. See https://github.com/openshift-online/rosa-claude-plugins/blob/main/.claude/hooks/stop-prek-validation.sh for an example.

Comment thread CLAUDE.md

## Claude Code Integration

This repository is configured with Claude Code for AI-assisted development.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I don't think this is necessary to tell Claude.

Comment thread CLAUDE.md

### Quick Start Skills

Skills are invoked with the `/` prefix:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This reads like it's for a human but is in CLAUDE.md

Comment thread CLAUDE.md
- **`/run-tests`** - Runs linting, unit tests, and race detection
- **`/update-crds`** - Regenerates CRD manifests and deepcopy code after API changes

### Review Agents
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Comment thread CLAUDE.md

### Comprehensive Guide

See [docs/CLAUDE_CODE_GUIDE.md](docs/CLAUDE_CODE_GUIDE.md) for detailed documentation on skills, agents, workflows, and best practices.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This is mentioned in the Resources section again.

Comment thread CLAUDE.md
- [OSD Operator Development Guide](https://github.com/openshift/ops-sop/blob/master/operators/README.md)
- [Boilerplate Documentation](https://github.com/openshift/boilerplate)
- [Operator SDK Documentation](https://sdk.operatorframework.io/)
- [SREP-4410: Claude Integration Epic](https://issues.redhat.com/browse/SREP-4410) No newline at end of file
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The git commit for this should have this reference so I don't think we need it in here.

Comment thread .claude/settings.json
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

There's a hooks directory with scripts in it, but neither of those scripts are configured in here.

@@ -0,0 +1,42 @@
---
name: full-review
description: Run all review agents in parallel for comprehensive code quality analysis
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Why not run the coderabbit cli? These seems like configurations that should be in coderabbit and can be run in a pre-push hook locally.

@devppratik
Copy link
Copy Markdown
Contributor Author

/hold
Putting on hold as it is not yet ready

@openshift-ci openshift-ci Bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants