home / skills / openai / openai-agents-js / pr-draft-summary

pr-draft-summary skill

/.codex/skills/pr-draft-summary

This skill generates a concise PR title and draft description after substantive code changes, speeding up PR readiness and consistency.

npx playbooks add skill openai/openai-agents-js --skill pr-draft-summary

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
4.8 KB
---
name: pr-draft-summary
description: Create a PR title and draft description after substantive code changes are finished. Trigger when wrapping up a moderate-or-larger change (runtime code, tests, build config, docs with behavior impact) and you need the PR-ready summary block with change summary plus PR draft text.
---

# PR Draft Summary

## Purpose

Produce the PR-ready summary required in this repository after substantive code work is complete: a concise change summary plus a PR-ready title and draft description for openai-agents-js.

## When to Trigger

- The task for this repo is finished (or ready for review) and it touched runtime code, tests, examples, docs with behavior impact, or build/test configuration.
- You are about to send the "work complete" response and need the PR block included.
- Skip only for trivial or conversation-only tasks where no PR-style summary is expected.

## Inputs to Collect Automatically (do not ask the user)

- Current branch: `git rev-parse --abbrev-ref HEAD`.
- Working tree: `git status -sb`.
- Untracked files: `git ls-files --others --exclude-standard` (use with `git status -sb`; `--stat` omits them).
- Changed files: `git diff --name-only` (unstaged) and `git diff --name-only --cached` (staged); sizes via `git diff --stat` and `git diff --stat --cached`.
- Base reference (use the branch's upstream, fallback to `origin/main`):
  - `BASE_REF=$(git rev-parse --abbrev-ref --symbolic-full-name @{upstream} 2>/dev/null || echo origin/main)`.
  - `BASE_COMMIT=$(git merge-base --fork-point "$BASE_REF" HEAD || git merge-base "$BASE_REF" HEAD || echo "$BASE_REF")`.
- Commits ahead of the base fork point: `git log --oneline --no-merges ${BASE_COMMIT}..HEAD`.
- Category signals for this repo: runtime (`packages/`, `examples/`, `helpers/`, `scripts/`), tests (`packages/**/test`, `integration-tests/`), docs (`docs/`, `README.md`, `AGENTS.md`, `.github/`), build/test config (`package.json`, `pnpm-lock.yaml`, `pnpm-workspace.yaml`, `tsconfig*.json`, `tsc-multi.json`, `eslint.config.*`, `vitest*.ts`).

## Workflow

1. Run the commands above without asking the user; compute `BASE_REF`/`BASE_COMMIT` first so later commands reuse them.
2. If there are no staged/unstaged/untracked changes and no commits ahead of `${BASE_COMMIT}`, reply briefly that no code changes were detected and skip emitting the PR block.
3. Infer change type from the touched paths listed under "Category signals"; classify as feature, fix, refactor, or docs-with-impact, and flag backward-compatibility risk when runtime code changed.
4. Summarize changes in 1–3 short sentences using the key paths (top 5) and `git diff --stat` output; explicitly call out untracked files from `git status -sb`/`git ls-files --others --exclude-standard` because `--stat` does not include them. If the working tree is clean but there are commits ahead of `${BASE_COMMIT}`, summarize using those commit messages.
5. Choose the lead verb for the description: feature → `adds`, bug fix → `fixes`, refactor/perf → `improves` or `updates`, docs-only → `updates`.
6. Suggest a branch name. If already off `main`, keep it; otherwise propose `feat/<slug>`, `fix/<slug>`, or `docs/<slug>` based on the primary area (for example `docs/pr-draft-summary-guidance`).
7. If the current branch matches `issue-<number>` (digits only), keep that branch suggestion. When an issue number is present, reference `https://github.com/openai/openai-agents-js/issues/<number>` and include an auto-closing line such as `This pull request resolves #<number>.` Do not block if the issue cannot be fetched.
8. Draft the PR title and description using the template below.
9. Output only the block in "Output Format". Keep any surrounding status note minimal and in English.

## Output Format

When closing out a task and the summary block is desired, add this concise Markdown block (English only) after any brief status note. If the user says they do not want it, skip this section.

```
# Pull Request Draft

## Branch name suggestion

git checkout -b <kebab-case suggestion, e.g., feat/pr-draft-summary-skill>

## Title

<single-line imperative title, which can be a commit message; if a common prefix like chore: or feat: etc., having them is preferred>

## Description

<include what you changed plus a draft pull request title and description for your local changes; start the description with prose such as "This pull request resolves/updates/adds ..." using a verb that matches the change (you can use bullets later), explain the change background (for bugs, clearly describe the bug, symptoms, or repro; for features, what is needed and why), any behavior changes or considerations to be aware of, and you do not need to mention any tests you ran.>
```

Keep it tight—no redundant prose around the block, and avoid repeating details between `Changes` and the description. Tests do not need to be listed unless specifically requested.

Overview

This skill produces a ready-to-paste PR title and draft description when substantive code work is complete. It collects repository state, infers the change type and impact, and emits a concise PR block that matches this repo's conventions. Use it when finishing moderate-or-larger changes touching runtime, tests, build config, or docs with behavioral impact.

How this skill works

The skill inspects the git branch, working tree, staged/unstaged/untracked files, and commits ahead of the base fork point to determine what changed. It classifies the change (feature, fix, refactor, or docs-with-impact), assesses backward-compatibility risk for runtime edits, summarizes top file paths and diff stats, suggests a branch name, and drafts a PR title and description using the repository's template. If no relevant changes are detected it reports that and skips the PR block.

When to use it

  • You finished a change that touched runtime code, tests, examples, or build/test configuration.
  • You updated docs that may affect behavior or developer experience.
  • You have staged or committed work and are about to mark the task ready for review.
  • You want a concise, repo-compliant PR title and description without composing it manually.

Best practices

  • Run the skill after committing or staging all intended work so summaries reflect final state.
  • Keep commits focused; the skill uses commit messages when the working tree is clean but commits are ahead of base.
  • Prefer short, descriptive top-level file paths — the summary highlights the top five touched paths.
  • If changes touch runtime code, add a short compatibility note in the description — the skill flags risk but you should review details.
  • If you want a specific branch name, create it first; otherwise accept the suggested kebab-case branch based on the change.

Example use cases

  • Finishing a new feature that adds a runtime package and example — generate a 'feat/...' branch name and feature PR text.
  • Wrapping up a bug fix that updates tests and a package file — produce a 'fix/...' title and description that explains the bug and fix.
  • Refactoring core helper modules across multiple packages — produce an 'improves' style description and highlight potential compatibility notes.
  • Updating documentation that changes agent behavior examples — produce a docs-with-impact PR draft that calls out behavior changes.

FAQ

What if no changes are detected?

The skill will reply that no code changes were found and will not emit a PR block.

Can I override the suggested branch name or title?

Yes. The suggestions are just guidance; apply your preferred branch or title before creating the PR.