This Skill provides a tool for the Skill Forge system to generate quiz content . It writes directly to the shared database, but does not manage the runtime environment.
Core Capabilities
- Import Quiz: Import a quiz from a JSON file.
- Generate Quiz: (planned) AI-driven quiz generation.
Usage Instructions
1. Import a Quiz
Import a quiz from a JSON file:
# 标准导入
node scripts/import_quiz.js <JSON文件路径>
Example
node scripts/import_quiz.js ./quiz_template.json
> 说明:`import_quiz.js` 会先检查 `skill-forge-base` 的 Dashboard 服务是否已启动;若未启动会自动启动(并等待端口就绪),然后再执行导入。
### JSON 模板格式
参考项目中的 `quiz_template.json` 文件:
```json
{
"topic": "主题名称",
"topic_detail": "详细描述(可选)",
"difficulty": "beginner|intermediate|advanced",
"questions": [
{
"content": "题目内容",
"type": "choice|essay|code",
"options": ["选项1", "选项2"],
"correct_answer": "正确答案",
"explanation": "解析",
"knowledge_points": ["知识点1"],
"score": 10
}
]
}
Mathematical Formulas (LaTeX Specification)
When a question/explanation contains a mathematical expression (e.g. f(x)=e^{3x}, limits, integrals, matrices, etc.),LaTeX syntax must be used, and it must be placed within renderable delimiters(otherwise the page will display it as plain text).
Specification (must be followed):
- Mathematical expressions must be placed within
$...$(inline) or$$...$$(display formula). - Any expression of the form
\\lim_{...}、e^{...}、x_{...}、\\frac{...}{...}, if not within$...$/$$...$$, will be displayed as plain text (it cannot be rendered as mathematical symbols). - For single-choice/multiple-choice options,
options[]it is forbiddento manually write theA./B./C./D.prefix (the page automatically adds the letter prefix; writing it manually will causeA. A. ...)。
Correct Way to Write (copying directly is recommended):
- Inline formula: use
$...$, for example:如果 $f(x)=e^{3x}$,求 $f'(x)$。 - Display formula: use
$$...$$(suitable for longer derivations or multi-line formulas)
Common writing examples:
- Limit:
$\\lim_{x\\to a} f(x) = L$ - Fraction:
$\\frac{a}{b}$ - Subscript/superscript:
$x_{n+1}$、$e^{3x}$
Notes:
- When generating JSON, LaTeX is still an ordinary string; escape backslashes if necessary (e.g.
\\frac{a}{b})。 - Only LaTeX wrapped by delimiters will be rendered: for example,
lim_{x->a}will not render; it must be written as$\\lim_{x\\to a}$or$$\\lim_{x\\to a}$$。 - Do not output "plain text that looks like a formula"; wrap formula parts with
$...$as much as possible.
Self-check before submission (must be checked item by item before outputting JSON):
- Do fragments such as
lim_{/e^{/x_{/\\frac{appear without being wrapped by$...$? options[]Does it contain any option starting withA./B./C./D.?- Are formulas and ordinary text mixed together in a way that prevents KaTeX from parsing them (when unsure, put the formula parts separately within
$...$)?
Interaction Flow Specification
1. Quiz Generation Flow
When the user requests "generate a quiz" or "create a quiz," the Agent must follow this flow:
-
Ensure the Dashboard is running:
- Confirm via port detection that the Node service on
skill-forge-basehas started (defaultlocalhost:3457, subject to~/.skill-forge/config.json). - If it has not started, start
skill-forge-base(callingnode scripts/import_quiz.js ...directly is recommended; that script will automatically perform the check and startup).
- Confirm via port detection that the Node service on
-
Parameter Confirmation: proactively ask about and confirm the following 4 key parameters:
- Topic: The core knowledge points or tech stack of the quiz (e.g., React Hooks, HTTP protocol).
- Difficulty (Difficulty):
beginner(Beginner),intermediate(Intermediate), oradvanced(Advanced). - Question Count (Question Count): 5-20 questions recommended.
- Question Source (Source): Clarify the source of the content:
- Pure AI-generated: (
ai_generated) Fully generated by the model based on the knowledge base. - User-provided: (
manual) Based on documents or text provided by the user. - Web search: The Agent uses the
search_webtool to search for relevant materials, which can be further divided into:- Official documentation (
official_doc): Technical official websites, specification documents. - Community discussions (
community): StackOverflow, GitHub, tech blogs. - Real interview questions (
interview): LeetCode, Nowcoder, interview experience websites. - Exam question bank (
exam): Certification exams, academic test questions. - Exam question bank (
exam): Certification exams, academic test questions.
- Official documentation (
- Note:
- When generating JSON, please fill in the corresponding type into the
source_typefield. - If using Brave Search, be sure to leave an interval of 1 second or more between two searches to avoid the 429 Too Many Requests error.
- When generating JSON, please fill in the corresponding type into the
- Pure AI-generated: (
- Question Type Distribution (Distribution): Ask the user for the desired question type distribution (e.g., "all single-choice" or "half single-choice, half coding questions"). Supported question types include:
choice: Single-choice questionmultiple_choice: Multiple-choice questionessay: Q&A/short-answer questioncode: Coding question (supports code highlighting)
-
Content generation:
- Based on the confirmed parameters, the Agent uses its own LLM capabilities to generate JSON data that conforms to the
quiz_template.jsonformat. - Note: In the JSON's
questionsarray, you should setsource_typefor each question (such asai_generatedorofficial_doc)。
- Based on the confirmed parameters, the Agent uses its own LLM capabilities to generate JSON data that conforms to the
-
Writing and importing:
- Save the generated JSON as a temporary file (e.g.,
temp_quiz_<timestamp>.json)。 - Use
node scripts/import_quiz.js <temp_file>to import into the database. - After successful import,mustdelete the temporary file.
- Save the generated JSON as a temporary file (e.g.,
-
Feedback:
- Inform the user that the import was successful.
- Provide the Dashboard access link (usually
http://localhost:3457) so the user can start the quiz.
2. Quiz paper import process
When the user provides an existing JSON file for import:
- Ensure the Dashboard is running(same as above).
- Format validation: Check whether the file conforms to the structure of
quiz_template.json(must include thetopicandquestionsarrays). - Execute import: Run directly
node scripts/import_quiz.js <filepath>。
Common commands
- Import exam paper:
node scripts/import_quiz.js <path_to_json> - View help:
node scripts/import_quiz.js --help
Dependencies
- Node.js: >= 14.0.0
- SQLite3: Database access
- Prerequisites: Requires
~/.skill-forge/skill-forge.dbto have been initialized byskill-forge-base.