refactor: flatten skill structure, remove .claude nesting

- Move files from exam/.claude/skills/exam/ to exam/
- Update path references in SKILL.md
- Fix schema path resolution in validate scripts (1 level up instead of 3)
This commit is contained in:
2026-09-02 20:49:29 +08:00
parent dab71b815c
commit 9e262abb23
3 changed files with 9 additions and 9 deletions
@@ -21,8 +21,8 @@ examination/
│ ├── meta.json # 子主题元信息 │ ├── meta.json # 子主题元信息
│ ├── fill_blank.json # 填空题 │ ├── fill_blank.json # 填空题
│ └── single_choice.json # 单选题 │ └── single_choice.json # 单选题
└── .claude/skills/exam/ └── exam/ # 本 skill 目录
├── SKILL.md # 本文件 ├── SKILL.md
├── validate.py # Python 校验脚本 ├── validate.py # Python 校验脚本
└── validate.mjs # Node.js 校验脚本 └── validate.mjs # Node.js 校验脚本
``` ```
@@ -73,10 +73,10 @@ ENDJSON
```bash ```bash
# Python (优先) # Python (优先)
python3 .claude/skills/exam/validate.py /tmp/exam_gen.json python3 exam/validate.py /tmp/exam_gen.json
# Node.js (备选) # Node.js (备选)
node .claude/skills/exam/validate.mjs /tmp/exam_gen.json node exam/validate.mjs /tmp/exam_gen.json
``` ```
- 校验通过 → 继续写入 - 校验通过 → 继续写入
@@ -115,8 +115,8 @@ node .claude/skills/exam/validate.mjs /tmp/exam_gen.json
两个脚本功能相同,检测可用环境后选用: 两个脚本功能相同,检测可用环境后选用:
- `.claude/skills/exam/validate.py` — 优先用 `jsonschema`,不可用时回退到基础校验 - `exam/validate.py` — 优先用 `jsonschema`,不可用时回退到基础校验
- `.claude/skills/exam/validate.mjs` — 纯 Node.js 内置模块,无外部依赖 - `exam/validate.mjs` — 纯 Node.js 内置模块,无外部依赖
退出码:0=通过,1=有错误,2=用法错误。 退出码:0=通过,1=有错误,2=用法错误。
@@ -15,7 +15,7 @@ import { fileURLToPath } from "node:url";
import { createRequire } from "node:module"; import { createRequire } from "node:module";
const __dirname = dirname(fileURLToPath(import.meta.url)); const __dirname = dirname(fileURLToPath(import.meta.url));
const REPO_ROOT = resolve(__dirname, "../../.."); const REPO_ROOT = resolve(__dirname, "..");
const SCHEMA_PATH = resolve(REPO_ROOT, "schema/question.schema.json"); const SCHEMA_PATH = resolve(REPO_ROOT, "schema/question.schema.json");
function loadJson(path) { function loadJson(path) {
@@ -11,9 +11,9 @@ import json
import sys import sys
from pathlib import Path from pathlib import Path
# Resolve schema path relative to repo root (3 levels up from this script) # Resolve schema path relative to repo root (1 level up from this script)
SCRIPT_DIR = Path(__file__).resolve().parent SCRIPT_DIR = Path(__file__).resolve().parent
REPO_ROOT = SCRIPT_DIR.parent.parent.parent REPO_ROOT = SCRIPT_DIR.parent
SCHEMA_PATH = REPO_ROOT / "schema" / "question.schema.json" SCHEMA_PATH = REPO_ROOT / "schema" / "question.schema.json"