Skip to content

fix: resolve skill placeholders for all SKILL.md agents, not just codex/kimi#2313

Merged
mnriem merged 2 commits intogithub:mainfrom
swithek:fix-extension-template-processing
Apr 22, 2026
Merged

fix: resolve skill placeholders for all SKILL.md agents, not just codex/kimi#2313
mnriem merged 2 commits intogithub:mainfrom
swithek:fix-extension-template-processing

Conversation

@swithek
Copy link
Copy Markdown
Contributor

@swithek swithek commented Apr 22, 2026

Description

When using Claude Code, adding a spec-kit extension produced a SKILL.md with unresolved placeholders: raw {SCRIPT} and __AGENT__ tokens instead of the actual script path and agent name. With Codex it worked correctly, so the bug wasn't obvious until I tested with a different agent.

The root cause was a hardcoded check that only allowed codex and kimi to go through placeholder resolution. Any agent added after that was silently skipped.

The hardcoded set was replaced with a registry check so all current and future SKILL.md agents are covered automatically.

A parametrized test covering all six skill agents has been added as well.

Testing

  • Tested locally with uv run specify --help
  • Ran existing tests with uv sync && uv run pytest
  • Tested with a sample project (if applicable)

Test selection reasoning

Changed file Affects Test Why
src/specify_cli/agents.py specify extension add (skill agents) T1 render_skill_command() runs when an extension is added to a SKILL.md agent — the fix must be validated end-to-end by adding an extension and inspecting the written SKILL.md
src/specify_cli/agents.py specify init (skill agents) T2 Init scaffolds default commands as skills; confirms no regression in baseline skill file generation
tests/test_extensions.py Test-only file; no slash command impact

Required tests

  • T1: specify init with a skill agent (e.g., --ai codex) — prerequisite; creates the project and installs the integration before extension commands can be tested
  • T2: specify extension add <ext> --dev on the T1 project using each skill agent type — verifies that the SKILL.md written by the fixed render_skill_command() contains resolved script paths and agent names with no raw {SCRIPT} or __AGENT__ tokens remaining

Manual test results

Agent: Codex CLI + Claude Code (both tested) | OS/Shell: macOS/zsh

Command tested Notes
specify init with a skill agent (--ai codex, --ai claude) Pass — works fine
specify extension add <ext> --dev on each skill agent type Pass — works fine with both agents; SKILL.md files contain fully resolved placeholders

AI Disclosure

  • I did use AI assistance (describe below)

I used Copilot to understand the project structure and code intention, but the implementation changes are my own. The test result table and test selection analysis in this PR were also generated with Copilot (as requested in CONTRIBUTING.md).

@swithek swithek requested a review from mnriem as a code owner April 22, 2026 14:54
Copilot AI review requested due to automatic review settings April 22, 2026 14:54
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

This PR fixes placeholder resolution in generated SKILL.md files so that script/agent tokens are resolved for all skills-based agents (not just codex and kimi), and adds coverage to prevent regressions.

Changes:

  • Update SKILL placeholder resolution gating to use the agent registry (AGENT_CONFIGS) rather than a hardcoded agent-name set.
  • Add a parametrized test to validate placeholder resolution across all current SKILL.md agents.

Reviewed changes

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

File Description
src/specify_cli/agents.py Ensures SKILL placeholder resolution runs for any agent configured to emit /SKILL.md outputs.
tests/test_extensions.py Adds parametrized coverage asserting {SCRIPT}, {ARGS}, and __AGENT__ are fully resolved for all SKILL agents.

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

Copy link
Copy Markdown
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.

Nice fix — the registry-based check is consistent with how presets.py already identifies skill agents.

One small follow-up: there's a NATIVE_SKILLS_AGENTS = {"codex", "kimi"} constant in init.py (around line 923) that's the same hardcoded set you're removing here. It's defined but never referenced anywhere. Could you remove it in this PR as well to avoid leaving a stale breadcrumb?

@swithek
Copy link
Copy Markdown
Contributor Author

swithek commented Apr 22, 2026

@mnriem done 👍

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: 3/3 changed files
  • Comments generated: 1

Comment thread src/specify_cli/__init__.py
@mnriem mnriem merged commit ecb3b94 into github:main Apr 22, 2026
15 checks passed
@mnriem
Copy link
Copy Markdown
Collaborator

mnriem commented Apr 22, 2026

Thank you!

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