Skip to content

Commit c8af730

Browse files
authored
feat: migrate Codex/agy init to native skills workflow (#1906)
* feat: migrate codex and agy to native skills flow * fix: harden codex skill frontmatter and script fallback * fix: clarify skills separator default expansion * fix: rewrite agent_scripts paths for codex skills * fix: align kimi guidance and platform-aware codex fallback
1 parent a4b60ac commit c8af730

File tree

9 files changed

+769
-123
lines changed

9 files changed

+769
-123
lines changed

.github/workflows/scripts/create-release-packages.ps1

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -201,20 +201,22 @@ agent: $basename
201201
}
202202
}
203203

204-
# Create Kimi Code skills in .kimi/skills/<name>/SKILL.md format.
205-
# Kimi CLI discovers skills as directories containing a SKILL.md file,
206-
# invoked with /skill:<name> (e.g. /skill:speckit.specify).
207-
function New-KimiSkills {
204+
# Create skills in <skills_dir>\<name>\SKILL.md format.
205+
# Most agents use hyphenated names (e.g. speckit-plan); Kimi is the
206+
# current dotted-name exception (e.g. speckit.plan).
207+
function New-Skills {
208208
param(
209209
[string]$SkillsDir,
210-
[string]$ScriptVariant
210+
[string]$ScriptVariant,
211+
[string]$AgentName,
212+
[string]$Separator = '-'
211213
)
212214

213215
$templates = Get-ChildItem -Path "templates/commands/*.md" -File -ErrorAction SilentlyContinue
214216

215217
foreach ($template in $templates) {
216218
$name = [System.IO.Path]::GetFileNameWithoutExtension($template.Name)
217-
$skillName = "speckit.$name"
219+
$skillName = "speckit${Separator}$name"
218220
$skillDir = Join-Path $SkillsDir $skillName
219221
New-Item -ItemType Directory -Force -Path $skillDir | Out-Null
220222

@@ -267,7 +269,7 @@ function New-KimiSkills {
267269

268270
$body = $outputLines -join "`n"
269271
$body = $body -replace '\{ARGS\}', '$ARGUMENTS'
270-
$body = $body -replace '__AGENT__', 'kimi'
272+
$body = $body -replace '__AGENT__', $AgentName
271273
$body = Rewrite-Paths -Content $body
272274

273275
# Strip existing frontmatter, keep only body
@@ -396,8 +398,9 @@ function Build-Variant {
396398
Generate-Commands -Agent 'windsurf' -Extension 'md' -ArgFormat '$ARGUMENTS' -OutputDir $cmdDir -ScriptVariant $Script
397399
}
398400
'codex' {
399-
$cmdDir = Join-Path $baseDir ".codex/prompts"
400-
Generate-Commands -Agent 'codex' -Extension 'md' -ArgFormat '$ARGUMENTS' -OutputDir $cmdDir -ScriptVariant $Script
401+
$skillsDir = Join-Path $baseDir ".agents/skills"
402+
New-Item -ItemType Directory -Force -Path $skillsDir | Out-Null
403+
New-Skills -SkillsDir $skillsDir -ScriptVariant $Script -AgentName 'codex' -Separator '-'
401404
}
402405
'kilocode' {
403406
$cmdDir = Join-Path $baseDir ".kilocode/workflows"
@@ -452,7 +455,7 @@ function Build-Variant {
452455
'kimi' {
453456
$skillsDir = Join-Path $baseDir ".kimi/skills"
454457
New-Item -ItemType Directory -Force -Path $skillsDir | Out-Null
455-
New-KimiSkills -SkillsDir $skillsDir -ScriptVariant $Script
458+
New-Skills -SkillsDir $skillsDir -ScriptVariant $Script -AgentName 'kimi' -Separator '.'
456459
}
457460
'trae' {
458461
$rulesDir = Join-Path $baseDir ".trae/rules"

.github/workflows/scripts/create-release-packages.sh

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -121,18 +121,20 @@ EOF
121121
done
122122
}
123123

124-
# Create Kimi Code skills in .kimi/skills/<name>/SKILL.md format.
125-
# Kimi CLI discovers skills as directories containing a SKILL.md file,
126-
# invoked with /skill:<name> (e.g. /skill:speckit.specify).
127-
create_kimi_skills() {
124+
# Create skills in <skills_dir>/<name>/SKILL.md format.
125+
# Most agents use hyphenated names (e.g. speckit-plan); Kimi is the
126+
# current dotted-name exception (e.g. speckit.plan).
127+
create_skills() {
128128
local skills_dir="$1"
129129
local script_variant="$2"
130+
local agent_name="$3"
131+
local separator="${4:-"-"}"
130132

131133
for template in templates/commands/*.md; do
132134
[[ -f "$template" ]] || continue
133135
local name
134136
name=$(basename "$template" .md)
135-
local skill_name="speckit.${name}"
137+
local skill_name="speckit${separator}${name}"
136138
local skill_dir="${skills_dir}/${skill_name}"
137139
mkdir -p "$skill_dir"
138140

@@ -175,9 +177,9 @@ create_kimi_skills() {
175177
in_frontmatter && skip_scripts && /^[[:space:]]/ { next }
176178
{ print }
177179
')
178-
body=$(printf '%s\n' "$body" | sed 's/{ARGS}/\$ARGUMENTS/g' | sed 's/__AGENT__/kimi/g' | rewrite_paths)
180+
body=$(printf '%s\n' "$body" | sed 's/{ARGS}/\$ARGUMENTS/g' | sed "s/__AGENT__/$agent_name/g" | rewrite_paths)
179181

180-
# Strip existing frontmatter and prepend Kimi frontmatter
182+
# Strip existing frontmatter and prepend skills frontmatter.
181183
local template_body
182184
template_body=$(printf '%s\n' "$body" | awk '/^---/{p++; if(p==2){found=1; next}} found')
183185

@@ -249,8 +251,8 @@ build_variant() {
249251
mkdir -p "$base_dir/.windsurf/workflows"
250252
generate_commands windsurf md "\$ARGUMENTS" "$base_dir/.windsurf/workflows" "$script" ;;
251253
codex)
252-
mkdir -p "$base_dir/.codex/prompts"
253-
generate_commands codex md "\$ARGUMENTS" "$base_dir/.codex/prompts" "$script" ;;
254+
mkdir -p "$base_dir/.agents/skills"
255+
create_skills "$base_dir/.agents/skills" "$script" "codex" "-" ;;
254256
kilocode)
255257
mkdir -p "$base_dir/.kilocode/workflows"
256258
generate_commands kilocode md "\$ARGUMENTS" "$base_dir/.kilocode/workflows" "$script" ;;
@@ -290,7 +292,7 @@ build_variant() {
290292
generate_commands vibe md "\$ARGUMENTS" "$base_dir/.vibe/prompts" "$script" ;;
291293
kimi)
292294
mkdir -p "$base_dir/.kimi/skills"
293-
create_kimi_skills "$base_dir/.kimi/skills" "$script" ;;
295+
create_skills "$base_dir/.kimi/skills" "$script" "kimi" "." ;;
294296
trae)
295297
mkdir -p "$base_dir/.trae/rules"
296298
generate_commands trae md "\$ARGUMENTS" "$base_dir/.trae/rules" "$script" ;;

README.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ uvx --from git+https://github.com/github/spec-kit.git specify init --here --ai c
9999

100100
### 2. Establish project principles
101101

102-
Launch your AI assistant in the project directory. The `/speckit.*` commands are available in the assistant.
102+
Launch your AI assistant in the project directory. Most agents expose spec-kit as `/speckit.*` slash commands; Codex CLI in skills mode uses `$speckit-*` instead.
103103

104104
Use the **`/speckit.constitution`** command to create your project's governing principles and development guidelines that will guide all subsequent development.
105105

@@ -173,7 +173,7 @@ See Spec-Driven Development in action across different scenarios with these comm
173173
| [Auggie CLI](https://docs.augmentcode.com/cli/overview) || |
174174
| [Claude Code](https://www.anthropic.com/claude-code) || |
175175
| [CodeBuddy CLI](https://www.codebuddy.ai/cli) || |
176-
| [Codex CLI](https://github.com/openai/codex) || |
176+
| [Codex CLI](https://github.com/openai/codex) || Requires `--ai-skills`. Codex recommends [skills](https://developers.openai.com/codex/skills) and treats [custom prompts](https://developers.openai.com/codex/custom-prompts) as deprecated. Spec-kit installs Codex skills into `.agents/skills` and invokes them as `$speckit-<command>`. |
177177
| [Cursor](https://cursor.sh/) || |
178178
| [Gemini CLI](https://github.com/google-gemini/gemini-cli) || |
179179
| [GitHub Copilot](https://code.visualstudio.com/) || |
@@ -258,6 +258,9 @@ specify init my-project --ai bob
258258
# Initialize with Pi Coding Agent support
259259
specify init my-project --ai pi
260260

261+
# Initialize with Codex CLI support
262+
specify init my-project --ai codex --ai-skills
263+
261264
# Initialize with Antigravity support
262265
specify init my-project --ai agy --ai-skills
263266

@@ -298,7 +301,9 @@ specify check
298301

299302
### Available Slash Commands
300303

301-
After running `specify init`, your AI coding agent will have access to these slash commands for structured development:
304+
After running `specify init`, your AI coding agent will have access to these slash commands for structured development.
305+
306+
For Codex CLI, `--ai-skills` installs spec-kit as agent skills instead of slash-command prompt files. In Codex skills mode, invoke spec-kit as `$speckit-constitution`, `$speckit-specify`, `$speckit-plan`, `$speckit-tasks`, and `$speckit-implement`.
302307

303308
#### Core Commands
304309

@@ -484,11 +489,11 @@ specify init <project_name> --ai copilot
484489

485490
# Or in current directory:
486491
specify init . --ai claude
487-
specify init . --ai codex
492+
specify init . --ai codex --ai-skills
488493

489494
# or use --here flag
490495
specify init --here --ai claude
491-
specify init --here --ai codex
496+
specify init --here --ai codex --ai-skills
492497

493498
# Force merge into a non-empty current directory
494499
specify init . --force --ai claude

0 commit comments

Comments
 (0)