con un clic
prepare-pr
// Prepare a pull request description for the current branch following the WikiEduDashboard PR template. Use this skill when asked to prepare a PR, draft a PR description, or get a branch ready to open as a pull request.
// Prepare a pull request description for the current branch following the WikiEduDashboard PR template. Use this skill when asked to prepare a PR, draft a PR description, or get a branch ready to open as a pull request.
| name | prepare-pr |
| description | Prepare a pull request description for the current branch following the WikiEduDashboard PR template. Use this skill when asked to prepare a PR, draft a PR description, or get a branch ready to open as a pull request. |
Draft a complete pull request description for the current branch, following the project's
PULL_REQUEST_TEMPLATE.md and docs/ai_guidelines.md.
Run bin/pr-screenshots --clean to remove any leftover screenshots and draft
from a prior run before starting fresh.
Gather the raw material:
git log master..HEAD --oneline — list all commitsgit log master..HEAD --format="%H %ai %s" — commits with timestamps (for estimating elapsed time and effort)git log master..HEAD — full commit messages (for design decisions and process notes)git diff master...HEAD --stat — which files changed and how muchPULL_REQUEST_TEMPLATE.md — know the exact sections requiredFrom the timestamps, estimate:
There are two strategies, and picking the right one for the PR matters a lot more than picking the right script invocation.
For any PR that introduces substantial new UI, write a dedicated feature spec whose only job is to drive the feature through its interesting states and save named PNGs. This gives you complete control over what's shown, lets you seed realistic-looking fixture data, and produces screenshots with stable, descriptive filenames.
Put it next to the regular specs:
spec/features/<feature>_screenshots_spec.rb
A minimal template:
require 'rails_helper'
# `if: ENV['SCREENSHOT']` keeps this spec out of the default suite — it
# only defines itself when bin/pr-screenshots sets the env var.
describe '<Feature> screenshots', type: :feature, js: true,
if: ENV['SCREENSHOT'] do
let(:admin) { create(:admin) }
let(:screenshot_dir) { Rails.root.join('tmp', 'screenshots', ENV['SCREENSHOT']) }
before do
FileUtils.mkdir_p(screenshot_dir)
page.current_window.resize_to(1440, 1000)
login_as(admin)
end
def shoot(name)
sleep 0.2 # let transitions settle
page.save_screenshot(screenshot_dir.join("#{name}.png"))
end
it 'captures the full UI' do
# seed whatever looks realistic
visit '/the/feature'
shoot('01_landing')
click_button 'Open editor'
shoot('02_editor_default')
# keep going through every state worth showing
end
end
Key conventions:
if: ENV['SCREENSHOT'] so the describe block only exists
when bin/pr-screenshots invokes rspec (it sets SCREENSHOT=before or
SCREENSHOT=after). The main suite runs zero examples from the file.
No global RSpec config change needed.tmp/screenshots/$SCREENSHOT/ so bin/pr-screenshots can
pair up before/after PNGs by filename on a later run.01_, 02_, …) so they appear
in the intended order in the PR description.foo/bar. Reviewers
read screenshots.Then run:
bin/pr-screenshots spec/features/<feature>_screenshots_spec.rb
For a brand-new feature, the spec doesn't exist on master so the before
column will render as _(did not exist on master)_ automatically. That's
the right outcome — there is no "before" state for something that didn't
exist. For iterations on an existing UI, commit the spec on master first
(or a preceding PR) so the before pass has something to run.
If you're making a small tweak and an existing feature spec already ends up
in a good-looking state at one of its assertion points, you can skip writing
a dedicated spec and let bin/pr-screenshots auto-detect:
bin/pr-screenshots # no arguments
It picks feature specs from files changed in git diff master...HEAD,
captures their terminal UI state on both branches, and prints a before/after
markdown snippet.
This works best when:
It works poorly when:
expect, which is often a narrow slice of the featurebin/pr-screenshots (strips (, ),
→, and collapses -- sequences) so they survive as markdown alt text.tmp/
(e.g. screenshots/after/01_landing.png) to match where
tmp/pr_description.md lives.Write the full PR description to tmp/pr_description.md (create or overwrite).
Fill in every section of the template:
#1234), link them: Addresses #1234Inspect the commit messages for signs of AI involvement:
Write an honest, specific statement. This project requires transparency. If Claude Code wrote most of the code under human direction, say so clearly. Name the tool (Claude Code), describe what it did (drafted code, wrote commit messages, iterated on design), and note what the human contributed (direction, review, decisions about what to build).
Note that the "What this PR does" summary and other analysis in the description were also drafted by Claude Code and may contain errors.
Include a brief note on the scale of effort: how many commits, over what time span, and roughly what that implies about how much human time was involved. For example: "This was developed across 8 commits over 3 days" or "All commits were made within a single 20-minute session." This helps reviewers calibrate how much iteration and review went into the work.
Always end the AI usage section with a sentence noting that this PR description was drafted
using a Claude Code skill (/prepare-pr).
Paste the markdown snippet from bin/pr-screenshots output directly into this section.
The script outputs before/after tables; use that output as-is.
If screenshots could not be captured (e.g. spec infrastructure issue), describe what the user should capture manually and which URLs to visit.
Run code tmp/pr_description.md to open the file in VS Code and tell the user to press
Ctrl+Shift+V to preview it with screenshots rendered locally.
When ready to publish, run bin/open-pr once. It will:
screenshots/… reference in tmp/pr_description.md.refs/heads/pr-screenshots/<current-branch> on origin.raw.githubusercontent.com URL on that orphan branch.The result: a draft PR with screenshots rendered inline, in a single pass, with no manual drag-and-drop.
Authentication is tried in this order:
GITHUB_TOKEN env vargh auth token output, if the GitHub CLI is installed and logged inIf neither is available, the script prints instructions for generating a
classic PAT with repo scope.
Walk through a structured PR review workflow. Use this skill when reviewing a pull request, triaging PRs, or starting a code review.
Characterize a slow / stuck course-update worker on dashboard.wikiedu.org or outreachdashboard.wmflabs.org. Use this skill when asked to investigate why a course update is taking unusually long, hung, or running for many hours, or to estimate the scale-of-work of an in-flight update. Pure HTTP recon against public APIs — never SSH into prod.
Stage and commit changes with a well-formed commit message following the WikiEduDashboard format. Use this skill when asked to commit, make a commit, or create a commit.
Write browser-based Capybara feature specs for WikiEduDashboard controllers and views. Use this skill when asked to improve test coverage, write feature specs, add browser tests, or cover a controller with specs.