feat: setup-context7 skill + using-context7 prerequisites pointer

Split context7 concerns into two skills:
- using-context7 (policy, every-time): when to call, how to query well
- setup-context7 (infrastructure, one-time): install plugin, inject API
  key, clean manual MCP entries, with confirmation gates

setup-context7 reuses an existing CONTEXT7_API_KEY by searching, in order:
~/.claude/settings.json → ~/.claude.json (top-level + project-scoped) →
~/.claude/settings.local.json → env. Asks the user only if nothing found.
Cross-platform (paths identical on Win/Linux/macOS; only JSON validator
differs). Phase-2 confirmation gate before any write; per-edit JSON
validation; rollback procedure documented.

using-context7 gets a small Prerequisites section pointing at
setup-context7 when MCP tools are missing.

Bonus fix: scripts/build.sh PS multi-arg bug. Comma-joined -Names didn't
split into [string[]] when build.ps1 was invoked via -File. Now the bash
side loops one PS invocation per skill.

Wiki: extended .wiki/concepts/context7-setup.md with the design rationale
(why split policy from setup) — template for future "X plugin + how to
use X" pairs. index.md and log.md updated.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-28 11:56:22 +03:00
parent 3b02a486b0
commit 9d7d25223c
9 changed files with 232 additions and 6 deletions

View File

@@ -36,14 +36,16 @@ if command -v zip >/dev/null 2>&1; then
done
elif command -v powershell.exe >/dev/null 2>&1; then
# Windows fallback: delegate to build.ps1 (proper ZIP via .NET API).
# PS array binding via -File is fragile (commas don't always split into [string[]]),
# so call build.ps1 once per skill and let the bash loop do the work.
ps1="$SCRIPT_DIR/build.ps1"
ps1_win="$(cygpath -w "$ps1" 2>/dev/null || echo "$ps1")"
if [ "$#" -eq 0 ]; then
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "$(cygpath -w "$ps1" 2>/dev/null || echo "$ps1")"
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "$ps1_win"
else
# PS array via -File: comma-separated, no extra quoting (bash arg becomes one PS token).
joined=$(printf ",%s" "$@")
joined="${joined:1}"
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "$(cygpath -w "$ps1" 2>/dev/null || echo "$ps1")" -Names "$joined"
for name in "$@"; do
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "$ps1_win" -Names "$name"
done
fi
else
echo "error: need either 'zip' (Linux/macOS) or PowerShell (Windows) to build .skill archives" >&2