Skip to content

Audit github-agile skills and extract all remaining mechanical sequences into Python scripts #163

Description

@sebastientaggart

Problem to Fix

PR #162 (the sync-base-branch.py tracer bullet from #159) validated a hypothesis: handing mechanical shell sequences off to small Python scripts is meaningfully better than narrating them in skill markdown. Concretely, it collapsed five permission prompts into zero (one python3 allow rule covers everything), made the operation atomic instead of agent-narrated step-by-step, and trimmed the skill prose.

That same pattern — inlined multi-step git, gh, or other tool plumbing that has no judgment calls and the same shape every invocation — repeats throughout the rest of the github-agile skills. Each unconverted instance keeps paying the cost the tracer bullet eliminated: permission prompts on compound shell, tokens spent re-narrating the steps, and surface area for the agent to drift (forgotten flag, missing temp file, wrong order).

Why it Matters

  • Permission UX. Every compound shell statement (A && B || { ...; exit 1; }, multi-step gh flows, conditional fallbacks) costs the user a permission prompt or two in Claude Code. A single python3 script.py … invocation costs zero. The cumulative annoyance across a typical /start → /submit-for-review → /deploy cycle is significant.
  • Reliability. Deterministic Python with explicit exit codes behaves identically every time. Agent-narrated sequences can — and do — drift across adapters and invocations.
  • Token spend. Each skill markdown re-loads the full shell narration every invocation. A script invocation is one tool call.
  • Maintenance leverage. Centralizing the mechanical bits in scripts means edge-case fixes happen once, not in N skill files in lockstep.

General Approach

Audit every skill in skills/github-agile/ and extract every sequence that is purely mechanical — no judgment calls, no agent-side decisions, the same shape every time — into named Python scripts under skills/github-agile/scripts/. Skills become thin orchestrators: they make the decisions (which case applies, what title to use, whether to ask the user) and delegate execution.

Candidate sequences known to fit, gathered from prior tickets and the existing skill content:

  • The --body-file plumbing pattern used for gh issue create, gh issue comment, and gh pr create (write to temp file, then invoke with --body-file <path>).
  • The follow-up-issue creation loop in /submit-for-review Step 9 (per-finding title trim, label resolution, gh issue create with the right flags omitted).
  • The label and milestone three-tier resolution from /start's Parsing section.
  • The make -n <target> "verify make target exists" guard used in /submit-for-review Step 2 and Step 8.
  • The git fetch origin <base> && git merge origin/<base> sync sequence in /submit-for-review Step 4 (sibling of the just-shipped sync-base-branch.py, but a merge rather than a hard-reset).
  • The CODEOWNERS detection + --reviewer handle stripping in /submit-for-review Step 6.
  • Resolution-comment posting in /submit-for-review's post-merge block, and investigation-comment posting in /start Case B Step 3.
  • Version-tag discovery and the bump-then-tag dance in /deploy.

The audit should also surface candidates this list doesn't anticipate. Each extraction is small and self-contained but touches multiple skill call-sites, so the work should be sliced one sequence per PR — same cadence as #159.

This ticket is the audit-and-execute parent; each extraction can either land directly under this ticket or get spun out as a child ticket if the surface area justifies it. Prefer landing small PRs against this ticket until the count gets unwieldy.

Out of scope:

  • Adding override mechanisms for the scripts (users can fork a skill if they need different behavior).
  • Cross-group script reuse (the rfp-tools group, when it exists, can have its own scripts/ directory; sharing is a follow-up if it's ever needed).
  • Bundling Make targets or shell scripts as alternatives to Python — the tracer bullet established python3 … as the convention.
  • Automated tests for the extracted scripts — deferred to Add exit-code tests for extracted github-agile scripts (deferred) #165 so the scripts can settle in production for a few weeks before their behaviour gets pinned.

Complexity

Verification / QA effort: significant

The work spans every skill in github-agile/ and must be re-validated end-to-end (/start/submit-for-review/deploy) per branching mode (trunk / two-branch / three-branch) after each extraction. Each individual extraction is small; the aggregate surface area is what makes this significant rather than moderate. Mitigation: one sequence per PR, gated on ./sync.py --validate plus a manual workflow run.

Acceptance Criteria

  • An audit pass over all skills in skills/github-agile/ (checkpoint.md, delegate.md, deploy.md, qa.md, review.md, review-agent.md, setup.md, start.md, status.md, submit-for-review.md) identifies every mechanical sequence that fits the extraction pattern. The audit is recorded in a comment on this ticket as a checklist.
  • Each identified sequence is extracted into a Python script under skills/github-agile/scripts/ and wired into its skill call-site(s). One sequence per PR, each landing under this ticket (or as a child ticket if the surface area justifies splitting).
  • python3 remains the single permission-rule beneficiary — no new shell prefixes added to permissions.yaml as part of the extractions.
  • After each extraction, ./sync.py --validate passes and the affected adapter outputs continue to render correctly.
  • Skill markdown shrinks meaningfully across the affected files; the lines that previously enumerated mechanical steps are replaced by one-line script invocations (with {{#if}} conditionals preserved when they pick which argument to pass).
  • This ticket closes when the audit checklist is fully ticked off (or when remaining items are explicitly re-classified as not-worth-extracting with a one-line rationale per item).

Metadata

Metadata

Labels

choreRoutine maintenanceready-for-qaIssue is ready to be QA tested

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions