MCPcopy Create free account
hub / github.com/cli/cli / NewCmdInstall

Function NewCmdInstall

pkg/cmd/skills/install/install.go:76–253  ·  view source on GitHub ↗

NewCmdInstall creates the "skills install" command.

(f *cmdutil.Factory, telemetry ghtelemetry.CommandRecorder, runF func(*InstallOptions) error)

Source from the content-addressed store, hash-verified

74
75// NewCmdInstall creates the "skills install" command.
76func NewCmdInstall(f *cmdutil.Factory, telemetry ghtelemetry.CommandRecorder, runF func(*InstallOptions) error) *cobra.Command {
77 opts := &InstallOptions{
78 IO: f.IOStreams,
79 Telemetry: telemetry,
80 Prompter: f.Prompter,
81 GitClient: f.GitClient,
82 Remotes: f.Remotes,
83 HttpClient: f.HttpClient,
84 }
85
86 cmd := &cobra.Command{
87 Use: "install <repository> [<skill[@version]>] [flags]",
88 Short: "Install agent skills from a GitHub repository (preview)",
89 Long: heredoc.Docf(`
90 Install agent skills from a GitHub repository or local directory into
91 your local environment. Skills are placed in a host-specific directory
92 at either project scope (inside the current git repository) or user
93 scope (in your home directory, available everywhere).
94
95 A wide range of AI coding agents are supported, including GitHub
96 Copilot, Claude Code, Cursor, Codex, Gemini CLI, Antigravity, Amp,
97 Devin, Goose, Grok, Junie, OpenCode, and many more.
98
99 Supported %[1]s--agent%[1]s values:
100
101 %[2]s
102
103 Use %[1]s--agent%[1]s and %[1]s--scope%[1]s to control placement, or %[1]s--dir%[1]s for a
104 custom directory. The default scope is %[1]sproject%[1]s, and the default
105 agent is %[1]sgithub-copilot%[1]s (when running non-interactively).
106
107 At project scope, several agents (including GitHub Copilot, Cursor,
108 Codex, Gemini CLI, Antigravity, Amp, Cline, OpenCode, and Warp) share
109 the %[1]s.agents/skills%[1]s directory. If you select multiple hosts that
110 resolve to the same destination, each skill is installed there only once.
111
112 The first argument is a GitHub repository in %[1]sOWNER/REPO%[1]s format.
113 Use %[1]s--from-local%[1]s to install from a local directory instead.
114 Local skills are auto-discovered using the same conventions as remote
115 repositories, and files are copied (not symlinked) with local-path
116 tracking metadata injected into frontmatter.
117
118 Skills are discovered automatically using the %[1]sskills/*/SKILL.md%[1]s convention
119 defined by the Agent Skills specification, including when the %[1]sskills/%[1]s
120 directory is nested under a prefix (e.g. %[1]sterraform/code-generation/skills/...%[1]s).
121 For more information on the specification,
122 see: https://agentskills.io/specification
123
124 The skill argument can be a name, a namespaced name (%[1]sauthor/skill%[1]s),
125 or an exact path within the repository (%[1]sskills/author/skill%[1]s,
126 %[1]spackages/agent-skills/code-review%[1]s, or any %[1]s.../SKILL.md%[1]s path).
127 Namespaced names with one slash are matched by name. Use a %[1]sSKILL.md%[1]s
128 suffix to force a one-directory path outside the standard conventions.
129
130 Performance tip: when installing from a large repository with many
131 skills, providing an exact path instead of a skill name avoids a
132 full tree traversal of the repository, making the install significantly faster.
133

Callers 2

NewCmdSkillsFunction · 0.92
TestNewCmdInstallFunction · 0.85

Calls 9

AgentHelpListFunction · 0.92
FlagErrorfFunction · 0.92
MutuallyExclusiveFunction · 0.92
StringEnumFlagFunction · 0.92
AgentIDsFunction · 0.92
DisableAuthCheckFlagFunction · 0.92
installRunFunction · 0.85
CanPromptMethod · 0.80
ContainsMethod · 0.80

Tested by 1

TestNewCmdInstallFunction · 0.68