{"slug": "review-md", "title": "review.md", "summary": "A developer published a read-only retrospective workflow that uses GitHub CLI read commands to mine a contributor's pull requests for recurring mistakes flagged by maintainers and reviewers, then converts those patterns into a report and a paste-ready rules block for coding agents. The method caches API responses locally, respects rate limits, and triages flagged PRs to drop bot noise and false positives before deep-reading diffs and review comments.", "body_md": "You are performing a READ-ONLY retrospective of a GitHub contributor's pull requests. The goal: find the recurring mistakes in their PRs — as shown by how specific maintainers and reviewers corrected them — and turn those patterns into (1) a concise report and (2) a paste-ready rules block for their coding agents, so the same mistakes stop recurring.\n\nDo not modify, comment on, push to, approve, react to, or open anything on GitHub. Only use `gh` read commands (`gh search`, `gh pr view`, `gh api` with GET). Write files only inside the current working directory.\n\nAsk all of them in one message, then wait for my answers before doing anything. If I skip a question or say \"defaults\", use its default.\n\n1. **GitHub handle to analyze** — no default, required: whose PRs are we reviewing?\n2. **Scope** — default: every repository the handle has PRs in. Otherwise an org wildcard (e.g.`--owner laravel` or`laravel/*` ) or an explicit repo list.\n3. **Mentors** — whose corrections drive the lessons. Default: infer them yourself from the repos' owners and the people who most often merge or commit to this contributor's PRs. When in doubt, treat ANY maintainer edit, review, or change request as signal.\n4. **Time window** — default: the last 12 months, computed from today.\n5. **Known concerns (optional)** — anything you already suspect and want checked, or \"none\".\n\n- Run `gh auth status` and`gh api rate_limit` . If auth is missing, stop and tell me.\n- Cache every API response under `./data/` as JSON so reruns never re-fetch.\n- Respect rate limits: if remaining calls < 100, sleep until the reset window.\n- From here on, print a short progress update with counts at the end of every step.\n\nFor each state (merged, closed-unmerged, open), search PRs authored by the handle within the scope and window — `gh search prs --author <handle> --limit 1000` with `--json number,title,url,state,createdAt,closedAt,repository`, plus any owner/repo filters. Merge everything into `./data/prs.json`, dedupe by repo+number. Print counts per repo and per state.\n\nFor every PR fetch only: `/pulls/{n}/commits` (who authored each commit), `/pulls/{n}/reviews`, `/pulls/{n}/comments` (inline), `/issues/{n}/comments` (conversation), and `/issues/{n}/timeline` (title/description edits and closes). Flag a PR as \"interesting\" if ANY of these is true:\n\n- a) a commit on the PR branch was authored or committed by a mentor (they fixed it themselves),\n- b) a mentor left an inline comment, review, or conversation comment asking for or suggesting a change,\n- c) any other human reviewer requested changes or suggested a specific change,\n- d) the PR was closed unmerged and a maintainer left a reason,\n- e) the PR title or description was edited by a maintainer.\n\nIgnore bots (dependabot, github-actions, styleci, renovate, preview/deploy bots, etc.) and pure \"thanks\"/\"LGTM\" comments. Save `./data/interesting.json` and print how many PRs qualified.\n\nSkim each flagged PR's signals and drop false positives BEFORE spending deep-read effort on them:\n\n- sync/dependency PRs whose branch merely carries pre-existing history,\n- praise, excitement, or roadmap chatter not addressed to the author,\n- bot noise of any kind,\n- closes with zero comments and no stated reason,\n- comments not directed at the author.\n\nRecord each drop with a one-line reason so the cut is auditable. Print how many flags survived triage.\n\nFor each surviving PR, read:\n\n- the author's original diff (the commits they authored),\n- every maintainer/reviewer commit's diff — what exactly they changed after the author,\n- the review and inline comments, with the file and line each was attached to.\n\nRecord per PR: repo, PR URL, title, state, what the maintainer changed or asked for (keep sharp verbatim quotes), a one-line root cause, a primary category, optional extra categories, severity (major = shipped breakage, real-user impact, or the PR was closed/redone; minor = a real fix was needed; trivial = pure polish), who fixed it, and the evidence you saw.\n\nUse these categories, adding new ones only if truly needed: scope creep / unrelated changes, naming, API design / public surface, backwards compatibility / breaking change, missing or weak tests, test style, docs / docblocks / comments, code style / formatting / lint, types / generics / PHPDoc / static analysis, over-engineering / unnecessary abstraction, wrong abstraction location, performance, edge cases, PR title/description quality, target branch / versioning, framework or project conventions, dependency / config choices, other.\n\n- Rank categories by unique PR count (dedupe — a PR must not be double-counted within one category), noting which repos each pattern shows up in.\n- For the top ~8 patterns: a one-sentence \"what I keep doing\", 2-3 example PR links, and the concrete rule that would have prevented each.\n- Separately note: strengths (large features merged with zero corrections, repos with no flags), the repos where the contributor struggles — by rate AND by raw volume, flagging small samples inline — and a trend across the window (quarterly flag rate). Treat partial quarters as partial, and do NOT misread a low rate on recent PRs as improvement: feedback hasn't had time to accumulate.\n- Be brutally honest and specific. No flattery, no padding. If a sample is small, say so in the same breath as the claim. Add a short method note covering: how many flags were excluded as false positives, that multi-category PRs exist, and any undercounting (e.g. squash merges hide maintainer fixes).\n\n1. `report.html` — a single self-contained page, no external assets or scripts, clean scannable typography. Sections: summary numbers, top patterns ranked, per-pattern detail with PR links, strengths, \"where I struggle\", trend, and the list of major-severity items.\n2. `agent-instructions.md` — a short paste-ready block for AGENTS.md / CLAUDE.md: imperative rules only, one line each, grouped by category, every rule backed by the data (cite the example PRs), ending with a \"Before opening a PR\" checklist of at most 10 items.\n3. Keep `./data/` as the raw cached JSON so the analysis can be rerun or audited.\n\n- Render the HTML report and inspect it at both desktop and phone widths; fix any overflow, broken markup, or illegible text before delivering.\n- Spot-check every quoted maintainer line and linked PR against the cached data.\n- In your final reply: headline numbers, the top patterns with example PR links, strengths, struggle repos, the trend verdict, and links to all three deliverables.\n\n- Read-only on GitHub, always. Never post, edit, push, approve, or react.\n- Show counts after each step; stop to ask only if something genuinely blocks you.\n- If a step finds far more PRs than expected, say so and keep going — never silently truncate.", "url": "https://wpnews.pro/news/review-md", "canonical_source": "https://gist.github.com/pushpak1300/310bdebf588e902390de656a9f82dea6", "published_at": "2026-10-19 08:17:23+00:00", "updated_at": "2026-10-22 07:11:00.234786+00:00", "lang": "en", "topics": ["ai-agents", "developer-tools", "ai-tools"], "entities": ["GitHub", "GitHub CLI"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/review-md", "markdown": "https://wpnews.pro/news/review-md.md", "text": "https://wpnews.pro/news/review-md.txt", "jsonld": "https://wpnews.pro/news/review-md.jsonld"}}