Skip to content

fix(ai-skills): exclude non-speckit copilot agent markdown from skill…#1867

Open
darkglow-net wants to merge 1 commit intogithub:mainfrom
darkglow-net:fix/copilot-ai-skills-filter
Open

fix(ai-skills): exclude non-speckit copilot agent markdown from skill…#1867
darkglow-net wants to merge 1 commit intogithub:mainfrom
darkglow-net:fix/copilot-ai-skills-filter

Conversation

@darkglow-net
Copy link

Description

Fix issue #1858 - install_ai_skills creates spurious skills from non-speckit agent files when using --ai copilot --ai-skills

Fix: install_ai_skills() now filters copilot command templates to speckit.*.md - preventing user-authored agent files in agents from being incorrectly converted into skills.
Other agents are unaffected since their commands_subdir directories contain only speckit templates.

Test: Adds test_copilot_ignores_non_speckit_agents to verify that non-speckit markdown files (e.g. other-agent.agent.md) in the shared agents directory are excluded from skill generation.

Testing

  1. Create dummy agent in .github/agents/
  2. specify init --ai copilot --ai-skills --here
  3. Confirm no misattributed non-speckit skills created in .github/skills/
image

AI Disclosure

  • I did not use AI assistance for this contribution
  • I did use AI assistance (describe below)

RCA and remediation developed with Github Copilot. Code review conducted with Opus 4.6.

@darkglow-net darkglow-net requested a review from mnriem as a code owner March 16, 2026 15:25
Copilot AI review requested due to automatic review settings March 16, 2026 15:25
Copy link
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

Fixes #1858 by preventing install_ai_skills() from generating skills from non–spec-kit GitHub Copilot agent markdown files that may coexist in .github/agents/.

Changes:

  • Update install_ai_skills() to filter Copilot templates to speckit.*.md.
  • Update the all-agents skills installation test to respect commands_subdir and adjust Copilot’s template filename.
  • Add a new test ensuring non-speckit Copilot agent markdown files are ignored during skill generation.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/specify_cli/__init__.py Adds Copilot-specific template globbing to avoid converting unrelated .md files into skills.
tests/test_ai_skills.py Updates fixture setup to follow commands_subdir and adds coverage for ignoring non-speckit Copilot agent files.

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

Comment on lines +1184 to +1187
if selected_ai == "copilot":
command_files = sorted(templates_dir.glob("speckit.*.md"))
else:
command_files = sorted(templates_dir.glob("*.md"))
Comment on lines +436 to +437
# Copilot filters for speckit.*.md; other agents use plain names
fname = "speckit.specify.md" if agent_key == "copilot" else "specify.md"
Comment on lines +458 to +463
(agents_dir / "speckit.plan.md").write_text(
"---\ndescription: Generate implementation plan.\n---\n\n# Plan\n\nBody.\n"
)
(agents_dir / "other-agent.agent.md").write_text(
"---\ndescription: Some other agent\n---\n\n# Other\n\nBody.\n"
)
Copy link
Collaborator

@mnriem mnriem left a comment

Choose a reason for hiding this comment

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

Please address Copilot feedback. If not applicable please explain why

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