vale-cli/agent-tools / skills/vocab
vocab
VerifiedAdd project terms to a Vale vocabulary so spell check accepts them, and set up a regional dictionary when the team wants British, Australian, Canadian or American spelling enforced. Use when the user says "vale doesn't know our product name", "stop flagging this word", "we write in British English", "flag American spellings", or spelling alerts are firing on correct terms.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 8.2 KB |
| scripts/dictionary.shexecutable | script | 6.1 KB |
| scripts/import-words.shexecutable | script | 4.6 KB |
scripts/import-words.sh
View on GitHub#!/bin/sh
#
# Turn a word list the project already keeps for another spell checker into
# entries for a Vale vocabulary.
#
# import-words.sh [-a] file...
#
# Reads cspell configuration (JSON or YAML: the `words` list, and
# `cSpell.words` in VS Code settings) and plain word lists, one word per line
# -- .wordlist.txt, .spelling, spelling_wordlist.txt, an aspell personal
# dictionary, a cspell dictionary file. Prints accept.txt entries on stdout;
# it writes nothing itself.
#
# By default it prints only the words Vale's own spell check does not know,
# which is usually a small part of the list: the rest would be clutter in a
# vocabulary. -a prints every word.
#
# Those lists are case-insensitive and a Vale vocabulary is not. An entry
# `kubernetes` would make Vale flag "Kubernetes" as the wrong casing, so an
# all-lowercase word is written as `(?i)kubernetes`, which accepts any casing
# as the original list did. A word that carries capitals is kept as written:
# someone chose that casing, and Vale will hold the docs to it.
#
# POSIX sh and POSIX tools only, plus vale for the default filter.
set -u
all=0
while getopts a opt; do
case "$opt" in
a) all=1 ;;
*) echo "usage: import-words.sh [-a] file..." >&2; exit 2 ;;
esac
done
shift $((OPTIND - 1))
[ $# -gt 0 ] || { echo "usage: import-words.sh [-a] file..." >&2; exit 2; }
work=$(mktemp -d "${TMPDIR:-/tmp}/vale-import.XXXXXX") || exit 2
trap 'rm -rf "$work"' EXIT INT TERM
: >"$work/raw"
for f in "$@"; do
[ -f "$f" ] || { echo "import-words.sh: no such file: $f" >&2; exit 2; }
case "$f" in
*.json | *.jsonc | *.code-workspace)
# The strings inside every "words", "userWords" or "cSpell.words" array.
tr '\n\r' ' ' <"$f" | awk '
{
s = $0
while (match(s, /"(words|userWords|cSpell\.words|cSpell\.userWords)"[ \t]*:[ \t]*\[/)) {
s = substr(s, RSTART + RLENGTH)
end = index(s, "]")
if (end == 0) break
list = substr(s, 1, end - 1)
while (match(list, /"[^"]*"/)) {
print substr(list, RSTART + 1, RLENGTH - 2)
list = substr(list, RSTART + RLENGTH)
}
s = substr(s, end + 1)
}
}' >>"$work/raw"
;;
*.yaml | *.yml)
# The items under a top-level or nested "words:" key.
awk '
/^[ \t]*(words|userWords):[ \t]*$/ { on = 1; next }
on && /^[ \t]*-[ \t]*/ { w = $0; sub(/^[ \t]*-[ \t]*/, "", w); sub(/[ \t]*#.*$/, "", w); gsub(/^["\047]|["\047]$/, "", w); print w; next }
on && /^[ \t]*$/ { next }
{ on = 0 }
' "$f" | tr -d '\r' >>"$work/raw"
;;
*)
# One word per line. Comments, an aspell header, and cspell entries
# that forbid a word (!word) are not words to accept.
tr -d '\r' <"$f" | sed 's/[[:space:]]*#.*$//; s/^[[:space:]]*//; s/[[:space:]]*$//' |
grep -v -E '^(personal_ws-|!|$)' | sed 's/^[*+~]*//; s/[*+]$//' >>"$work/raw"
;;
esac
done
# Keep what a vocabulary can hold as a plain term: letters, digits, and the
# marks that occur inside words. Anything else would be read as a pattern.
grep -E "^[[:alpha:]][[:alnum:]'’.-]*$" "$work/raw" | sort -u >"$work/words"
total=$(grep -c . "$work/words")
[ "$total" -gt 0 ] || { echo "import-words.sh: no words found in: $*" >&2; exit 1; }
if [ "$all" -eq 0 ]; then
command -v vale >/dev/null 2>&1 || { echo "import-words.sh: vale is not on PATH; use -a to skip the filter" >&2; exit 2; }
w=$work
command -v cygpath >/dev/null 2>&1 && w=$(cygpath -m "$work")
mkdir -p "$work/styles"
printf 'StylesPath = %s/styles\nMinAlertLevel = error\n\n[*.txt]\nBasedOnStyles = Vale\n' "$w" >"$work/.vale.ini"
printf '{{range .Files}}{{range .Alerts}}{{.Check}}\t{{.Match}}\n{{end}}{{end}}' >"$work/t.tmpl"
# One word per paragraph, so nothing reads as a repeated word or a sentence.
sed 'G' "$work/words" >"$work/list.txt"
if ! vale --no-global --no-exit --config="$w/.vale.ini" --output="$w/t.tmpl" "$w/list.txt" >"$work/flagged" 2>"$work/err"; then
echo "import-words.sh: vale could not run:" >&2
tail -n 2 "$work/err" >&2
exit 2
fi
tr -d '\r' <"$work/flagged" | awk -F '\t' '$1 == "Vale.Spelling" { print $2 }' | sort -u >"$work/keep"
# A flagged match can be part of an entry ("foo-bar" flags "foo"); keep
# whole entries that contain a flagged word.
awk 'NR == FNR { k[$0] = 1; next } { n = split($0, p, /[^[:alnum:]\047’]+/); for (i = 1; i <= n; i++) if (p[i] in k) { print; next } }' \
"$work/keep" "$work/words" >"$work/out"
else
cp "$work/words" "$work/out"
fi
kept=$(grep -c . "$work/out")
awk '{ if ($0 ~ /[[:upper:]]/) print; else print "(?i)" $0 }' "$work/out"
if [ "$all" -eq 0 ]; then
echo "import-words.sh: $kept of $total words are unknown to Vale and worth accepting; the rest it already knows." >&2
else
echo "import-words.sh: $total words." >&2
fi
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |