check
/check - 框架规范检查:对照 CLAUDE.md「绝对禁止的写法」「强制使用框架封装」「Astro 7 版本红线」逐项 grep 核对 参数:[目录 | 文件 | --staged] [--fix] (Claude Code 斜杠命令的 Codex 版:用户输入…
от bkywksj★ 55 звёзд на GitHub
Установить check в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
/check - 框架规范检查
作为代码规范检查助手,逐项核对代码是否符合 next-ai-astro 规范。它是 /dev、/collection、/dev-loop 两段 review 的第二段。
本命令做静态检查(读代码、grep)。构建产物层面的 SEO 字段(每页 canonical、描述去重、图片 alt / 宽高、JSON-LD 可解析)由
pnpm check:seo负责;本轮还没跑过验证门时,末尾补跑pnpm verify。
🎯 检查范围
| 用法 | 范围 |
|---|---|
/check |
全量:src/、scripts/sync/sources/、tests/ |
/check src/pages/videos |
指定目录 |
/check src/lib/videos.ts |
指定文件 |
/check --staged |
只查已暂存文件(git diff --cached --name-only),提交前用 |
追加 --fix |
自动修复可机械修复的项(见文末),其余只报告 |
下文命令里的 src 按范围替换成目标目录 / 文件。🔴 grep 一律限定目录与 --include,不要扫 node_modules / dist / .astro。
📋 检查清单总览
| # | 检查项 | 级别 |
|---|---|---|
| 1 | 页面未经 BaseLayout / 手写 <html> <head> |
🔴 严重 |
| 2 | 手写 canonical / og:url | 🔴 严重 |
| 3 | JSON-LD 用 JSON.stringify 直接进 set:html |
🔴 严重 |
| 4 | Astro 7 版本红线旧写法 | 🔴 严重 |
| 5 | island 里取数(getCollection / getImage / astro:*) |
🔴 严重 |
| 6 | 站内链接缺结尾斜杠 | 🔴 严重 |
| 7 | 域名硬编码在 site.config.ts 之外 |
🔴 严重 |
| 8 | 数据源绕过运行器直接写文件 | 🔴 严重 |
| 9 | 文件编码 BOM | 🔴 严重 |
| 10 | 原始色 / 十六进制颜色硬编码 | 🟡 警告 |
| 11 | 品牌色直接做文字(text-brand) |
🟡 警告 |
| 12 | 页面直接 getCollection(未走 src/lib 封装) |
🟡 警告 |
| 13 | 绕过 Container / Button 等封装 |
🟡 警告 |
| 14 | 日期 / 数字各自格式化 | 🟡 警告 |
| 15 | 非 lucide 图标库 / 内联 SVG 图标 | 🟡 警告 |
| 16 | target="_blank" 缺 rel="noopener" |
🟡 警告 |
| 17 | 中文标题 text-balance |
🟡 警告 |
| 18 | 引入 webfont | 🟡 警告 |
| 19 | 改动了框架核心文件 | 🟡 警告 |
| 20 | 水合指令不当(client:only / 能延迟却用 client:load) |
🟢 建议 |
| 21 | 缺文件首行注释 | 🟢 建议 |
| 22 | 技能 / hook 一致性(框架维护) | 🟢 建议 |
🔍 检查详情
1. 页面骨架 [🔴]
# 没有引入 BaseLayout 的页面(*.txt.ts 等端点不在此列)
grep -rL "BaseLayout" src/pages --include=*.astro
# 手写 <html> / <head>(只允许 BaseLayout 里有;最后一段排除注释行,避免「放在 <head> 里」这类说明误报)
grep -rnE "<(html|head)[ >]" src --include=*.astro --include=*.tsx | grep -v "src/layouts/BaseLayout.astro" | grep -vE '^[^:]+:[0-9]+:\s*(//|/?\*|<!--)'
- ❌ 页面自己写
<html><head><title>… - ✅
<BaseLayout title=… description=… jsonLd={[…]}>
2. 手写 canonical / og:url [🔴]
grep -rnE 'rel="canonical"|property="og:url"' src --include=*.astro --include=*.tsx --include=*.ts | grep -v "src/components/seo/SEOHead.astro"
- ❌ 页面再写一份 canonical(写死成
site.url会让全站指向首页;多写一份会出现两个 og:url) - ✅ 只由
SEOHead按当前页路径输出
3. JSON-LD 序列化 [🔴]
grep -rnE "set:html=\{JSON\.stringify" src --include=*.astro
- ❌
set:html={JSON.stringify(data)}(数据里出现</script>会提前闭合标签) - ✅ 经
BaseLayout的jsonLd传入,或serializeJsonLd(data)
4. Astro 7 版本红线 [🔴]
ls src/content/config.ts 2>/dev/null # 应不存在,只能是 src/content.config.ts
grep -rnE "import \{[^}]*\bz\b[^}]*\} from ['\"]astro:content['\"]" src # z 必须从 'astro/zod' 导入
grep -rnE "type: ['\"](content|data)['\"]" src/content.config.ts # 旧集合写法
grep -rnE "Astro\.glob|getEntryBySlug|getDataEntryById|ViewTransitions" src
grep -rnE "\.render\(\)" src --include=*.astro --include=*.ts # entry.render() → render(entry)
grep -rnE "z\.string\(\)\.(email|url|uuid)\(\)" src # Zod 3 → z.email() / z.url() / z.uuid()
grep -rnE "\.slug\b" src --include=*.astro --include=*.ts # 集合条目用 .id(命中需人工确认是否是条目对象)
grep -rnE "\bbabel\b" astro.config.ts # @astrojs/react v7 已移除 babel 选项
ls src/fetch.ts 2>/dev/null # Astro 7 保留文件名,不能放业务代码
对照 CLAUDE.md「Astro 7 版本红线」表格修正;拿不准查 context7(/withastro/docs)。
5. island 里取数 [🔴]
grep -rnE "getCollection\(|getEntry\(|getImage\(|from ['\"]astro:(content|assets)['\"]" src/components --include=*.tsx
- ❌ React 组件里
getImage()/getCollection()(getImage在客户端直接抛错;取数应在构建期完成) - ✅ 页面 frontmatter 里算好(如
toCardData()+resolveCover()),当 props 传给 island
6. 站内链接缺结尾斜杠 [🔴]
# 字面量链接:/works 而非 /works/(不含扩展名、不含查询串)
grep -rnE 'href="/[A-Za-z0-9/_-]*[A-Za-z0-9_-]"' src --include=*.astro --include=*.tsx
# 对象字面量里的路径:导航 href、面包屑 path(.astro 的 frontmatter 也要查)
grep -rnE "(href|path): ?['\"]/[A-Za-z0-9/_-]*[A-Za-z0-9_-]['\"]" src --include=*.astro --include=*.ts --include=*.tsx
# 模板字符串链接(结尾不是 /;带 ? 查询串的属正常,已排除)
grep -rnE 'href=\{`/[^`]*[^/`]`\}' src --include=*.astro --include=*.tsx | grep -v '?'
- ❌
href="/works"、href={`/works/${id}`}、{ name: '全部作品', path: '/works' } - ✅
href="/works/"、href={workPath(id)}(路径函数统一补斜杠) - 构建后
pnpm check:seo还会扫dist/里所有站内<a href>,缺斜杠与死链都会报错,两层互补
7. 域名硬编码 [🔴]
# 列出 site.config.ts 之外出现的所有绝对地址的域名部分(任意顶级域名,带不带路径都算)
grep -rnoE "https?://[a-z0-9.-]+\.[a-z]{2,}" src --include=*.astro --include=*.tsx --include=*.ts | grep -v "src/site.config.ts" | grep -vE "schema\.org|w3\.org"
命中后逐条判断:本站域名或 example.com → 改用 site.url / absoluteUrl();第三方外链(统计脚本 hm.baidu.com、备案链接 beian.miit.gov.cn、注释里的规范链接如 llmstxt.org)属正常,报告里标「已核对」即可。
8. 数据源绕过运行器 [🔴]
grep -rnE "writeFileSync|writeFile\(|fs\.write" scripts/sync/sources
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл check?
/check - 框架规范检查:对照 CLAUDE.md「绝对禁止的写法」「强制使用框架封装」「Astro 7 版本红线」逐项 grep 核对 参数:[目录 | 文件 | --staged] [--fix] (Claude Code 斜杠命令的 Codex 版:用户输入 /check,或描述同类意图时,按本文流程执行。) 触发词:/check、check
Как установить скилл check?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл check запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…