Skip to content

a-pavithraa/springboot-skills-marketplace / plugins/springboot-architecture/skills/spring-boot-team-harness

spring-boot-team-harness

Verified

Use when a team wants every developer's coding agent (Claude Code or Codex) to follow the same rules and coding conventions on a Maven or Gradle Spring Boot 4 repository: setting up AGENTS.md, coding standards, guardrails, shared agent settings, or build and CI checks that agents must pass before code merges. It adds ./mvnw verify or ./gradlew build gates that fail on null-safety bugs (NullAway with JSpecify), module-boundary breaches (Spring Modulith), unknown or deprecated Boot property keys, Spring mistakes that compile (ArchUnit) and unformatted code, Claude Code and Codex hooks that run those gates before a turn ends, and a CI workflow.

FileKindSize
SKILL.mdskill md20.3 KB
assets/gradle/harness.gradleother5.4 KB
assets/observability/HandledFailureFilter.javaother2.1 KB
assets/observability/InstallOpenTelemetryAppender.javaother877 B
assets/observability/LogLeakCheck.javaother3.3 KB
assets/observability/application-observability-defaults.ymlconfig1.9 KB
assets/observability/application-observability.ymlconfig445 B
assets/observability/check_dashboards.pyscript3.4 KB
assets/observability/check_request.pyscript6.6 KB
assets/observability/compose.observability.ymlconfig704 B
assets/observability/dashboards/jvm-resources.jsonconfig7.7 KB
assets/observability/dashboards/service-health.jsonconfig10.7 KB
assets/observability/grafana-provider.yamlconfig133 B
assets/observability/logback-spring.xmlconfig736 B
assets/observability/observability.mdmarkdown7.4 KB
assets/pom/dependencies.xmlconfig236 B
assets/pom/managed-dependencies.xmlconfig355 B
assets/pom/modules-dependencies.xmlconfig269 B
assets/pom/observability-dependencies.xmlconfig833 B
assets/pom/plugins.xmlconfig2.2 KB
assets/pom/properties.xmlconfig642 B
assets/pom/rules-dependencies.xmlconfig268 B
assets/project/.claude/hooks/guard.shscript7.2 KB
assets/project/.claude/hooks/verify-on-stop.shscript11.9 KB
assets/project/.claude/settings.jsonconfig1.4 KB
assets/project/.codex/hooks.jsonconfig858 B
assets/project/.github/harness/check-file-size.shscript3.7 KB
assets/project/.github/harness/check-protected.shscript10.0 KB
assets/project/.github/workflows/harness-integrity.ymlconfig1.6 KB
assets/project/.github/workflows/verify.ymlconfig440 B
assets/project/.mvn/jvm.configother644 B
assets/project/AGENTS.mdmarkdown10.2 KB
assets/project/CLAUDE.mdmarkdown11 B
assets/project/REVIEW.mdmarkdown2.6 KB
assets/tests/BuildSetupTests.javaother19.6 KB
assets/tests/CodeRulesTests.javaother42.2 KB
assets/tests/ConfigurationKeysTests.javaother14.2 KB
assets/tests/ModuleBoundariesTests.javaother10.3 KB
assets/tests/UnusedCodeTests.javaother9.3 KB
assets/tests/archunit.propertiesother106 B
references/browser-verification.mdmarkdown18.1 KB
references/gates.mdmarkdown7.7 KB
scripts/apply_harness.pyscript59.6 KB
scripts/baseline.pyscript8.9 KB
scripts/report.pyscript6.1 KB

assets/project/.claude/hooks/guard.sh

View on GitHub
#!/usr/bin/env bash
# PreToolUse hook for Claude Code and Codex. Refuses actions the team never wants an agent to take: it prints a deny
# decision as JSON, which both tools honour and show to the agent. Codex 0.166 let an apply_patch edit through on exit 2.
#
# Each refusal appends one JSON line to .git/harness/events.jsonl (time, session, rule; no command or path), which the
# harness's report.py summarises.
set -u
input=$(cat)
# Codex sets no project folder variable and runs hooks in the session's folder, which can be a subfolder.
root=${CLAUDE_PROJECT_DIR:-$(git rev-parse --show-toplevel 2> /dev/null || pwd)}
rule_tests='CodeRulesTests|ConfigurationKeysTests|BuildSetupTests|UnusedCodeTests|ModuleBoundariesTests|ModularityTests|ArchUnitTests|ArchitectureRulesTest|LogLeakCheck'

# block <reason> <rule>
block() {
  local dir session
  if dir=$(cd "$root" 2> /dev/null && git rev-parse --absolute-git-dir 2> /dev/null); then
    session=$(printf '%s' "$input" | grep -o '"session_id" *: *"[^"]*"' | head -1 | sed 's/.*"\([^"]*\)"$/\1/' \
      | tr -cd 'A-Za-z0-9_-')
    mkdir -p "$dir/harness" 2> /dev/null && printf '{"ts":"%s","hook":"guard","session":"%s","result":"refused","rule":"%s"}\n' \
      "$(date -u +%Y-%m-%dT%H:%M:%SZ)" "${session:-unknown}" "$2" >> "$dir/harness/events.jsonl" 2> /dev/null
  fi
  printf '{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"deny","permissionDecisionReason":"%s"}}\n' \
    "$(printf '%s' "Blocked by the team harness: $1" | sed 's/\\/\\\\/g; s/"/\\"/g')"
  exit 0
}

if printf '%s' "$input" | grep -q '"tool_name" *: *"Bash"'; then
  command=$(printf '%s' "$input" | grep -oE '"command" *: *"(\\.|[^"\\])*"' | head -1 \
    | sed -E 's/^"command" *: *"//; s/"$//; s/\\"/"/g; s/\\\\/\\/g')
  printf '%s' "$command" | grep -Eq 'git[[:space:]].*push([[:space:]].*)?[[:space:]](--force|-f)([[:space:]]|$)' \
    && block "force-pushing rewrites shared history. Push normally, or ask the user to force-push themselves." force-push
  printf '%s' "$command" | grep -Eq 'git[[:space:]].*reset([[:space:]].*)?[[:space:]]--hard' \
    && block "git reset --hard discards uncommitted work. Use git stash, or ask the user." reset-hard
  printf '%s' "$command" | grep -Eq 'git[[:space:]].*clean([[:space:]].*)?[[:space:]]-[a-zA-Z]*f' \
    && block "git clean -f deletes untracked files for good. Ask the user." clean-force
  printf '%s' "$command" | grep -Eq 'allowStoreCreation=true|freeze\.refreeze=true|modulith\.store\.record=true|harness\.record=true' \
    && block "that setting records today's ArchUnit or Spring Modulith violations as accepted. Fix the violation instead; to record a baseline on purpose, ask the user to run the harness's baseline.py." archunit-record
  # Skipping is fine for packaging a jar to run; a gate run that skips checks proves nothing.
  printf '%s' "$command" | grep -Eq '(^|[[:space:]])(verify|install|build|check)([[:space:]]|$)' \
    && printf '%s' "$command" | grep -Eq -- '-D(skipTests|maven\.test\.skip|jacoco\.skip|enforcer\.skip)(=true)?([^[:alnum:]._=-]|$)|(-x|--exclude-task)[[:space:]]+:?test([[:space:]]|$)' \
    && block "that runs the gates with tests or checks skipped, so a pass proves nothing. Run it without the skip flag, and fix what fails." skip-checks
  # Writing commands that name a protected file. Not exhaustive: the Harness integrity CI check is the backstop.
  printf '%s' "$command" | grep -Eq "archunit_store|modulith_store|archunit\.properties|package-info\.java|($rule_tests)\.java" \
    && printf '%s' "$command" | grep -Eq '(^|[^0-9&])>|(^|[[:space:];&|])(sed|perl)([[:space:]]+-[^[:space:]]+)*[[:space:]]+(-[a-zA-Z]*i|--in-place)|(^|[[:space:];&|])(tee|truncate|rm|mv|cp|python3?|node|ruby)([[:space:]]|$)' \
    && block "that command writes to a file holding the team's build rules or a record of tolerated violations. Fix the code the rule reports. To change a rule, ask the user." bash-protected-file
  exit 0
fi

# check_path <path>: refuses an edit to a protected file, and returns when the edit is fine.
check_path() {
  local path=$1 relative ref
  case "$path" in
    /* | [A-Za-z]:/*) ;;
    *) path="$PWD/$path" ;;
  esac
  case "$path" in
    */archunit_store/*)
      block "src/test/resources/archunit_store records the rule violations that existed before the harness, so they're frozen. Fix the new violation instead. To accept one on purpose, ask the user." archunit-store ;;
    */modulith_store)
      block "src/test/resources/modulith_store records the module-boundary violations that existed before the harness, so they're tolerated. Fix the new violation instead. To accept one on purpose, ask the user." modulith-store ;;
    */archunit.properties)
      block "archunit.properties sets how the freeze record works; with store creation allowed, new violations would be recorded as accepted. Fix the violation instead, or ask the user." archunit-properties ;;
    */CodeRulesTests.java | */ConfigurationKeysTests.java | */BuildSetupTests.java | */UnusedCodeTests.java | */ModuleBoundariesTests.java \
      | */ModularityTests.java | */ArchUnitTests.java | */ArchitectureRulesTest.java | */LogLeakCheck.java)
      [ -e "$path" ] && block "${path##*/} holds the team's build rules, and a change to it changes what every developer's build accepts. Fix the code the rule reports. To change a rule, ask the user." rule-test
      return 0 ;;
    */package-info.java)
      # A module's allowedDependencies and type are its boundary rules: widening them would get any breach past the
      # boundary test. Telling a widening edit from a harmless one takes parsing Java, so every edit to a module's
      # package-info.java is refused; creating one for a new module is fine.
      [ -e "$path" ] && grep -q 'ApplicationModule' "$path" \
        && block "${path%/*}/package-info.java declares the module's boundary rules (allowedDependencies, OPEN). Call the other module through an allowed dependency, or ask the user to change the rule." module-rules
      return 0 ;;
    */db/migration/*.sql) ;;
    *) return 0 ;;
  esac

  relative=$(git -C "$root" ls-files --full-name -- "$path" 2> /dev/null)
  [ -n "$relative" ] || return 0
  for ref in origin/main origin/master main master; do
    if git -C "$root" rev-parse --verify -q "$ref" > /dev/null; then
      git -C "$root" cat-file -e "$ref:$relative" 2> /dev/null \
        && block "$relative is on $ref, so it may already have run on a shared database, and Flyway fails when its checksum changes. Write a new migration instead (see the db-migration skill)." applied-migration
      return 0
    fi
  done
}

# Codex edits files with apply_patch: the patch text names each file it updates, deletes or moves to. Adding a file
# passes, as Write does for a file that doesn't exist yet.
if printf '%s' "$input" | grep -q '"tool_name" *: *"apply_patch"'; then
  # The patch is a JSON string: an escaped backslash in a Windows path becomes /, then each \n ends a line.
  printf '%s' "$input" | awk '{ gsub(/\\\\/, "/"); gsub(/\\n/, "\n"); print }' \
    | sed -n -E 's/^\*\*\* (Update File|Delete File|Move to): (.*[^[:space:]])[[:space:]]*$/\2/p' \
    | while IFS= read -r file; do
      check_path "$file"
    done
  exit $?
fi

path=$(printf '%s' "$input" | grep -o '"file_path" *: *"[^"]*"' | head -1 | sed 's/.*: *"//; s/"$//; s#\\\\#/#g')
[ -n "$path" ] && check_path "$path"
exit 0
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall