SuperAPI AI Directory

skill-forge-quiz

General & other

View repository

Updated 10-16 08:39

About this skill

Skill Forge Quiz - Content Generation

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

  1. Import Quiz: Import a quiz from a JSON file.
  2. 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 the A./B./C./D. prefix (the page automatically adds the letter prefix; writing it manually will cause A. 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 with A./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:

  1. Ensure the Dashboard is running:

    • Confirm via port detection that the Node service on skill-forge-base has started (default localhost:3457, subject to ~/.skill-forge/config.json ).
    • If it has not started, start skill-forge-base(calling node scripts/import_quiz.js ...directly is recommended; that script will automatically perform the check and startup).
  2. 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), or advanced (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_web tool 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.
      • Note:
        • When generating JSON, please fill in the corresponding type into the source_type field.
        • 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.
    • 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 question
      • multiple_choice: Multiple-choice question
      • essay: Q&A/short-answer question
      • code: Coding question (supports code highlighting)
  3. Content generation:

    • Based on the confirmed parameters, the Agent uses its own LLM capabilities to generate JSON data that conforms to the quiz_template.json format.
    • Note: In the JSON's questions array, you should set source_typefor each question (such as ai_generated or official_doc)。
  4. 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.
  5. 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:

  1. Ensure the Dashboard is running(same as above).
  2. Format validation: Check whether the file conforms to the structure of quiz_template.json (must include the topic and questions arrays).
  3. 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.db to have been initialized by skill-forge-base .