AGENT SKILL

onboarding

worktrail-repo-init scaffolding — write-if-absent files, the agent-facing PR labels doc, and AGENTS.md pointer handling for src/worktrail/onboarding

License 许可
MIT
最近更新
2026-11-14
Stars
★ 0
Forks
0

01 前言 Front Matter

name
onboarding
triggers
{ "files": [ "src/worktrail/onboarding/**", "skills/worktrail-repo-init/**", "tests/onboarding/**" ], "keywords": [ "repo-init", "repo_init", "propose", "scaffold", "pull-requests.md", "go:risk" ] }
description
worktrail-repo-init scaffolding — write-if-absent files, the agent-facing PR labels doc, and AGENTS.md pointer handling for src/worktrail/onboarding

03 SKILL.md 正文

You are working on worktrail-repo-init, which bootstraps/migrates a repo onto the repo-standards doctrine (src/worktrail/onboarding/repo_init.py). propose scaffolds files; apply makes the GitHub API calls (e.g. creating the AUTOMERGE_LABELS).

Domain purpose

The scaffolded auto-merge workflow fails closed: a green PR with no go:risk-low / go:risk-medium label is never armed and sits unmerged with mergeStateStatus: CLEAN and no error. Nothing in an onboarded repo told agents this, so propose now also scaffolds an agent-facing doc and links it from AGENTS.md.

Business rules / invariants

  • Scaffolded files are write-if-absent. propose reports them under written / skipped; an existing (possibly hand-tailored) file is left byte-identical.
  • docs/engineering/pull-requests.md is rendered per branch model by build_pull_requests_doc(branches): the merge-method list comes from merge_method_for_branch (the same function the rulesets and auto-merge workflow use), and the promotion-PR rule (hold with go:no-automerge) appears only when the model has a branch outside SQUASH_ONLY_BRANCHES (dev/main).
  • The doc is repo-slug-free — REST commands use gh api repos/{owner}/{repo}/..., which gh expands from the checkout. Never embed an owner/repo.
  • Label names are not duplicated in code. The doc names the five labels literally; a test asserts every name in AUTOMERGE_LABELS appears in the rendered doc, so adding/renaming a label fails the build until the template is updated.
  • The doc is deliberately excluded from compute_drift — it is prose an operator may tailor.

Non-obvious behaviors

  • ensure_agents_md_pr_pointer(repo) inserts a "Pull requests" section into AGENTS.md before the first tool-managed block (<!-- name:start -->, matched by _TOOL_BLOCK_START_RE) so blocks like aspens' stay last; with no block it appends. It is a no-op when AGENTS.md already contains PULL_REQUESTS_DOC_RELPATH, and returns (changed, warning) — a missing AGENTS.md yields a warning, never a created file.
  • The pointer is added even when the doc file already existed (the two steps are independent in cmd_propose).
  • detect_state() reports pull_requests_doc_exists and agents_md_links_pull_requests_doc; propose --check reports them without writing.
  • build_pull_requests_doc lives in repo_init.py, not the template module, because it needs merge_method_for_branch and pull_requests_doc_template.py cannot import repo_init without a cycle.
  • Template modules (*_template.py) hold prose as string constants with __MARKER__ placeholders rather than packaged data files, to avoid package-data resolution at runtime.
  • The doc's guidance says to set labels via the REST API (gh api .../issues/<n>/labels) because gh pr edit --add-label fails on this account.

Critical files (purpose, not inventory)

  • src/worktrail/onboarding/repo_init.py — CLI: detect_state, cmd_propose, ruleset/workflow builders, label creation
  • src/worktrail/onboarding/pull_requests_doc_template.py — doc prose, PROMOTION_SECTION, AGENTS_MD_PR_SECTION
  • skills/worktrail-repo-init/SKILL.md — the user-facing procedure; keep in step with what propose writes
  • tests/onboarding/test_repo_init.py — PullRequestsDocTests covers rendering, pointer placement, re-run idempotence, and drift exclusion

Critical Rules

  • Never overwrite an existing scaffolded file or add it to drift reporting without a deliberate decision.
  • Keep AGENTS.md tool-managed blocks last; never interleave the PR section into one.

Last Updated: 2026-09-20

04 同仓库更多 Skills

behindthedash
behindthedash/worktrail

worktrail-sdd-workflow

Internal SDD workflow executor invoked by /go only. Do not call directly. Executes classified routes A–J: feature planning, implementation (parallel orchestration, PR generation), defect repair, refactoring, spec changes, investigation, and workflow evolution.

★ 0
behindthedash
behindthedash/worktrail

worktrail-routing-config

Configure Worktrail's agent routing table (`~/.worktrail/routing.yaml`, or a repo-local `routing:` policy block) — which harness/model executes each role and tier, and how fallback between them works. Use when the operator wants to add or remove a harness/adapter (claude/codex/opencode), add a model to an existing harness (e.g. adding a DeepSeek model to opencode), pin or change who does code review, add a new tier or purpose mapping, change the default tier, or is confused about which harness actually served a spawn (e.g. "why did this use Codex when I only configured Claude"). Trigger phrases: "routing.yaml", "add a harness", "disable a harness", "add an adapter", "remove an adapter", "add a model", "add deepseek to opencode", "change the reviewer", "pin the reviewer", "routing tiers", "routing targets", "default_tier", "independent reviewer", "why did codex get called". This skill is about *editing the config file*; it does not cover `/go`'s own dispatch mechanics (see `worktrail-go`'s SKILL.md Phase 7 for how `tier_for()`/`select_cell()` resolve it at runtime).

★ 0
behindthedash
behindthedash/worktrail

worktrail-repo-init

Bootstrap a new repo, or migrate an existing single-branch repo, onto the workspace's repo-standards doctrine (~/rules/CLAUDE.repo.md): the AGENTS.md-is-truth/CLAUDE.md-imports-it split, a dev/prd, dev/stg/prd, or main-only (trunk) branch model with matching GitHub rulesets, an OpenSpec scaffold, an auto-merge workflow, and a seeded .worktrail/policy.yaml. Trigger phrases: "onboard this repo", "apply repo standards", "initialize repo standards", "set up this repo like the rest of the fleet", "bring this repo into line with the repo standards doctrine".

★ 0
behindthedash
behindthedash/worktrail

worktrail-help

Show the Worktrail front-door commands and accepted positional arguments. Use when the user asks how to invoke worktrail-go, wants the available handoff, spec, pr, repo, or route forms, invokes worktrail-go with help or with a bare noun, or asks how to answer a filed product decision (worktrail-decision).

★ 0
behindthedash
behindthedash/worktrail

worktrail-handoff

Capture a discovered problem, gap, tech debt, or deferred work into a local work queue so a future agent session can pick it up cold. Use mid-session whenever you set work aside instead of doing it now — a fix you judge out of scope for this PR, work that belongs in a follow-up or a separate/later PR, an item you're deferring, or something worth fixing you won't tackle now — so the outstanding item isn't lost without derailing current work; can be called multiple times per session. Trigger phrases: "defer this", "item deferred", "out of scope for this PR", "follow-up work", "leave for another PR", "capture for later", "outstanding item". This skill captures only. Picking a brief back up is the front door's job: worktrail-go <brief-id>.

★ 0
behindthedash
behindthedash/worktrail

worktrail-go

Use when the user invokes worktrail-go, asks to pick up queued work, resume active specs, implement or fix a spec, route engineering work, or orient across repositories. Renders the orientation dashboard, classifies free-text requests, claims/resumes handoff briefs, and dispatches SDD work without requiring the user to know sdd-workflow. Grammar: worktrail-go [REPO] <noun> <verb>, nouns handoff / spec / pr / decision. Triggers: worktrail-go, worktrail-go help, worktrail-go spec fix, worktrail-go spec implement, worktrail-go spec route F, worktrail-go handoff new, worktrail-go handoff auto, worktrail-go decision answer, worktrail-go BRIEF-ID, bare worktrail-go, multi-repo orientation.

★ 0