@kurokeita/add-skill 1.21.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,30 @@
1
+ # Hook templates
2
+
3
+ Session-start hook snippets that the `universalize-agents` skill merges into
4
+ each platform's config file (see `../mapping.md` for file locations).
5
+
6
+ ## Verification status
7
+
8
+ | Platform | Template | Status |
9
+ |---|---|---|
10
+ | Claude Code | `claude-code.json` | Verified |
11
+ | Gemini / Antigravity | `gemini.json` | Verified |
12
+ | Codex | `codex.toml` | Verified |
13
+ | GitHub Copilot | `copilot.json` | Verified |
14
+ | Windsurf | — | No session-start hook — one-time symlink only |
15
+
16
+ Windsurf (Cascade) hooks are action-scoped only (`pre_write_code`,
17
+ `post_setup_worktree`, etc.) with no session-start event, so no recurring hook
18
+ is installed. Windsurf still gets a one-time symlink during the setup run (its
19
+ dirs stay in the link map); re-run the setup script manually to pick up later
20
+ changes to the shared `.agents/`.
21
+
22
+ ## Merge rules (all platforms)
23
+
24
+ - Append, never overwrite. Parse the file, inject the hook only if an
25
+ equivalent entry is absent, then write back.
26
+ - Back up the file to `<file>.bak` before the first modification.
27
+ - The hook command is the absolute path to the OS-appropriate setup script
28
+ (`agent-setup.sh` on macOS/Linux, `agent-setup.ps1` on Windows). Copilot
29
+ uses the `bash`/`powershell` fields; Gemini and Codex use a `command`
30
+ string grouped under a `matcher`.
@@ -0,0 +1,15 @@
1
+ {
2
+ "_comment": "VERIFIED. Claude Code SessionStart hook. Merge the SessionStart entry into the existing settings.json hooks object; do not overwrite sibling keys. Replace the command path with the absolute path to <base>/.agents/hooks/agent-setup.sh.",
3
+ "hooks": {
4
+ "SessionStart": [
5
+ {
6
+ "hooks": [
7
+ {
8
+ "type": "command",
9
+ "command": "<base>/.agents/hooks/agent-setup.sh"
10
+ }
11
+ ]
12
+ }
13
+ ]
14
+ }
15
+ }
@@ -0,0 +1,10 @@
1
+ # VERIFIED (developers.openai.com/codex/hooks). Append these tables into the
2
+ # existing .codex/config.toml; keep other tables. Replace <COMMAND> with the
3
+ # absolute path to <base>/.agents/hooks/agent-setup.sh. Codex prompts for a
4
+ # trust review of project hooks on first use.
5
+ [[hooks.SessionStart]]
6
+ matcher = "startup"
7
+
8
+ [[hooks.SessionStart.hooks]]
9
+ type = "command"
10
+ command = "<COMMAND>"
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "VERIFIED (docs.github.com hooks-configuration). Write to .github/hooks/agent-setup.json (project) or ~/.copilot/hooks/agent-setup.json (global). Replace <COMMAND> with the absolute path to <base>/.agents/hooks/agent-setup.sh; use the powershell field instead of bash on Windows.",
3
+ "version": 1,
4
+ "hooks": {
5
+ "sessionStart": [
6
+ { "type": "command", "bash": "<COMMAND>", "timeoutSec": 30 }
7
+ ]
8
+ }
9
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "_comment": "VERIFIED (gemini-cli docs/hooks/reference.md). Merge the SessionStart entry into the existing .gemini/settings.json hooks object; keep sibling keys. Replace <COMMAND> with the absolute path to <base>/.agents/hooks/agent-setup.sh (agent-setup.ps1 on Windows). Same schema for Antigravity.",
3
+ "hooks": {
4
+ "SessionStart": [
5
+ {
6
+ "matcher": "startup",
7
+ "hooks": [{ "type": "command", "command": "<COMMAND>" }]
8
+ }
9
+ ]
10
+ }
11
+ }
@@ -0,0 +1,100 @@
1
+ # Platform mapping reference
2
+
3
+ Reverse map used by the `universalize-agents` skill. Source of truth is
4
+ `src/utils/paths.ts` in this repository — keep this file in sync with it.
5
+
6
+ ## Source directories (discover from / symlink to)
7
+
8
+ `Global` paths are under `$HOME`. `Project` paths are relative to the project
9
+ root. A few platforms use a different sub-path between scopes (noted in bold).
10
+
11
+ ### Skills (`.agents/skills`)
12
+
13
+ | Platform | Global | Project |
14
+ |---|---|---|
15
+ | Claude Code | `~/.claude/skills` | `.claude/skills` |
16
+ | Codex | `~/.codex/skills` | `.codex/skills` |
17
+ | GitHub Copilot | `~/.copilot/skills` | `.copilot/skills` |
18
+ | Gemini CLI | `~/.gemini/skills` | `.gemini/skills` |
19
+ | Windsurf | `~/.codeium/windsurf/skills` | `.codeium/windsurf/skills` |
20
+ | Antigravity | `~/.gemini/antigravity/`**`global_skills`** | `.gemini/antigravity/`**`skills`** |
21
+
22
+ ### Agents (`.agents/agents`)
23
+
24
+ | Platform | Global | Project |
25
+ |---|---|---|
26
+ | Claude Code | `~/.claude/agents` | `.claude/agents` |
27
+ | Codex | `~/.codex/skills` | `.codex/skills` |
28
+ | GitHub Copilot | `~/.copilot/agents` | `.copilot/agents` |
29
+ | Gemini CLI | `~/.gemini/agents` | `.gemini/agents` |
30
+ | Windsurf | — | — |
31
+ | Antigravity | — | — |
32
+
33
+ ### Commands / workflows (`.agents/commands`)
34
+
35
+ | Platform | Global | Project |
36
+ |---|---|---|
37
+ | Claude Code | `~/.claude/commands` | `.claude/commands` |
38
+ | Codex | `~/.codex/skills` | `.codex/skills` |
39
+ | GitHub Copilot | `~/.copilot/prompts` | `.copilot/prompts` |
40
+ | Gemini CLI | `~/.gemini/commands` | `.gemini/commands` |
41
+ | Windsurf | `~/.codeium/windsurf/`**`global_workflows`** | `.codeium/windsurf/`**`workflows`** |
42
+ | Antigravity | `~/.gemini/antigravity/`**`global_workflows`** | `.gemini/antigravity/`**`workflows`** |
43
+
44
+ ### Rules (`.agents/rules`)
45
+
46
+ Standard markdown rule files, discovered from the dirs below and consolidated
47
+ into `.agents/rules/`. They are **not** symlinked back — the whole
48
+ `.agents/rules/` dir is `@`-imported into `AGENTS.md` (see SKILL.md Phase 4), so
49
+ every platform picks them up via the master chain. Codex and Windsurf have no
50
+ rules dir to discover from.
51
+
52
+ | Platform | Global | Project |
53
+ |---|---|---|
54
+ | Claude Code | `~/.claude/rules` | `.claude/rules` |
55
+ | Gemini CLI | `~/.gemini/rules` | `.gemini/rules` |
56
+ | Antigravity | `~/.gemini/antigravity/rules` | `.gemini/antigravity/rules` |
57
+ | GitHub Copilot | — | `.github/instructions` |
58
+ | Codex / Windsurf | — | — |
59
+
60
+ ## Collapsed directories
61
+
62
+ These targets hold more than one type, so reverse-discovery must read item
63
+ frontmatter / the `x-ai-agents-type` metadata to recover the true type:
64
+
65
+ - `.codex/skills` — skills **and** agents **and** commands.
66
+
67
+ When symlinking back, use per-item links so these merged directories do not
68
+ collide.
69
+
70
+ ## Format normalization
71
+
72
+ - Workflows are stored under `.agents/commands/` (the universal name); migrate
73
+ any legacy `.agents/workflows/` into it.
74
+ - Gemini commands are TOML and convert to markdown skills in
75
+ `.agents/skills/<name>/SKILL.md` (reverse of `convertToGeminiCommandTOML`
76
+ in `src/utils/toml.ts`). See SKILL.md Phase 3.
77
+
78
+ ## Hook-config files (session-start)
79
+
80
+ Always append into the existing file; back up first; never overwrite.
81
+
82
+ | Platform | Global | Project | Format |
83
+ |---|---|---|---|
84
+ | Claude Code | `~/.claude/settings.json` | `.claude/settings.json` | JSON |
85
+ | Gemini / Antigravity | `~/.gemini/settings.json` | `.gemini/settings.json` | JSON |
86
+ | Codex | `~/.codex/config.toml` | `.codex/config.toml` | TOML |
87
+ | Windsurf | — | — | no session-start event; one-time symlink only |
88
+ | GitHub Copilot | `~/.copilot/hooks/agent-setup.json` | `.github/hooks/agent-setup.json` | JSON |
89
+
90
+ ## Master-instruction files
91
+
92
+ | Platform | File |
93
+ |---|---|
94
+ | Claude Code | `CLAUDE.md` |
95
+ | Codex / Antigravity / Windsurf | `AGENTS.md` |
96
+ | Gemini CLI | `GEMINI.md` |
97
+ | GitHub Copilot | `.github/copilot-instructions.md` |
98
+
99
+ Canonical consolidated target: root `AGENTS.md` (also copied into
100
+ `.agents/rules/`).
@@ -0,0 +1,83 @@
1
+ #!/usr/bin/env pwsh
2
+ # Generated by the `universalize-agents` skill. Windows only
3
+ # (see agent-setup.sh for macOS/Linux). Safe to re-run (idempotent).
4
+ # Project scope fills relative paths; global scope fills absolute paths.
5
+ # Creating symlinks on Windows requires Developer Mode or an elevated shell.
6
+
7
+ $ErrorActionPreference = 'Stop'
8
+
9
+ $AgentsDir = '__AGENTS_DIR__'
10
+
11
+ # __LINK_MAP__ contract: one "SRC_SUBDIR|DEST_DIR" line per (platform x type),
12
+ # where SRC_SUBDIR is skills|agents|commands and DEST_DIR matches the scope.
13
+ $LinkMap = @'
14
+ __LINK_MAP__
15
+ '@
16
+
17
+ function Write-AgentLog($message) { Write-Host "agent-setup: $message" }
18
+
19
+ # Relative paths (project scope) resolve from the repo root; this script lives
20
+ # at <root>\.agents\hooks\, so move two levels up. Absolute paths are untouched.
21
+ $IsRelative = -not [System.IO.Path]::IsPathRooted($AgentsDir)
22
+ if ($IsRelative) { Set-Location (Join-Path $PSScriptRoot '..\..') }
23
+
24
+ function Set-AgentLink($src, $dest) {
25
+ if (Test-Path -LiteralPath $dest) {
26
+ $existing = Get-Item -LiteralPath $dest -Force
27
+ if ($existing.LinkType -eq 'SymbolicLink' -and $existing.Target -eq $src) {
28
+ return
29
+ }
30
+ if ($existing.LinkType -ne 'SymbolicLink') {
31
+ # Refuse to replace a real (non-symlink) path that a user may own.
32
+ Write-AgentLog "SKIP (real path in the way): $dest"
33
+ return
34
+ }
35
+ Remove-Item -LiteralPath $dest -Force
36
+ }
37
+ New-Item -ItemType SymbolicLink -Path $dest -Target $src | Out-Null
38
+ }
39
+
40
+ foreach ($line in $LinkMap -split "`r?`n") {
41
+ $line = $line.Trim()
42
+ if (-not $line) { continue }
43
+
44
+ $sub, $destDir = $line -split '\|', 2
45
+ if (-not $sub -or -not $destDir) { continue }
46
+
47
+ $srcDir = Join-Path $AgentsDir $sub
48
+ if (-not (Test-Path -LiteralPath $srcDir)) { continue }
49
+ if (-not (Test-Path -LiteralPath $destDir)) {
50
+ New-Item -ItemType Directory -Path $destDir -Force | Out-Null
51
+ } else {
52
+ # Clean up dangling symlinks in $destDir
53
+ foreach ($link in Get-ChildItem -LiteralPath $destDir -Force) {
54
+ if ($link.LinkType -eq 'SymbolicLink' -and -not (Test-Path -LiteralPath $link.FullName)) {
55
+ Write-AgentLog "removing broken symlink: $($link.FullName)"
56
+ Remove-Item -LiteralPath $link.FullName -Force
57
+ }
58
+ }
59
+ }
60
+
61
+ # Project scope only: keep the generated symlinks out of git via a single
62
+ # .gitignore per platform base dir (the dest's parent), listing each
63
+ # symlink subdir. The canonical content lives in (tracked) .agents/.
64
+ if ($IsRelative) {
65
+ $gi = Join-Path (Split-Path -Parent $destDir) '.gitignore'
66
+ $entry = (Split-Path -Leaf $destDir) + '/'
67
+ $lines = @()
68
+ if (Test-Path -LiteralPath $gi) { $lines = @(Get-Content -LiteralPath $gi) }
69
+ if ($lines -notcontains $entry) { Add-Content -LiteralPath $gi -Value $entry }
70
+ }
71
+
72
+ foreach ($item in Get-ChildItem -LiteralPath $srcDir -Force) {
73
+ $dest = Join-Path $destDir $item.Name
74
+ if ($IsRelative) {
75
+ $target = [System.IO.Path]::GetRelativePath($destDir, (Join-Path $srcDir $item.Name))
76
+ } else {
77
+ $target = $item.FullName
78
+ }
79
+ Set-AgentLink $target $dest
80
+ }
81
+ }
82
+
83
+ Write-AgentLog 'done.'
@@ -0,0 +1,98 @@
1
+ #!/usr/bin/env bash
2
+ # Generated by the `universalize-agents` skill. macOS/Linux only
3
+ # (see agent-setup.ps1 for Windows). Safe to re-run (idempotent).
4
+ # Project scope fills relative paths; global scope fills absolute paths.
5
+
6
+ set -euo pipefail
7
+
8
+ AGENTS_DIR="__AGENTS_DIR__"
9
+
10
+ # __LINK_MAP__ contract: one "SRC_SUBDIR|DEST_DIR" line per (platform x type),
11
+ # where SRC_SUBDIR is skills|agents|commands and DEST_DIR matches the scope
12
+ # (relative to repo root for project scope, absolute for global scope).
13
+ LINK_MAP="$(
14
+ cat <<'EOF'
15
+ __LINK_MAP__
16
+ EOF
17
+ )"
18
+
19
+ log() { printf 'agent-setup: %s\n' "$1" >&2; }
20
+
21
+ # Relative paths (project scope) resolve from the repo root; this script lives
22
+ # at <root>/.agents/hooks/, so cd two levels up. Absolute paths are untouched.
23
+ case "$AGENTS_DIR" in
24
+ /*) ;;
25
+ *) cd "$(dirname "$0")/../.." ;;
26
+ esac
27
+
28
+ # Echo the "../" prefix climbing from a relative dir back to the repo root,
29
+ # so a symlink's target is correct relative to the link's own location.
30
+ up_to_root() {
31
+ up=""
32
+ old_ifs="$IFS"
33
+ IFS=/
34
+ for _seg in $1; do up="../$up"; done
35
+ IFS="$old_ifs"
36
+ printf '%s' "$up"
37
+ }
38
+
39
+ link_item() {
40
+ src="$1"
41
+ dest="$2"
42
+
43
+ if [ -L "$dest" ] && [ "$(readlink "$dest")" = "$src" ]; then
44
+ return 0
45
+ fi
46
+
47
+ # Refuse to replace a real (non-symlink) path that a user may own.
48
+ if [ -e "$dest" ] && [ ! -L "$dest" ]; then
49
+ log "SKIP (real path in the way): $dest"
50
+ return 0
51
+ fi
52
+
53
+ rm -f "$dest"
54
+ ln -s "$src" "$dest"
55
+ }
56
+
57
+ printf '%s\n' "$LINK_MAP" | while IFS='|' read -r sub destdir; do
58
+ [ -z "${sub:-}" ] && continue
59
+ [ -z "${destdir:-}" ] && continue
60
+
61
+ srcdir="$AGENTS_DIR/$sub"
62
+ [ -d "$srcdir" ] || continue
63
+
64
+ mkdir -p "$destdir"
65
+
66
+ # Clean up dangling symlinks in $destdir
67
+ for link in "$destdir"/*; do
68
+ [ -e "$link" ] || [ -L "$link" ] || continue
69
+ if [ -L "$link" ] && [ ! -e "$link" ]; then
70
+ log "removing broken symlink: $link"
71
+ rm -f "$link"
72
+ fi
73
+ done
74
+
75
+ # Project scope only: keep the generated symlinks out of git via a single
76
+ # .gitignore per platform base dir (the dest's parent), listing each
77
+ # symlink subdir. The canonical content lives in (tracked) .agents/.
78
+ prefix=""
79
+ case "$AGENTS_DIR" in
80
+ /*) ;;
81
+ *)
82
+ prefix="$(up_to_root "$destdir")"
83
+ gi="$(dirname "$destdir")/.gitignore"
84
+ entry="$(basename "$destdir")/"
85
+ if [ ! -f "$gi" ] || ! grep -qxF "$entry" "$gi"; then
86
+ printf '%s\n' "$entry" >>"$gi"
87
+ fi
88
+ ;;
89
+ esac
90
+
91
+ for item in "$srcdir"/*; do
92
+ [ -e "$item" ] || continue
93
+ name="$(basename "$item")"
94
+ link_item "${prefix}${srcdir}/${name}" "$destdir/$name"
95
+ done
96
+ done
97
+
98
+ log "done."
@@ -0,0 +1,43 @@
1
+ ---
2
+ name: update-agents-md
3
+ description: Refactor a project's AGENTS.md (or CLAUDE.md) file to follow progressive disclosure. Use when requested to reorganize workspace instructions, reduce context bloat, group guidelines, or extract essential workflows.
4
+ ---
5
+
6
+ # Update Agents MD
7
+
8
+ Refactor `AGENTS.md` (or `CLAUDE.md`) to follow progressive disclosure principles, ensuring context-window efficiency and clarity.
9
+
10
+ ## Workflow
11
+
12
+ ### 1. Analyze and Identify
13
+
14
+ - Read the existing `AGENTS.md` (or `CLAUDE.md`) file in the workspace root.
15
+ - Find contradictions or overlapping rules/instructions.
16
+ - Flag instructions that are redundant, vague, or overly obvious for deletion (e.g., basic IDE usage, standard Git commands, or generic advice).
17
+ - Identify the core essentials for the root file:
18
+ - A one-line description of the project.
19
+ - The package manager used (e.g., `npm`, `pnpm`, `yarn`, `bun`).
20
+ - Core build, typecheck, lint, and test commands.
21
+ - The 2–3 most critical workflows (e.g., local development, running tests, preparing a release).
22
+
23
+ ### 2. User Alignment
24
+
25
+ - Present all identified contradictions, redundancies, and proposed deletions to the user.
26
+ - Ask the user which conflicting instructions to keep and confirm the items proposed for deletion.
27
+ - **Stop and wait** for explicit user confirmation before proceeding with modifications.
28
+
29
+ ### 3. Extract and Delegate
30
+
31
+ - Group the remaining guidelines and instructions into clear, logical categories (e.g., database, testing, frontend styling, deployment).
32
+ - For each category, create a separate markdown file under a `docs/` folder (e.g., `docs/database-guidelines.md`).
33
+ - For any complex procedural instructions or task-specific workflows (e.g., how to run a custom migration script, how to publish a package), extract them into a local skill under `.agents/skills/<name>/SKILL.md`.
34
+
35
+ ### 4. Construct Minimal Root File
36
+
37
+ - Re-write the root `AGENTS.md` (or `CLAUDE.md`) to be extremely minimal.
38
+ - Structure it to contain:
39
+ 1. A one-line description of the project.
40
+ 2. The package manager and build/typecheck commands.
41
+ 3. The 2–3 most critical workflows formatted as numbered steps.
42
+ 4. A list of links to the category files under `docs/` (e.g., `[Database Guidelines](docs/database.md)`), with a one-line description explaining when to consult each file.
43
+ - Replace verbose inline code snippets in instructions with precise `file:line` links pointing directly to the source code (e.g., `see [main.ts:L45-L60](file:///path/to/main.ts#L45-L60)`).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kurokeita/add-skill",
3
- "version": "1.21.0",
3
+ "version": "2.0.0",
4
4
  "description": "CLI to install AI agent skills to various platforms",
5
5
  "type": "module",
6
6
  "bin": {
@@ -12,7 +12,6 @@
12
12
  ],
13
13
  "scripts": {
14
14
  "dev": "tsx bin/cli.ts",
15
- "update:readme": "tsx scripts/update-readme.ts",
16
15
  "build": "tsc --noEmit && esbuild bin/cli.ts --bundle --platform=node --format=esm --outfile=dist/bin/cli.js --packages=external && tsx scripts/copy-assets.ts",
17
16
  "prepublishOnly": "pnpm run build",
18
17
  "test": "vitest run",
@@ -41,17 +40,15 @@
41
40
  "@clack/prompts": "^1.2.0",
42
41
  "commander": "^14.0.2",
43
42
  "fs-extra": "^11.3.3",
44
- "js-yaml": "^4.1.1",
45
43
  "picocolors": "^1.1.1"
46
44
  },
47
45
  "devDependencies": {
48
46
  "@biomejs/biome": "^2.3.11",
49
47
  "@semantic-release/git": "^10.0.1",
50
48
  "@types/fs-extra": "^11.0.4",
51
- "@types/js-yaml": "^4.0.9",
52
49
  "@types/node": "^25.0.9",
53
50
  "@vitest/coverage-v8": "^4.0.18",
54
- "esbuild": "^0.25.0",
51
+ "esbuild": "^0.28.1",
55
52
  "markdownlint-cli": "^0.47.0",
56
53
  "semantic-release": "^25.0.2",
57
54
  "tsx": "^4.21.0",