feat(skills): list available skills when install runs non-interactively by SamMorrowDrums · Pull Request #13548 · cli/cli · GitHub
Skip to content

feat(skills): list available skills when install runs non-interactively#13548

Merged
BagToad merged 1 commit into
trunkfrom
sammorrowdrums/skill-install-nontty-listing
Jun 17, 2026
Merged

feat(skills): list available skills when install runs non-interactively#13548
BagToad merged 1 commit into
trunkfrom
sammorrowdrums/skill-install-nontty-listing

Conversation

@SamMorrowDrums

Copy link
Copy Markdown
Contributor

Summary

Running gh skill install <repo> (or --from-local <dir>) without a skill name in a non-interactive context previously errored with must specify a skill name when not running interactively. That made discovery awkward when piping or scripting — users had to switch to an interactive shell just to see what skills a repo offered.

This PR changes that behavior so the discovered skills are printed instead, mirroring (approximately) what the interactive picker shows. The list is rendered through tableprinter, so it auto-switches between a friendly TTY table and tab-separated SKILL\tDESCRIPTION rows when piped — making it easy to grep / fzf / awk.

Before

$ gh skill install github/awesome-copilot | grep review
must specify a skill name when not running interactively

After

$ gh skill install github/awesome-copilot | grep review
code-review     Reviews pull requests

Re-running with a specific skill name installs as before. Same behavior for --from-local.

Context

Came out of a Slack thread where this was identified as a UX gap: interactive mode supports browsing-then-installing, and non-interactive mode should provide the same discoverability so it composes with standard Unix tooling.

Changes

  • selectSkillsWithSelector now prints discovered skills via a new listAvailableSkills helper instead of erroring when !canPrompt.
  • Sentinel errSkillsListed lets installRun / runLocalInstall bail cleanly without going into the install path.
  • Descriptions are pre-fetched (same fetchDescriptions callback the picker uses) so the listed output is useful, not bare.
  • Help text + an example for piping into grep updated.
  • Tests: replaced the old "errors" case with a remote listing assertion and added an equivalent local install case.

Verification

  • go test ./pkg/cmd/skills/...
  • make lint

Copilot AI review requested due to automatic review settings May 29, 2026 16:28
@SamMorrowDrums SamMorrowDrums requested review from a team as code owners May 29, 2026 16:28
@SamMorrowDrums SamMorrowDrums requested a review from BagToad May 29, 2026 16:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Changes gh skill install <repo> behavior so that running it non-interactively without a skill name now lists the discovered skills (via tableprinter, falling back to tab-separated output when piped) instead of erroring out. This improves discoverability and composes with Unix tools.

Changes:

  • Replace the non-interactive "must specify a skill name" error with a new listAvailableSkills helper that prints skills using tableprinter; a sentinel errSkillsListed lets installRun/runLocalInstall exit cleanly.
  • Update long help text and add a piping example to reflect the new behavior.
  • Replace the old "errors" test with a remote listing assertion and add an equivalent local-install listing test.
Show a summary per file
File Description
pkg/cmd/skills/install/install.go Adds listAvailableSkills + errSkillsListed sentinel, swaps the non-interactive error path for listing, updates help text/example.
pkg/cmd/skills/install/install_test.go Updates non-interactive remote test to verify listed output and adds an analogous local-install listing test.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 0

Previously, running 'gh skill install <repo>' without a skill name in a
non-interactive context returned an error. This made discovery awkward
when piping or scripting: callers had to first run the command
interactively to see what skills were available.

Now, when no skill name is given and stdin/stdout is not a TTY, the
discovered skills are printed as tab-separated 'SKILL\tDESCRIPTION' rows
to stdout (matching the interactive picker contents) so they can be
piped into grep, awk, fzf, etc. Re-running with a specific skill name
performs the install as before. The same behavior applies to
--from-local installs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@BagToad BagToad force-pushed the sammorrowdrums/skill-install-nontty-listing branch from aa28bca to 5af799f Compare June 17, 2026 19:14
Comment on lines +773 to +776
if opts.IO.IsStdoutTTY() {
fmt.Fprintf(opts.IO.ErrOut, "Showing %s from %s. Re-run with a skill name to install.\n\n",
text.Pluralize(len(skills), "skill"), sel.sourceHint)
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 I don't think this could ever fire in practice because we check if we can prompt before calling listAvailableSkills

Comment on lines 713 to 718

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I were being nit-picky, I'd say this decision should be one level higher up the stack - that's not really something we're causing here, but we are deepening it by making a longer branch in the noninteractive case. I think the noninteractive branch is different enough that it would be more natural to see it diverge before entering a function whose name suggests that we're selecting stuff. It also would eliminate the need for a sentinel error; we'd just do a print and early return without falling into this function instead.

@BagToad BagToad left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, nothing blocking.

If we could clean some of my comments up in a follow up eventually, I think that'd help tear down a bit of tech debt for editing these flows in the future 🙌

@BagToad BagToad merged commit 70bb306 into trunk Jun 17, 2026
11 checks passed
@BagToad BagToad deleted the sammorrowdrums/skill-install-nontty-listing branch June 17, 2026 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants