CtrlK
BlogDocsLog inGet started
Tessl Logo

jbaruch/coding-policy

General-purpose coding policy for Baruch's AI agents

73

Quality

91%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide

SecuritybySnyk

Low

Low-risk findings worth noting

Overview
Quality
Evals
Security
Files

SKILL.mdskills/adopt-fork-pr/

name:
adopt-fork-pr
description:
Use when the user asks to check, review, look at, or act on a pull request by number — "check PR 5", "review PR 12", "what's going on with PR 7", "look at this PR". Classifies the PR as same-repo or fork. Fork PRs are skipped by the policy reviewer's fork-guard; this skill offers to adopt the fork branch into the base repo as a same-repo PR the reviewer can run on, preserving the contributor's commits. Same-repo PRs pass straight through to the existing reviewer.

Adopt Fork PR Skill

Process steps in order. Do not skip ahead.

Classify a referenced pull request and, when it comes from a fork, adopt its branch into the base repo as a same-repo PR the policy reviewer can run on.

Step 1 — Classify the PR

Resolve origin's repository first; every gh pr call in this skill names it, never gh's own default (gh repo set-default).

CP=.tessl/plugins/jbaruch/coding-policy; [ -d "$CP" ] || CP="$HOME/$CP"; [ -d "$CP" ] || case "$(git config --get remote.origin.url)" in git@github.com:jbaruch/coding-policy|git@github.com:jbaruch/coding-policy.git|https://github.com/jbaruch/coding-policy|https://github.com/jbaruch/coding-policy.git|ssh://git@github.com/jbaruch/coding-policy|ssh://git@github.com/jbaruch/coding-policy.git) CP=. ;; *) echo "coding-policy plugin not found: run tessl install jbaruch/coding-policy" >&2; exit 1 ;; esac
python3 "$CP/skills/release/origin-repo.py" .

Contract: see skills/release/origin-repo.py — top-of-file docstring. Emits { "repo", "owner", "name" }. A non-zero exit means origin is not a GitHub repository this skill can act on: report its stderr diagnostic and finish here.

Run gh pr view <N> --repo <repo> --json number,isCrossRepository,headRefName,headRepositoryOwner,headRepository,author,title,url,state, with <repo> from that output.

  • isCrossRepository: false — same-repo PR. Proceed to Step 2.
  • isCrossRepository: true — fork PR. Proceed to Step 3.

Step 2 — Same-Repo Passthrough

The policy reviewer already covers same-repo PRs. Report the PR's review and check status from gh pr view <N> --repo <repo> --json reviewDecision,statusCheckRollup and finish here. Do not create branches, push, or open duplicate PRs.

Step 3 — Surface the Fork

Tell the user PR #N comes from fork <headRepositoryOwner.login>/<headRepository.name> and that the policy reviewer's fork-guard skips it. Proceed immediately to Step 4.

Step 4 — Confirm Adoption

Ask with AskUserQuestion:

  • Adopt for review — push the contributor's branch into the base repo as a reviewable same-repo PR.
  • Just inspect — read-only; no adoption.

On Just inspect, report the diff and status, passing --repo <repo> to every gh pr call, then finish here. On Adopt for review, proceed to Step 5.

Step 5 — Adopt the Branch

The block resolves CP to the project-local plugin, falling back to $HOME/.tessl/plugins/jbaruch/coding-policy, then to . in a coding-policy clone, and stops with an install instruction anywhere else.

CP=.tessl/plugins/jbaruch/coding-policy; [ -d "$CP" ] || CP="$HOME/$CP"; [ -d "$CP" ] || case "$(git config --get remote.origin.url)" in git@github.com:jbaruch/coding-policy|git@github.com:jbaruch/coding-policy.git|https://github.com/jbaruch/coding-policy|https://github.com/jbaruch/coding-policy.git|ssh://git@github.com/jbaruch/coding-policy|ssh://git@github.com/jbaruch/coding-policy.git) CP=. ;; *) echo "coding-policy plugin not found: run tessl install jbaruch/coding-policy" >&2; exit 1 ;; esac
bash "$CP/skills/adopt-fork-pr/adopt.sh" <N>

Contract: see skills/adopt-fork-pr/adopt.sh — top-of-file docstring carries the branch-naming rule, the verbatim new-PR-body and original-PR-comment templates, the idempotency states, and the exit codes. It checks out the fork head, pushes it to a base-repo branch preserving the original commits, opens a same-repo PR, and comments on the original fork PR linking the adopted one. Emits { "state", "adopted_branch", "new_pr_url", "original_pr", "author" }.

Report the adopted PR URL. The original fork PR is left open with a pointer comment — the contributor closes it on their own. From here it is an ordinary same-repo PR: the policy reviewer runs and you merge through your normal flow. Finish here.

skills

README.md

tile.json