The meta-skill that builds and improves all your skills, including itself. Watches your work sessions (autonomous or human-led), captures patterns, corrections and judgement calls, and turns them into skill improvements and new skill candidates for your review. Practical application of the Augmented Expertise methodology. Open source: CC BY 4.0.
Python agent-skillsai-skillsaugmented-expertiseawesome-skillsclaudeclaude-codeclaude-code-skillclaude-code-skillsclaude-coworkclaude-skillsmeta-skillrebelyticsskill-automationskill-builderskill-creationskill-improvementskill-managementskills
Archival sweep: write awk fields as `$ 2` so skill arguments spare them
Eoghan Hennb2e756f95041
diff --git a/SKILL.md b/SKILL.mdindex 06fd90b..976b674 100644--- a/SKILL.md+++ b/SKILL.md@@ -383,8 +383,8 @@ seen=$(cd "$d" && awk 'FNR==1 {n++; nextfile} END {print n+0}' [0-9]*.md 2>/dev/[ "$n_files" -gt 0 ] && [ "${seen:-0}" -eq 0 ] && { echo "ARCHIVAL SWEEP BROKEN — $n_files files present, 0 examined"; exit 1; }( cd "$d" && LC_ALL=C awk -v today="$today" 'FNR==1 {st=""; r=""; sub(/^\357\273\277/, ""); fm=/^---[[:space:]]*$/; if (!fm) nextfile; next}fm && /^---[[:space:]]*$/ {if (st ~ /^(actioned|declined|superseded)$/ && r ~ /^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$/ && r < today) print FILENAME; nextfile}- fm && /^status:/ {st=$2}- fm && /^resolved:/ {r=$2}' [0-9]*.md 2>/dev/null | while IFS= read -r x; do mv -n "$x" archive/ 2>/dev/null; if [ -e "$x" ]; then echo "NOTE: $x not archived — archive/$x exists or the move failed"; fi; done ) # one awk for the set, one mv per stale resolved file, never over an archived one; bash+ fm && /^status:/ {st=$ 2} # spaced on purpose: a skill load with arguments rewrites a digit right after $ (validator warns)+ fm && /^resolved:/ {r=$ 2}' [0-9]*.md 2>/dev/null | while IFS= read -r x; do mv -n "$x" archive/ 2>/dev/null; if [ -e "$x" ]; then echo "NOTE: $x not archived — archive/$x exists or the move failed"; fi; done ) # one awk for the set, one mv per stale resolved file, never over an archived one; bashfloor=$(sed '1!d; s/[^0-9]//g' "$d/archive/.id-floor" 2>/dev/null); floor=$((10#${floor:-0})) # digits only: a CRLF or padded floor still readsids=$(for p in "$d"/[0-9]*.md "$d"/archive/[0-9]*.md; do [ -e "$p" ] && printf '%s\n' "${p##*/}"; done | grep -oE '^[0-9]+') # globs and builtins: no `ls` a profile alias can rebind[ "$(printf '%s' "$ids" | grep -c .)" -eq "$(find "$d" "$d/archive" -maxdepth 1 -name '[0-9]*.md' | wc -l)" ] || { echo "ID COMMAND BROKEN — the listing and find disagree on the prefixed files"; exit 1; }diff --git a/references/skill-authoring.md b/references/skill-authoring.mdindex 75ea145..d539ff5 100644--- a/references/skill-authoring.md+++ b/references/skill-authoring.md@@ -846,7 +846,13 @@ re-check exists, do not record the value — record how to obtain it.fills a whole backtick span, and also one in command position — afteran interpreter (`python3`, `bash`, `node`, `uv run` …) inside an inlinespan or a fenced block, with arguments behind it — while a bare path- quoted as an example with no interpreter stays unchecked; (2) the delivery artefact+ quoted as an example with no interpreter stays unchecked. It also warns+ on every `$` followed by a digit, and on `$ARGUMENTS`, in SKILL.md: a+ loader that passes skill arguments rewrites them in the delivered body+ (the file on disk is unchanged), so an awk field reference there is+ written `$ 2`, and a command that needs `$1` belongs in a script or a+ reference file; a warning, not a failure, because a placeholder can be+ intended; (2) the delivery artefactis the `.skill` bundle — bare file links fail this gate even when allfiles are staged; (3) frontmatter constraints — measure the description(the FOLDED value, not the raw YAML block) and fail the delivery abovediff --git a/scripts/validate-skill-bundle.py b/scripts/validate-skill-bundle.pyindex caf5499..c93e7a8 100644--- a/scripts/validate-skill-bundle.py+++ b/scripts/validate-skill-bundle.py@@ -662,6 +662,9 @@ def check_dir(skill_dir, fails):fails.append(f"description {len(desc)} chars > cap {MAX_DESCRIPTION_CHARS}")elif len(desc) > 900:print(f"warn: description {len(desc)} chars (cap {MAX_DESCRIPTION_CHARS}) — near the boundary")+ for ln, tok in template_tokens(text):+ print(f"warn: SKILL.md:{ln}: {tok!r} is rewritten when the skill is invoked with "+ f"arguments — write an awk field as `$ 2`, or move the text to a reference or script")# Every cited bundled path exists (backticked, real extension — globs in# prose are skipped). Ownership is inferred from the shape of the span, so# the convention has to make the two cases distinguishable: PATH_RE requires@@ -737,6 +740,32 @@ def blank_fenced_code(text, fill=lambda h: re.sub(r"[^\n]", " ", h)):return "".join(out)+# A `$` right before a digit, and `$ARGUMENTS`, are rewritten by Claude+# Code's skill loader when the skill is invoked with arguments: `$0` becomes+# the first argument word, `$2` the third. The file on disk is unchanged, so+# no read of it shows the damage; an awk field reference in SKILL.md then+# runs as `{st=only,}`, a syntax error the snippet's `2>/dev/null` hides.+# `$ 2` (awk allows the space) and `${2}` arrive intact. Reported as a+# warning, never a failure: other skills use `$1` placeholders on purpose,+# and reference files and scripts are read or run as files, not templated.+TEMPLATE_TOKEN_RE = re.compile(r"\$(?:[0-9]|ARGUMENTS\b)")+++def template_tokens(text):+ """[(line, token)] for every loader-substituted token in a SKILL.md."""+ return [(text.count("\n", 0, m.start()) + 1, m.group(0))+ for m in TEMPLATE_TOKEN_RE.finditer(text)]+++# (name, SKILL.md text, tokens template_tokens must report)+TEMPLATE_FIXTURES = [+ ("awk field reference $2 is reported", " fm && /^status:/ {st=$2}\n", [(1, "$2")]),+ ("$0 and $ARGUMENTS in prose are reported", "x\nquote $0 and $ARGUMENTS here\n",+ [(2, "$0"), (2, "$ARGUMENTS")]),+ ("spaced $ 2, ${2}, $NF and $d pass", "{st=$ 2} ${2} $NF \"$d\"\n", []),+]++def command_paths(text):"""Unqualified bundled paths in command position (see CMD_PATH_RE)."""prose = blank_fenced_code(text)@@ -948,6 +977,24 @@ def selftest():ok = index_misses(text) == wantbad += not ok; total += 1print(f"{'ok ' if ok else 'FAIL'} reference index: {name}")+ for name, text, want in TEMPLATE_FIXTURES:+ ok = template_tokens(text) == want+ bad += not ok; total += 1+ print(f"{'ok ' if ok else 'FAIL'} template token: {name}")+ with tempfile.TemporaryDirectory() as td: # a token warns; it never fails the gate+ sk = pathlib.Path(td) / "tok"+ sk.mkdir()+ (sk / "SKILL.md").write_text('---\nname: tok\ndescription: "D."\n---\nawk \'{print $1}\'\n',+ encoding="utf-8")+ import contextlib+ import io+ fails, buf = [], io.StringIO()+ with contextlib.redirect_stdout(buf):+ check_dir(sk, fails)+ ok = not fails and "warn: SKILL.md:5: '$1'" in buf.getvalue()+ bad += not ok; total += 1+ print(f"{'ok ' if ok else 'FAIL'} template token: warns, does not fail the gate"+ + ("" if ok else f" (fails {fails})"))for name, text, want in COMMAND_PATH_FIXTURES:ok = command_paths(text) == wantbad += not ok; total += 1