Skip to content

feat(copilot): support --integration-options="--skills" for skills-based scaffolding#2324

Draft
Copilot wants to merge 5 commits intomainfrom
copilot/add-integration-options-skills
Draft

feat(copilot): support --integration-options="--skills" for skills-based scaffolding#2324
Copilot wants to merge 5 commits intomainfrom
copilot/add-integration-options-skills

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 22, 2026

Adds a --skills flag to the Copilot integration enabling speckit-<name>/SKILL.md scaffolding under .github/skills/ as an alternative to the default .agent.md + .prompt.md + settings merge layout. The two modes are mutually exclusive.

# Default: .agent.md agents + .prompt.md companions + settings merge
specify init my-project --integration copilot

# Skills mode: speckit-<name>/SKILL.md under .github/skills/
specify init my-project --integration copilot --integration-options="--skills"

Implementation

  • Composition over inheritance: _CopilotSkillsHelper(SkillsIntegration) with .github/skills/ config is used as a delegate — CopilotIntegration stays on IntegrationBase
  • setup() branches into _setup_default() and _setup_skills() based on parsed_options["skills"]
  • post_process_skill_content() injects mode: speckit.<stem> into SKILL.md frontmatter (Copilot-specific field, analogous to Claude's user-invocable/disable-model-invocation)
  • build_command_invocation() returns /speckit-<stem> in skills mode, bare args in default mode
  • dispatch_command() detects skills mode from _skills_mode flag or .github/skills/ presence on disk

CLI plumbing

  • init now parses --integration-options via _parse_integration_options() and merges into integration_parsed_options (previously only integration_install/integration_switch did this)
  • ai_skills in init-options.json is set when _skills_mode is active, so downstream tools (presets, extensions) emit SKILL.md overrides correctly

Tests

22 new tests in TestCopilotSkillsMode covering: directory structure, no .prompt.md/.vscode/settings.json in skills mode, frontmatter structure with mode: field, post_process_skill_content() idempotency, manifest tracking, install/uninstall roundtrip, build_command_invocation() in both modes, full CLI integration, and complete file inventory. All 15 existing default-mode tests unchanged.

Copilot AI requested review from Copilot and removed request for Copilot April 22, 2026 22:48
Copilot AI linked an issue Apr 22, 2026 that may be closed by this pull request
8 tasks
Add --skills integration option to CopilotIntegration that scaffolds
commands as speckit-<name>/SKILL.md under .github/skills/ instead of
the default .agent.md + .prompt.md layout.

- Add options() with --skills flag (default=False)
- Branch setup() between default and skills modes
- Add post_process_skill_content() for Copilot-specific mode: field
- Adjust build_command_invocation() for skills mode (/speckit-<stem>)
- Update dispatch_command() with skills mode detection
- Parse --integration-options during init command
- Add 22 new skills-mode tests
- All 15 existing default-mode tests continue to pass

Agent-Logs-Url: https://github.com/github/spec-kit/sessions/a4903fab-64ff-46c3-8eb8-a47f495a70c0

Co-authored-by: mnriem <15701806+mnriem@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot April 22, 2026 22:58
Copilot AI requested review from Copilot and removed request for Copilot April 22, 2026 23:00
Comment thread src/specify_cli/integrations/copilot/__init__.py Fixed
Copilot AI changed the title [WIP] Add --skills flag for skills-based scaffolding in Copilot integration feat(copilot): support --integration-options="--skills" for skills-based scaffolding Apr 22, 2026
Copilot AI requested a review from mnriem April 22, 2026 23:02
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 22, 2026 23:05
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a Copilot integration “skills mode” (--integration-options="--skills") that scaffolds speckit-<name>/SKILL.md under .github/skills/ (instead of .agent.md + .prompt.md + VS Code settings merge), along with CLI plumbing and tests.

Changes:

  • Introduces --skills integration option for Copilot and branches setup() into default vs skills scaffolding.
  • Extends init to parse and forward --integration-options into integration parsed_options, and persists ai_skills when an integration is operating in skills mode.
  • Adds a new test suite covering Copilot skills-mode scaffolding, post-processing, install/uninstall, and CLI integration.
Show a summary per file
File Description
tests/integrations/test_integration_copilot.py Adds comprehensive tests for Copilot --skills mode behavior and CLI wiring.
src/specify_cli/integrations/copilot/init.py Implements Copilot skills-mode scaffolding via a delegate SkillsIntegration helper and adds SKILL.md post-processing + dispatch changes.
src/specify_cli/init.py Ensures init parses --integration-options and persists ai_skills for integrations operating in skills mode.
AGENTS.md Documents Copilot’s new skills mode and how to enable it.

Copilot's findings

Tip

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

  • Files reviewed: 4/4 changed files
  • Comments generated: 4

Comment thread src/specify_cli/integrations/copilot/__init__.py Outdated
Comment thread src/specify_cli/integrations/copilot/__init__.py Outdated
Comment thread src/specify_cli/__init__.py
Comment thread src/specify_cli/integrations/copilot/__init__.py Outdated
- Reset _skills_mode at start of setup() to prevent singleton state leak
- Tighten skills auto-detection to require speckit-*/SKILL.md (not any
  non-empty .github/skills/ directory)
- Add copilot_skill_mode to init next-steps so skills mode renders
  /speckit-plan instead of /speckit.plan
- Fix docstring quoting to match actual unquoted output
- Add 4 tests covering singleton reset, auto-detection false positive,
  speckit layout detection, and next-steps skill syntax
- Fix skipped test_invalid_metadata_error_returns_unknown by simulating
  InvalidMetadataError on Python versions that lack it
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot's findings

Tip

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

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

)

if skills_mode:
prompt = self.build_command_invocation(command_name, args)
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

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

In dispatch_command(), when skills mode is auto-detected from the project layout (skills_mode becomes True while self._skills_mode is still False), prompt = self.build_command_invocation(...) will fall back to default-mode behavior and omit the /speckit-<stem> invocation. This will run Copilot with just the raw args and no skill command.

Fix by building the prompt based on the local skills_mode decision (e.g., inline /speckit-... construction or temporarily setting self._skills_mode = skills_mode before calling build_command_invocation).

Suggested change
prompt = self.build_command_invocation(command_name, args)
prompt = f"/speckit-{stem}"
if args:
prompt = f"{prompt} {args}"

Copilot uses AI. Check for mistakes.
call_args = mock_run.call_args[0][0]
assert "--agent" not in call_args, (
f"Skills mode should not use --agent, got: {call_args}"
)
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

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

test_dispatch_detects_speckit_skills_layout only asserts that --agent is omitted, but it doesn’t assert that the prompt passed via -p actually includes the /speckit-<stem> invocation. This test would still pass if skills auto-detection removed --agent but left the prompt as raw args (regression).

Add an assertion on the value following -p in call_args (or join the args) to ensure /speckit-plan (and the user args) are present.

Suggested change
)
)
prompt = call_args[call_args.index("-p") + 1]
assert "/speckit-plan" in prompt, (
f"Skills mode prompt should invoke /speckit-plan, got: {prompt}"
)
assert "my args" in prompt, (
f"Skills mode prompt should preserve user args, got: {prompt}"
)

Copilot uses AI. Check for mistakes.
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.

copilot: Support --integration-options="--skills" for skills-based scaffolding

3 participants