Summary
The posttooluse-validate hook's ai-gateway skill includes a validation rule intended to catch model slugs that use hyphens for version numbers (e.g., claude-sonnet-4-6 instead of claude-sonnet-4.6). The rule's regex \d+-\d+[)'"] is too broad and produces false positives on ISO 8601 date literals like 2026-05-16) in unrelated documents.
Reproduction
-
Use Edit/Write on any .md file under a project where the ai-gateway skill is matched (e.g., a doc that mentions Supabase + Vercel AI SDK in nearby content).
-
Include any text containing an ISO date followed by a closing paren, single quote, or double quote. Example:
| 문서 버전 | v2 (2026-05-16) — 마크다운 정본 + 도구 어댑터 framing |
-
Hook blocks with:
VALIDATION (1 error):
- Line N [ERROR]: Model slug uses hyphens — use dots not hyphens for version numbers (e.g., claude-sonnet-4.6)
The 05-16) substring in 2026-05-16) matches \d+-\d+[)'"] and triggers the rule even though the line has nothing to do with a model identifier.
Expected
The rule should fire only on actual model slug contexts (e.g., claude-sonnet-4-6), gpt-4-1), or strings near model: or provider prefixes like anthropic/, openai/, google/).
Actual
Any MM-DD), MM-DD', or MM-DD" pattern fires the rule. This affects any markdown/docs that include dates such as authoring dates, changelogs, or YAML frontmatter dates rendered into text.
Root Cause
skills/ai-gateway/SKILL.md — the validate rule entry:
- pattern: \d+-\d+[)'"]
message: 'Model slug uses hyphens — use dots not hyphens for version numbers (e.g., claude-sonnet-4.6)'
severity: error
The pattern has no boundary anchoring or context requirement, so it matches numeric-hyphen-numeric substrings wherever they appear.
Suggested Fixes (any of)
-
Anchor to model slug context — require a known model family prefix:
pattern: (?:claude|gpt|gemini|llama|mistral|sonnet|opus|haiku|flash|pro)-?\d+-\d+[)'"]
-
Negative lookbehind for digits — prevent matching the inside of larger numeric sequences (e.g., dates have 4-digit year preceding):
pattern: (?<![\d-])\d+-\d+[)'"]
This won't fix 05-16) after 2026- because of the hyphen, but combining with a length check on the left number would: model versions are typically \d{1,2}-\d{1,2}, dates have \d{4}-\d{2}-\d{2}.
-
skipIfMatchContains for date-like context — add a guard:
pattern: \d+-\d+[)'"]
skipIfFileContains: \d{4}-\d{2}-\d{2}
This is coarse — better is per-match guard, but the skill rule schema may not support it yet.
-
Tighten to model assignment context — only fire inside string literals adjacent to model: or provider slashes:
pattern: ['"][\w-]+/[\w-]*\d+-\d+[)'"]
This narrows to actual provider/model slug strings such as 'anthropic/claude-sonnet-4-6'.
Environment
- vercel-plugin version: 0.22.0
- Cache path:
~/.claude/plugins/cache/claude-plugins-official/vercel/0b375ac333f1
- Triggered hook event:
PostToolUse:Edit
- Matched skills (from hook output):
ai-elements, ai-gateway, ai-generation-persistence, ai-sdk
- File that triggered: a Korean-language webfortd KB architecture doc containing the date
2026-05-16) in a metadata table row
Impact
Low severity but blocks Edit/Write until the false-positive line is reformatted. Korean date convention frequently uses ISO format with hyphens, so any documentation/changelog work in repos that match the ai-gateway skill paths hits this. Workaround on user side: use slashes or Korean text format for dates (2026/05/16 or 2026년 5월 16일), but that is an unrelated cost to a documentation author.
Summary
The
posttooluse-validatehook'sai-gatewayskill includes a validation rule intended to catch model slugs that use hyphens for version numbers (e.g.,claude-sonnet-4-6instead ofclaude-sonnet-4.6). The rule's regex\d+-\d+[)'"]is too broad and produces false positives on ISO 8601 date literals like2026-05-16)in unrelated documents.Reproduction
Use Edit/Write on any
.mdfile under a project where theai-gatewayskill is matched (e.g., a doc that mentions Supabase + Vercel AI SDK in nearby content).Include any text containing an ISO date followed by a closing paren, single quote, or double quote. Example:
Hook blocks with:
The
05-16)substring in2026-05-16)matches\d+-\d+[)'"]and triggers the rule even though the line has nothing to do with a model identifier.Expected
The rule should fire only on actual model slug contexts (e.g.,
claude-sonnet-4-6),gpt-4-1), or strings nearmodel:or provider prefixes likeanthropic/,openai/,google/).Actual
Any
MM-DD),MM-DD', orMM-DD"pattern fires the rule. This affects any markdown/docs that include dates such as authoring dates, changelogs, or YAML frontmatter dates rendered into text.Root Cause
skills/ai-gateway/SKILL.md— thevalidaterule entry:The pattern has no boundary anchoring or context requirement, so it matches numeric-hyphen-numeric substrings wherever they appear.
Suggested Fixes (any of)
Anchor to model slug context — require a known model family prefix:
Negative lookbehind for digits — prevent matching the inside of larger numeric sequences (e.g., dates have 4-digit year preceding):
This won't fix
05-16)after2026-because of the hyphen, but combining with a length check on the left number would: model versions are typically\d{1,2}-\d{1,2}, dates have\d{4}-\d{2}-\d{2}.skipIfMatchContainsfor date-like context — add a guard:This is coarse — better is per-match guard, but the skill rule schema may not support it yet.
Tighten to model assignment context — only fire inside string literals adjacent to
model:or provider slashes:This narrows to actual provider/model slug strings such as
'anthropic/claude-sonnet-4-6'.Environment
~/.claude/plugins/cache/claude-plugins-official/vercel/0b375ac333f1PostToolUse:Editai-elements,ai-gateway,ai-generation-persistence,ai-sdk2026-05-16)in a metadata table rowImpact
Low severity but blocks Edit/Write until the false-positive line is reformatted. Korean date convention frequently uses ISO format with hyphens, so any documentation/changelog work in repos that match the ai-gateway skill paths hits this. Workaround on user side: use slashes or Korean text format for dates (
2026/05/16or2026년 5월 16일), but that is an unrelated cost to a documentation author.