@anionzo/skill 1.3.0 → 1.4.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.
package/README.md CHANGED
@@ -126,11 +126,18 @@ bash scripts/sync-platform-files
126
126
 
127
127
  > Available on [npm](https://www.npmjs.com/package/@anionzo/skill) — no authentication required
128
128
 
129
+ ```bash
130
+ # Recommended: one command, no package.json created
131
+ npx @anionzo/skill
132
+ ```
133
+
134
+ Or add as a project dependency (creates package.json):
135
+
129
136
  ```bash
130
137
  npm install @anionzo/skill
131
138
  ```
132
139
 
133
- That's it! Skills are automatically installed into:
140
+ Skills are automatically installed into:
134
141
 
135
142
  - `.opencode/skills/` — for OpenCode
136
143
  - `.claude/skills/` — for Claude Code
package/i18n/README.vi.md CHANGED
@@ -124,11 +124,18 @@ bash scripts/sync-platform-files
124
124
 
125
125
  > Có sẵn trên [npm](https://www.npmjs.com/package/@anionzo/skill) — không cần xác thực
126
126
 
127
+ ```bash
128
+ # Khuyên dùng: một lệnh, không tạo package.json
129
+ npx @anionzo/skill
130
+ ```
131
+
132
+ Hoặc thêm như dependency của project (tạo package.json):
133
+
127
134
  ```bash
128
135
  npm install @anionzo/skill
129
136
  ```
130
137
 
131
- Xong! Skill tự động được cài vào:
138
+ Skill tự động được cài vào:
132
139
 
133
140
  - `.opencode/skills/` — cho OpenCode
134
141
  - `.claude/skills/` — cho Claude Code
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anionzo/skill",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "Personal AI Skill Library — vendor-neutral, multi-agent skill library for AI-powered software engineering",
5
5
  "bin": {
6
6
  "anionzo-skill": "scripts/install-opencode-skills"
@@ -1,11 +1,13 @@
1
1
  #!/usr/bin/env sh
2
2
 
3
- # Install skills into .opencode/skills/ with proper YAML frontmatter
3
+ # Install AI skills into agent-specific directories
4
4
  #
5
- # Auto-runs on npm install (postinstall hook).
6
- # Also supports: .claude/skills/ and .agents/skills/
5
+ # Interactive mode (npx): shows menu to pick platforms
6
+ # Silent mode (postinstall): installs all platforms automatically
7
7
  #
8
- # Manual usage:
8
+ # Usage:
9
+ # npx @anionzo/skill # interactive
10
+ # npm install @anionzo/skill # auto (postinstall)
9
11
  # bash scripts/install-opencode-skills [project-dir]
10
12
 
11
13
  set -eu
@@ -27,6 +29,8 @@ case "$PROJECT" in
27
29
  */node_modules/*) exit 0 ;;
28
30
  esac
29
31
 
32
+ # --- Skill installer ---
33
+
30
34
  install_skills() {
31
35
  target_dir="$1"
32
36
  format_name="$2"
@@ -63,15 +67,160 @@ install_skills() {
63
67
  printf ' %s: %d skills -> %s\n' "$format_name" "$count" "$target_dir"
64
68
  }
65
69
 
66
- printf '\n@anionzo/skill: installing skills...\n'
70
+ # --- Agent instruction file generator ---
71
+
72
+ build_catalog() {
73
+ catalog=""
74
+ for meta in "$ROOT"/skills/*/meta.yaml; do
75
+ [ -f "$meta" ] || continue
76
+ name=$(sed -n 's/^name:[[:space:]]*//p' "$meta" | sed -n '1p')
77
+ summary=$(sed -n 's/^summary:[[:space:]]*//p' "$meta" | sed -n '1p')
78
+ catalog="$catalog$name|$summary
79
+ "
80
+ done
81
+ printf '%s' "$catalog"
82
+ }
83
+
84
+ write_agent_file() {
85
+ title=$1
86
+ target=$2
87
+ catalog=$3
88
+
89
+ {
90
+ printf '<!-- Generated by @anionzo/skill -->\n'
91
+ printf '# %s\n\n' "$title"
92
+ printf 'Start with `skills/using-skills/SKILL.md` when the task shape is unclear. Use one primary skill at a time, then pull in the smallest amount of supporting knowledge needed.\n\n'
93
+
94
+ printf '## Core Files\n\n'
95
+ printf -- '- `skills/using-skills/SKILL.md`\n'
96
+ printf -- '- `knowledge/global/engineering-principles.md`\n'
97
+ printf -- '- `knowledge/global/review-heuristics.md`\n'
98
+ printf -- '- `knowledge/global/debugging-patterns.md`\n'
99
+ printf -- '- `knowledge/global/evidence-before-claims.md`\n'
100
+ printf -- '- `knowledge/global/skill-triggering-rules.md`\n'
101
+ printf -- '- `docs/skill-spec.md`\n\n'
102
+
103
+ printf '## Working Rules\n\n'
104
+ printf -- '- Prefer the smallest correct change.\n'
105
+ printf -- '- Read the repo and nearby patterns before editing.\n'
106
+ printf -- '- Ask only the shortest blocking question when a decision is missing.\n'
107
+ printf -- '- Verify important claims with code, tests, or commands when possible.\n'
108
+ printf -- '- Keep summaries concise and grounded in files you inspected.\n\n'
109
+
110
+ printf '## Skill Catalog\n\n'
111
+ printf '%s' "$catalog" | while IFS='|' read -r name summary; do
112
+ [ -n "$name" ] || continue
113
+ printf -- '- `%s`: %s\n' "$name" "$summary"
114
+ done
115
+
116
+ printf '\n## Suggested Flow\n\n'
117
+ printf '1. Route with `using-skills` when unsure.\n'
118
+ printf '2. Load one primary skill that matches the current task.\n'
119
+ printf '3. Pull in `knowledge/project/` notes when working inside a real project.\n'
120
+ printf '4. Verify the outcome before declaring the work complete.\n'
121
+ } > "$target"
122
+ }
123
+
124
+ # --- Platform definitions ---
125
+
126
+ # Each platform: skill_dir | agent_file | agent_title | display_name
127
+ PLATFORMS="
128
+ opencode|.opencode/skills|OPENCODE.md|OpenCode Instructions|OpenCode
129
+ claude|.claude/skills|CLAUDE.md|Claude Code Instructions|Claude Code
130
+ agents|.agents/skills|AGENTS.md|Generic Agent Instructions|Agents (generic)
131
+ gemini||GEMINI.md|Gemini Instructions|Gemini CLI
132
+ copilot||.github/copilot-instructions.md|GitHub Copilot Instructions|GitHub Copilot
133
+ "
134
+
135
+ # --- Interactive mode detection ---
136
+
137
+ is_interactive() {
138
+ # postinstall (npm) sets INIT_CWD — skip interactive
139
+ [ -z "${INIT_CWD:-}" ] && [ -t 0 ]
140
+ }
141
+
142
+ # --- Main ---
143
+
144
+ printf '\n'
145
+ printf ' @anionzo/skill — AI Skill Library\n'
146
+ printf ' ==================================\n\n'
147
+
148
+ if is_interactive; then
149
+ # --- Interactive: let user pick platforms ---
150
+
151
+ printf ' Which platforms do you want to install?\n\n'
152
+ printf ' [1] OpenCode (.opencode/skills/ + OPENCODE.md)\n'
153
+ printf ' [2] Claude Code (.claude/skills/ + CLAUDE.md)\n'
154
+ printf ' [3] Agents (generic)(.agents/skills/ + AGENTS.md)\n'
155
+ printf ' [4] Gemini CLI (GEMINI.md)\n'
156
+ printf ' [5] GitHub Copilot (.github/copilot-instructions.md)\n'
157
+ printf ' [a] All of the above\n\n'
158
+
159
+ printf ' Enter choices (e.g. 1 2 3, or a for all): '
160
+ read -r choices
161
+
162
+ # Normalize
163
+ case "$choices" in
164
+ *[aA]*) choices="1 2 3 4 5" ;;
165
+ esac
166
+
167
+ # Parse choices into flags
168
+ do_opencode=0; do_claude=0; do_agents=0; do_gemini=0; do_copilot=0
169
+
170
+ for c in $choices; do
171
+ case "$c" in
172
+ 1) do_opencode=1 ;;
173
+ 2) do_claude=1 ;;
174
+ 3) do_agents=1 ;;
175
+ 4) do_gemini=1 ;;
176
+ 5) do_copilot=1 ;;
177
+ esac
178
+ done
179
+
180
+ # Check if anything was selected
181
+ total=$((do_opencode + do_claude + do_agents + do_gemini + do_copilot))
182
+ if [ "$total" -eq 0 ]; then
183
+ printf '\n Nothing selected. Exiting.\n\n'
184
+ exit 0
185
+ fi
186
+
187
+ catalog=$(build_catalog)
188
+
189
+ printf '\n Installing...\n\n'
190
+
191
+ if [ "$do_opencode" -eq 1 ]; then
192
+ install_skills "$PROJECT/.opencode/skills" "OpenCode"
193
+ write_agent_file "OpenCode Instructions" "$PROJECT/OPENCODE.md" "$catalog"
194
+ printf ' -> OPENCODE.md\n'
195
+ fi
196
+ if [ "$do_claude" -eq 1 ]; then
197
+ install_skills "$PROJECT/.claude/skills" "Claude"
198
+ write_agent_file "Claude Code Instructions" "$PROJECT/CLAUDE.md" "$catalog"
199
+ printf ' -> CLAUDE.md\n'
200
+ fi
201
+ if [ "$do_agents" -eq 1 ]; then
202
+ install_skills "$PROJECT/.agents/skills" "Agents"
203
+ write_agent_file "Generic Agent Instructions" "$PROJECT/AGENTS.md" "$catalog"
204
+ printf ' -> AGENTS.md\n'
205
+ fi
206
+ if [ "$do_gemini" -eq 1 ]; then
207
+ write_agent_file "Gemini Instructions" "$PROJECT/GEMINI.md" "$catalog"
208
+ printf ' -> GEMINI.md\n'
209
+ fi
210
+ if [ "$do_copilot" -eq 1 ]; then
211
+ mkdir -p "$PROJECT/.github"
212
+ write_agent_file "GitHub Copilot Instructions" "$PROJECT/.github/copilot-instructions.md" "$catalog"
213
+ printf ' -> .github/copilot-instructions.md\n'
214
+ fi
67
215
 
68
- # OpenCode: .opencode/skills/
69
- install_skills "$PROJECT/.opencode/skills" "OpenCode"
216
+ else
217
+ # --- Silent mode: postinstall — install all skill dirs, no agent files ---
70
218
 
71
- # Claude Code: .claude/skills/
72
- install_skills "$PROJECT/.claude/skills" "Claude"
219
+ printf ' Installing skills (postinstall)...\n\n'
73
220
 
74
- # Generic agents: .agents/skills/
75
- install_skills "$PROJECT/.agents/skills" "Agents"
221
+ install_skills "$PROJECT/.opencode/skills" "OpenCode"
222
+ install_skills "$PROJECT/.claude/skills" "Claude"
223
+ install_skills "$PROJECT/.agents/skills" "Agents"
224
+ fi
76
225
 
77
- printf '\nDone! Skills are ready. Use /skill in OpenCode or Claude Code.\n\n'
226
+ printf '\n Done! Use /skill in your agent to see available skills.\n\n'