Skip to content

[Bug]: "install_ai_skills" creates spurious skills from non-speckit agent files when using "--ai copilot --ai-skills" #1858

@darkglow-net

Description

@darkglow-net

Bug Description

install_ai_skills creates spurious skills from non-speckit agent files when using --ai copilot --ai-skills

Summary

When running specify init --here --ai copilot --ai-skills in a project that already has custom (non-speckit) agent files in .github/agents/, the install_ai_skills() function treats every .md file in that directory as a spec-kit command template - not just the speckit.* ones. This produces unexpected skill directories for user-authored agents that have nothing to do with spec-kit.


Root Cause

In src/specify_cli/__init__.py, AGENT_CONFIG defines the copilot entry as:

"copilot": {
    "folder": ".github/",
    "commands_subdir": "agents",   # ← shared user directory
}

For every other agent type, commands_subdir points to a dedicated directory (e.g. "commands"). For copilot, it points to .github/agents/ - the same directory that holds both spec-kit command agents and user-authored agents.

install_ai_skills() then performs an unfiltered glob:

templates_dir = project_path / agent_folder / commands_subdir   # resolves to .github/agents/
command_files = sorted(templates_dir.glob("*.md"))              # picks up ALL .md files

Every .md file in .github/agents/ becomes a skill candidate, regardless of whether it is a spec-kit command or a user-authored agent.

Steps to Reproduce

Steps to Reproduce

  1. Create a fresh spec-kit copilot project:

    mkdir /tmp/repro && cd /tmp/repro
    specify init --here --ai copilot --ai-skills
  2. Add a custom (non-speckit) agent file alongside the generated speckit ones:

    cat > .github/agents/my-custom-agent.agent.md << 'EOF'
    ---
    name: my-custom-agent
    description: "A user-authored agent unrelated to spec-kit"
    ---
    You are a custom agent.
    EOF
  3. Simulate a re-init / upgrade

    specify init --here --ai copilot --ai-skills
  4. Inspect the generated skills directory:

    ls .github/skills/

Expected Behavior

Only speckit-analyze/, speckit-checklist/, etc. (the standard spec-kit commands).

Actual Behavior

Also creates speckit-my-custom-agent.agent/SKILL.md - a skill wrapper for the user's custom agent, with author: github-spec-kit falsely attributed in the frontmatter.

Specify CLI Version

0.3.0

AI Agent

Claude Code

Operating System

Ubuntu (WSL2) / Windows 11

Python Version

3.12.3

Error Logs

Additional Context

Image Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions