Skip to content

anh-chu/llm-wiki-pm / skills/llm-wiki-review

llm-wiki-review

Verified

FileKindSize
SKILL.mdskill md4.6 KB
reviewer-prompt.mdmarkdown2.4 KB
run-review.shexecutablescript2.3 KB

run-review.sh

View on GitHub
#!/usr/bin/env bash
# run-review.sh DRAFT [REVIEWER] — run the configured reviewer on a draft, print the review.
#
# REVIEWER: claude (account default model), claude:haiku|sonnet|opus, codex, or any shell
# command that reads the prompt on stdin and prints the review. Order: the
# argument (only when the user named a reviewer for this turn) > WIKI_REVIEWER >
# WIKI_REVIEWER_OPTION (the plugin option, set by the skill) > claude:opus. A value
# that is still an unsubstituted ${...} is ignored.
# Claude reviewers run as a separate read-only `claude -p` in the wiki directory,
# with WIKI_REVIEW_RUNNING=1 so the review-gate hook does not gate the reviewer.
# Exits non-zero with a message on stderr when the review fails or is empty.
set -uo pipefail

draft="${1:?usage: run-review.sh DRAFT [REVIEWER]}"
unset_literal() { case "$1" in '${'*) echo "" ;; *) echo "$1" ;; esac; }
reviewer=$(unset_literal "${2:-}")
option=$(unset_literal "${WIKI_REVIEWER_OPTION:-}")
reviewer="${reviewer:-${WIKI_REVIEWER:-${option:-claude:opus}}}"

here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
wiki=$(sh "$here/../../hooks/resolve-wiki.sh")
[ -n "$wiki" ] && [ -d "$wiki" ] || { echo "run-review: no wiki configured" >&2; exit 2; }
[ -s "$draft" ] || { echo "run-review: draft $draft is missing or empty" >&2; exit 2; }

prompt=$(mktemp /tmp/wiki-review-prompt.XXXXXX)
out=$(mktemp /tmp/wiki-review-out.XXXXXX)
trap 'rm -f "$prompt" "$out"' EXIT
sed -e "s#{{WIKI}}#$wiki#g" -e "s#{{DRAFT}}#$draft#g" "$here/reviewer-prompt.md" > "$prompt"

case "$reviewer" in
  claude|claude:*)
    model_args=()
    [ "$reviewer" != claude ] && model_args=(--model "${reviewer#claude:}")
    (cd "$wiki" && WIKI_REVIEW_RUNNING=1 claude -p "${model_args[@]}" --setting-sources project --disable-slash-commands \
       --allowedTools "Read,Grep,Glob" < "$prompt" > "$out")
    ;;
  codex)
    codex exec --sandbox read-only --skip-git-repo-check --ephemeral -C "$wiki" -o "$out" \
      "$(cat "$prompt")" < /dev/null > /dev/null 2>&1
    ;;
  *)
    (cd "$wiki" && WIKI_REVIEW_RUNNING=1 sh -c "$reviewer" < "$prompt" > "$out")
    ;;
esac
status=$?

if [ $status -ne 0 ] || [ ! -s "$out" ]; then
  echo "run-review: reviewer '$reviewer' failed (exit $status, $(wc -c < "$out") bytes)" >&2
  exit 1
fi
echo "Reviewer: $reviewer"
cat "$out"
receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementationStars: 323kUpdated Claude CodeCodexVerifiedInstall
requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirementsStars: 323kUpdated Claude CodeCodexVerifiedInstall
using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallbackStars: 323kUpdated Claude CodeCodexVerifiedInstall
verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions alwaysStars: 323kUpdated Claude CodeCodexVerifiedInstall