Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions .agents/skills/check-pr-failures/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description: >
check or watch a PR's checks, or to work through test failures on a pull request (e.g.
"why is CI failing on #12345", "check the failures on my PR", "/check-pr-failures 12345").
argument-hint: "[pr-number]"
allowed-tools: Bash, Read, Grep, Glob, Edit, Write
allowed-tools: Read Grep Glob Edit Write Bash(gh pr checks *) Bash(gh pr view *) Bash(gh run list *) Bash(gh run view *) Bash(gh api --method GET *) Bash(gh issue list *) Bash(git merge-base *) Bash(git worktree *) Bash(npm install *) Bash(npm run build:test *) Bash(npm run test:e2e *) Bash(npm run test:visualtest *) Bash(npm -w tests/js run test:js *) Bash(composer test *)
---

# Check a pull request's CI failures
Expand All @@ -26,23 +26,23 @@ order. Don't guess how long they will take. Estimate it from recent passing runs
workflow, using the workflow's file name from `.github/workflows/`:

```
gh run list --workflow <workflow-file> --status success --limit 5 --json databaseId,createdAt,updatedAt \
gh run list --repo google/site-kit-wp --workflow <workflow-file> --status success --limit 5 --json databaseId,createdAt,updatedAt \
--jq '.[] | "\(.databaseId)\t\(((.updatedAt | fromdate) - (.createdAt | fromdate)) / 60 | floor) min"'
```

A run's time includes any time it spent queued. For the time of each job on its own, use one of
those run IDs:

```
gh run view <run-id> --json jobs \
gh run view <run-id> --repo google/site-kit-wp --json jobs \
--jq '.jobs[] | select(.conclusion == "success") | "\(((.completedAt | fromdate) - (.startedAt | fromdate)) / 60 | floor) min\t\(.name)"'
```

Tell the user when to expect the slowest check. Rather than polling by hand, watch the checks and
report each one as it lands:

```
gh api "repos/google/site-kit-wp/commits/$(gh pr view <number> --json headRefOid --jq .headRefOid)/check-runs?per_page=100" \
gh api --method GET "repos/google/site-kit-wp/commits/$(gh pr view <number> --repo google/site-kit-wp --json headRefOid --jq .headRefOid)/check-runs?per_page=100" \
--jq '.check_runs[]? | select(.status=="completed") | select(.conclusion!="skipped") | "\(.conclusion|ascii_upcase): \(.name)"'
```

Expand All @@ -64,8 +64,8 @@ already settled.
## Step 1 — Collect the check results

```
gh pr checks <number>
gh api "repos/google/site-kit-wp/commits/$(gh pr view <number> --json headRefOid --jq .headRefOid)/check-runs?per_page=100" \
gh pr checks <number> --repo google/site-kit-wp
gh api --method GET "repos/google/site-kit-wp/commits/$(gh pr view <number> --repo google/site-kit-wp --json headRefOid --jq .headRefOid)/check-runs?per_page=100" \
--jq '.check_runs[] | select(.conclusion=="failure" or .status!="completed") | "\(.status)\t\(.conclusion // "-")\t\(.name)"'
```

Expand All @@ -78,7 +78,7 @@ not workflow level, before telling anyone what broke.
## Step 2 — Get the failure detail

```
gh run view <run-id> --log-failed
gh run view <run-id> --repo google/site-kit-wp --log-failed
```

Check-run **annotations are usually useless** (`Process completed with exit code 1`). The job
Expand Down Expand Up @@ -127,8 +127,8 @@ PR's, make sure the result repeats: the test fails on every run here and passes
the merge base. Then check whether the same job has recently failed on `develop`:

```
gh run list --workflow <workflow-file> --branch develop --status failure --limit 10
gh run view <run-id> --log-failed
gh run list --repo google/site-kit-wp --workflow <workflow-file> --branch develop --status failure --limit 10
gh run view <run-id> --repo google/site-kit-wp --log-failed
```

If any of those runs failed the same test, the test is flaky. Report it as flaky, with links to
Expand Down
38 changes: 12 additions & 26 deletions .agents/skills/implement-issue/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: >
"implement issue #12345", "build the feature in issue 12345", "follow the implementation
brief for #12345") in the google/site-kit-wp repo.
argument-hint: "[issue-number]"
allowed-tools: Bash, Read, Grep, Glob, Edit, Write
allowed-tools: Read Grep Glob Edit Write Bash(gh issue view *) Bash(gh pr list *) Bash(git status *) Bash(git diff *) Bash(git log *) Bash(git blame *) Bash(git grep *) Bash(git switch -c *) Bash(git checkout -b *) Bash(npm run lint:js:files *) Bash(npm run typecheck-staged *) Bash(npx stylelint *) Bash(npm run build:dev *) Bash(npm -w tests/js run test:js *) Bash(npm run storybook *) Bash(npm run test:visualtest *) Bash(npm run test:visualapprove *) Bash(composer lint *) Bash(composer lint-fix *) Bash(composer analyze *) Bash(composer test *)
Comment thread
shervElmi marked this conversation as resolved.
Resolved
---

# Implement a GitHub issue
Expand All @@ -21,8 +21,7 @@ convention docs relevant to the issue (see the map in Step 3).

## Step 1 — Fetch and parse the issue

Fetch the issue from `google/site-kit-wp` (e.g. `gh issue view <number> --json title,body,labels`,
or the GitHub MCP issue tools).
Fetch the issue from `google/site-kit-wp` (e.g. `gh issue view <number> --repo google/site-kit-wp --json title,body,labels`, or the GitHub MCP issue tools).

Site Kit issues follow `.github/ISSUE_TEMPLATE/feature_request.md`. Extract these sections
verbatim:
Expand Down Expand Up @@ -56,11 +55,7 @@ builds on, `(see #13005)` for the extension point it leaves open, "the create va
#13022" for the half that isn't yours. Those references carry requirements that the issue
in front of you does not repeat.

Collect every issue referenced anywhere in the Feature Description, Acceptance criteria,
Implementation Brief and Test Coverage — `#12345`, a full `github.com/google/site-kit-wp/issues/…`
URL, the parent epic, and anything GitHub lists as linked — and read each one with
`gh issue view <number> --json title,body,state,url` **before** you start implementing. From
each, take:
Collect every issue mentioned anywhere in the Feature Description, Acceptance criteria, Implementation Brief and Test Coverage. That covers `#12345`, a full `github.com/google/site-kit-wp/issues/…` URL, the parent epic, and anything GitHub lists as linked. Read each one with `gh issue view <number> --repo google/site-kit-wp --json title,body,state,url` **before** you start implementing. From each, take:

- **What it delivered**, when it is closed — the classes, selectors, hooks and constants your
brief expects to already be there. Confirm they exist in the branch you are on; a closed
Expand Down Expand Up @@ -142,6 +137,7 @@ Follow the conventions you loaded in Step 3. In addition:
(see `docs/context/js/feature-flags.md`).
- Cover every Implementation Brief checkbox and Acceptance criterion. Implement the
**Test Coverage** items as real tests.
- **Code whose reason you can't see.** Before you change or delete existing code whose reason the code doesn't show, read its `git blame` and the pull request that added it. `gh pr list --repo google/site-kit-wp --search <commit> --state merged` finds that pull request.

## Step 5 — Self-review

Expand All @@ -154,29 +150,19 @@ written and passing.

Run, and fix anything that fails:

- **Fix the code, not the check**: add no `eslint-disable`, `phpcs:ignore` or `@phpstan-ignore`, no PHPStan baseline entry and no moved threshold, and make no test easier to pass. Where one such move is right, say why in your summary (Step 7).
- **Lint** — prefer scoping to the files you touched over the whole codebase:
- JS: `npm run lint:js:files -- <path/to/file.js>` (auto-fix the full codebase with
`npm run lint:js-fix`, or just your files with
`npm run lint:js:files -- --fix <path/to/file.js>`).
- PHP: `composer lint -- <path/to/File.php>` (auto-fix with `composer lint-fix`).
- JS: `npm run lint:js:files -- <path/to/file.js>` (auto-fix with `npm run lint:js:files -- --fix <path/to/file.js>`).
- PHP: `composer lint -- <path/to/File.php>` (auto-fix with `composer lint-fix -- <path/to/File.php>`).
- **Type check**: `npm run typecheck-staged -- <path/to/file.ts>`, over each `.ts` and `.tsx` file you touched.
- **Style lint**: `npx stylelint <path/to/file.scss>`, over each `.scss` file you touched.
- **PHPStan**: `composer analyze -- <path/to/File.php>`, over each PHP file you touched under `includes/`.
- **Build** — `npm run build:dev` when JS/asset changes are non-trivial.
- **Tests** — run the **specific** test files you touched, not the whole suite:
- JS: `npm -w tests/js run test:js -- <path/to/file.test.js>`
- PHP: `composer test -- --filter <TestClassName>`
- **Visual check (any change that affects rendering)** — for SCSS, layout, spacing,
alignment, or responsive rules, **render the change and look at it** before declaring it
done. Lint and build passing do **not** prove visual correctness, and a change that looks
like a trivial value tweak in the brief can still be visually wrong. Prefer the Storybook
story at the affected viewport(s); if no dev server is running, build a throwaway HTML
reproduction using the **real computed values** (typography from
`assets/sass/components/global/_googlesitekit-typography.scss`, breakpoints/sizes from
`assets/sass/config/`) and open it in the browser. For responsive / `@media` changes,
check **both sides** of every breakpoint you touch (the breakpoint variables, such as
`$bp-tablet`, are defined in `assets/sass/config/_variables.scss`). A mobile-only rule is
invisible at desktop width, so look at the change at a width on each side. Confirm that
the VRT viewports in `tests/vrt/README.md` cover both sides too. Re-check the exact state
described in the issue (e.g. the badge *next to the title*, not just the component in
isolation).
- Callers: add the tests of each file that imports a file you changed. A data store's callers reach it through the registry rather than by an import, so find them by name for each selector, resolver, action and control you touched, with `git grep -l -w -e '<name>' -- assets packages storybook tests/js`.
- **Visual check (any change that affects rendering)**: for SCSS, layout, spacing, alignment, or responsive rules, **render the change and look at it** before declaring it done. Lint and build passing do **not** prove that the change renders correctly. A change that looks like a trivial value tweak in the brief can still be visually wrong. Look at the Storybook story at the affected viewport(s). If no Storybook is running, start it with `npm run storybook`, and add a story where none shows the state. A hand-made HTML copy of the styles shows the copy, not the code that ships. For responsive / `@media` changes, check **both sides** of every breakpoint you touch (the breakpoint variables, such as `$bp-tablet`, are defined in `assets/sass/config/_variables.scss`). A mobile-only rule is invisible at desktop width, so look at the change at a width on each side. Confirm that the VRT viewports in `tests/vrt/README.md` cover both sides too. Re-check the exact state described in the issue (e.g. the badge *next to the title*, not just the component in isolation).
- **VRT** — if you added/changed a Storybook story, check just that story rather than
the full suite: `npm run test:visualtest -- --grep "<story label>"`, and
`npm run test:visualapprove -- --grep "<story label>"` to write the new reference
Expand Down
36 changes: 15 additions & 21 deletions .agents/skills/review-pr/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: >
request by number (e.g. "review PR #12345", "review pull request 12345", "/review-pr 12345")
in the google/site-kit-wp repo.
argument-hint: "[pr-number]"
allowed-tools: Bash, Read, Grep, Glob
allowed-tools: Read Grep Glob Bash(gh pr view *) Bash(gh pr diff *) Bash(gh pr checks *) Bash(gh issue view *) Bash(git fetch *) Bash(git show *) Bash(git grep *)
---

# Review a pull request
Expand All @@ -24,8 +24,8 @@ those, and don't duplicate them here.

Run these in parallel (substitute `<number>`):

- `gh pr view <number> --json number,title,body,author,baseRefName,headRefName,files,additions,deletions,commits`
- `gh pr diff <number>`
- `gh pr view <number> --repo google/site-kit-wp --json number,title,body,author,baseRefName,headRefName,headRefOid,files,additions,deletions,commits`
- `gh pr diff <number> --repo google/site-kit-wp`

**Stop and ask the user** if the PR can't be found or the diff is empty.

Expand All @@ -41,12 +41,7 @@ Addresses issue:
- #<number>
```

Extract that issue number from the PR body (the first `#<number>` under "Addresses issue:";
there may be more than one). Then fetch and parse the issue — `gh issue view <number> --json title,body,labels`
— following the section map in `.agents/skills/implement-issue/SKILL.md` Step 1: **Feature Description**,
**Acceptance criteria**, **Implementation Brief**, **Test Coverage**, **QA Brief**. This is
the spec the PR must satisfy; the review is fundamentally a check of the diff **against the
issue**, not just against conventions.
Extract that issue number from the PR body: the first `#<number>` under "Addresses issue:". There may be more than one. Then fetch the issue with `gh issue view <number> --repo google/site-kit-wp --json title,body,labels`. Parse it following the section map in `.agents/skills/implement-issue/SKILL.md` Step 1: **Feature Description**, **Acceptance criteria**, **Implementation Brief**, **Test Coverage**, **QA Brief**. This is the spec the PR must satisfy. The review is fundamentally a check of the diff **against the issue**, not just against conventions.

If the PR body has **no** linked issue (the `- #` line is empty), say so in the review, treat
requirements adherence as "not verifiable", and review conventions and code quality only. Do
Expand All @@ -62,27 +57,27 @@ The convention checklist in `review-checklist.md` (§2) maps each area to its au

## Step 4 — Inspect the changed files

For any non-trivial changed file (not auto-generated, not lock files), read the full file for
context around the changed lines. Focus on files where the diff alone is insufficient to judge
correctness.
For any non-trivial changed file (not auto-generated, not lock files), read the full file for context around the changed lines, as the PR has it. Your checkout holds your own branch, so fetch the PR with `git fetch origin pull/<number>/head`, and read each file with `git show <headRefOid>:<path>`. Focus on files where the diff alone is insufficient to judge whether the code is correct.

Read the code that calls each changed function too, and search for what still uses each thing the diff removes or renames, with `git grep -n -w -e '<name>' <headRefOid>`.

## Step 5 — Judge against the checklist

Grade the change against `review-checklist.md`:

- **Requirements adherence** (§1) — the primary check. Walk each **Acceptance criterion** and
each **Implementation Brief** checkbox from the linked issue (Step 2) and confirm the diff
actually implements it; call out anything missing, incomplete, or contradicting the brief.
Confirm every **Test Coverage** item exists as a real test. Skip only if no issue is linked.
- **Requirements adherence** (§1): the primary check. Walk each **Acceptance criterion** and each **Implementation Brief** checkbox from the linked issue (Step 2), and confirm the diff implements it. Call out anything missing or not fully done. Confirm every **Test Coverage** item exists as a real test, find the test behind each criterion, and call out a test that expects the opposite of one. Call out each change that no criterion or checkbox covers, as work the issue did not ask for. Skip only if no issue is linked.
- **A checkbox built another way, or left out.** The acceptance criteria are the contract, and the brief is one route to them (`.agents/skills/implement-issue/SKILL.md` Step 1). Such a difference is a finding where it breaks a criterion, removes something the code relies on, or adds a risk. Any other difference is no finding where the PR's "Relevant technical choices" gives its reason. Where none gives one, ask the author for it.
- **Convention adherence** (§2) — check only the areas the change actually touches; cite the
context file + section for every deviation.
- **Code quality** (§3) — correctness, security, performance, documentation, accessibility.
- **Verification** (§4) — lint, tests run, build for non-trivial asset changes.
- **Verification** (§4): lint, tests run, build for non-trivial asset changes. Read the results from the PR's own checks, with `gh pr checks <number> --repo google/site-kit-wp`, because CI ran them on the code under review. Where CI did not run a check on the PR's last commit, say so in the review.

## Step 6 — Produce the review

Structure the output as below. Omit any section with nothing to report.

Report a finding only on one of three grounds. The code gives a wrong result, or the change misses a stated need such as an acceptance criterion, or it breaks a written team rule. Leave out a matter of taste. Report a fault the change did not bring in as pre-existing, apart from the blocking issues. Give a fault that repeats as one finding that names every place it shows.

---

### PR #<number> — [title]
Expand Down Expand Up @@ -114,7 +109,7 @@ For each principle area that applies to files in this PR, report:
---

#### Code Quality Issues
Bugs, logic errors, edge cases, or correctness problems not covered above. Include `file:line`.
Bugs, logic errors, edge cases, or any other wrong result the code gives, not covered above. Give each the input or the state that leads to the wrong result, and the `file:line` in the source that shows it. Leave out a finding that rests on a name alone, or on an input no caller sends.

#### Security Concerns
XSS, capability checks, nonce verification, direct SQL, or data-sanitization issues.
Expand All @@ -126,7 +121,7 @@ Unnecessary re-renders, missing memoization, expensive selectors, N+1 queries, l
Changed logic lacking test coverage, or existing tests not updated for new behavior.

#### Minor / Nits
Optional: style, naming, or documentation improvements that don't affect correctness.
Optional: style, naming, or documentation improvements that don't affect whether the code is correct. Give at most five, and the rest as a count.

---

Expand All @@ -142,6 +137,5 @@ Brief justification. If requesting changes, list the blocking issues as a number

- **Read-only by default.** Produce the review; do **not** post comments, approve, or change
the PR state on GitHub unless the user explicitly asks.
- **Cite, don't assert.** For every convention violation, name the principle, the context file
+ section that defines it, and the affected `file:line`.
- **Cite, don't assert.** For every convention violation, name the principle, the context file + section that defines it, and the affected `file:line`. For every finding about what the code does, give the input that leads to the wrong result and the `file:line` that shows it.
- **Scope the read.** Load only the convention docs the change touches — not everything.
Loading
Loading