Skip to content

jianshuo/claude-skills / wjs-looping-feedback

wjs-looping-feedback

Verified

Use when the user wants to add an in-site feedback loop to a website repo — a floating "提个建议" button where allowlisted visitors submit suggestions that become a GitHub Issue, which GitHub Actions turns into an automatic code change via Claude Code, auto-merges and deploys, and records on a /_feedback dashboard with one-click revert. Triggers — "给网站加个反馈对话框", "提一句话就自动改网站", "装上反馈闭环", "feedback loop", "/wjs-looping-feedback".

assets/feedback.yml

View on GitHub
name: feedback-loop
# Auth: set EITHER secret CLAUDE_CODE_OAUTH_TOKEN (Pro/Max, via `claude setup-token`)
#       OR secret ANTHROPIC_API_KEY. Set exactly one; the other resolves to an empty
#       string and is ignored by the action.
#
# claude-code-action interface VERIFIED against anthropics/claude-code-action@v1
# (action.yml inputs list + docs/usage.md, fetched Unit 4):
#   - anthropic_api_key        -> Anthropic API key
#   - claude_code_oauth_token  -> Claude Pro/Max OAuth token (from `claude setup-token`)
#   - prompt                   -> headless / non-interactive instructions for Claude
# The action edits the workspace in headless mode; it does NOT commit/push for us.
# Our own "Commit, finalize ledger, push to main" step handles git + ledger + deploy.
on:
  issues:
    types: [labeled]

concurrency:
  group: feedback-loop
  cancel-in-progress: false

permissions:
  contents: write
  issues: write
  pull-requests: write
  id-token: write   # required by claude-code-action to mint its OIDC token

jobs:
  feedback:
    if: contains(github.event.issue.labels.*.name, 'feedback') || contains(github.event.issue.labels.*.name, 'revert')
    runs-on: ubuntu-latest
    steps:
      - name: Allowlist gate
        id: gate
        env:
          ALLOWLIST: ${{ vars.FEEDBACK_ALLOWLIST }}
          AUTHOR: ${{ github.event.issue.user.login }}
          GH_TOKEN: ${{ github.token }}
          REPO: ${{ github.repository }}
          NUM: ${{ github.event.issue.number }}
        run: |
          ALLOWLIST=$(printf '%s' "$ALLOWLIST" | tr -d '[:space:]')
          if echo ",${ALLOWLIST}," | grep -qiF ",${AUTHOR},"; then
            echo "allowed=true" >> "$GITHUB_OUTPUT"
          else
            echo "allowed=false" >> "$GITHUB_OUTPUT"
            gh issue close "$NUM" -R "$REPO" --reason "not planned" \
              --comment "抱歉,本站反馈仅对已授权用户开放。"
          fi

      - name: Checkout
        if: steps.gate.outputs.allowed == 'true'
        uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Set up Node
        if: steps.gate.outputs.allowed == 'true'
        uses: actions/setup-node@v4
        with:
          node-version: 20

      - name: Run Claude Code
        if: steps.gate.outputs.allowed == 'true'
        uses: anthropics/claude-code-action@v1
        with:
          # Use the workflow's own token so the action does NOT require the
          # Claude GitHub App to be installed (app-token exchange is skipped).
          github_token: ${{ github.token }}
          claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
          anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
          # Non-interactive runs deny any tool not listed here, so Claude could not
          # edit the site. Allow the tools needed to read, edit, and (for revert) git.
          claude_args: |
            --allowedTools "Read,Glob,Grep,Edit,Write,Bash"
          prompt: |
            You are handling website feedback issue #${{ github.event.issue.number }}.
            Title: ${{ github.event.issue.title }}
            Body:
            ${{ github.event.issue.body }}

            Read .feedback/INSTRUCTIONS.md and follow it exactly.

      - name: Commit, finalize ledger, push to main
        if: steps.gate.outputs.allowed == 'true'
        env:
          GH_TOKEN: ${{ github.token }}
          REPO: ${{ github.repository }}
          NUM: ${{ github.event.issue.number }}
          AUTHOR: ${{ github.event.issue.user.login }}
          TITLE: ${{ github.event.issue.title }}
          BODY: ${{ github.event.issue.body }}
        run: |
          git config user.name "feedback-bot"
          git config user.email "feedback-bot@users.noreply.github.com"

          if [ -z "$(git status --porcelain)" ]; then
            gh issue comment "$NUM" -R "$REPO" \
              --body "我看了这条反馈,但没有做改动(可能需要更多信息或无法自动处理)。"
            exit 0
          fi

          OUT=$(node -e "process.stdout.write(require('./.feedback/config.json').out)")
          NOW=$(date -u +%Y-%m-%dT%H:%M:%SZ)

          git add -A
          git commit -m "feedback: resolve #${NUM}"
          SHA=$(git rev-parse --short HEAD)

          if printf '%s' "$TITLE" | grep -qiE '^revert: #[0-9]+'; then
            TARGET=$(printf '%s' "$TITLE" | grep -oE '#[0-9]+' | head -1 | tr -d '#')
            node .feedback/feedback-finalize.mjs revert \
              --repo "$REPO" --issue "$TARGET" \
              --ledger .feedback/feedback-ledger.json --out "$OUT" --now "$NOW"
          else
            [ -f .feedback/last-summary.txt ] || echo "自动处理完成。" > .feedback/last-summary.txt
            node .feedback/feedback-finalize.mjs record \
              --repo "$REPO" --issue "$NUM" --author "$AUTHOR" \
              --suggestion "$BODY" --summary-file .feedback/last-summary.txt \
              --commit "$SHA" --ledger .feedback/feedback-ledger.json --out "$OUT" --now "$NOW"
          fi
          rm -f .feedback/last-summary.txt

          git add -A
          git commit -m "feedback: update ledger for #${NUM}"
          # NOTE: this push uses GITHUB_TOKEN. External push-deploy hosts (Cloudflare
          # Pages git-connect, Vercel, Netlify) deploy from it automatically. But a
          # GitHub Actions deploy workflow in THIS repo (e.g. GitHub Pages) will NOT be
          # triggered by a GITHUB_TOKEN push (recursion prevention) — give that deploy
          # workflow a `workflow_run` trigger on "feedback-loop". See install.md step 4.5.
          git push origin HEAD:main

          gh issue comment "$NUM" -R "$REPO" \
            --body "已处理并合并到 main(commit ${SHA}),即将自动部署上线。可在 /_feedback 查看与回滚。"
          gh issue close "$NUM" -R "$REPO" --reason completed
writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deploymentStars: 322kUpdated Claude CodeCodexVerifiedInstall
xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release.Stars: 118kUpdated Claude CodeCodexVerifiedInstall