Systems Library / Operations & Admin / How to Build an AI Interview Question Generator
Operations & Admin hr people

How to Build an AI Interview Question Generator

Generate role-specific interview questions using AI analysis of the job description.

Jay Banlasan

Jay Banlasan

The AI Systems Guy

Generic interview questions get generic answers. I built an ai interview question generator that reads the job description, understands the role requirements, and produces targeted questions that actually reveal whether someone can do the work. Role-specific questions surface real skills.

This system generates behavioral, technical, and situational questions calibrated to what the role demands.

What You Need Before Starting

Step 1: Define Question Categories

QUESTION_CATEGORIES = {
    "behavioral": {
        "description": "Past behavior predicts future performance",
        "count": 5,
        "format": "Tell me about a time when..."
    },
    "technical": {
        "description": "Role-specific knowledge and skills",
        "count": 5,
        "format": "Direct technical questions"
    },
    "situational": {
        "description": "Hypothetical scenarios the role will face",
        "count": 3,
        "format": "What would you do if..."
    },
    "culture": {
        "description": "Values and working style alignment",
        "count": 2,
        "format": "Open-ended preference questions"
    }
}

Step 2: Generate Questions from the Job Description

import anthropic
import json

client = anthropic.Anthropic()

def generate_interview_questions(job_description, categories):
    prompt = f"""Generate interview questions for this role. Each question should
reveal something specific about the candidate's ability to succeed.

Job Description:
{job_description}

Generate questions in these categories:
{json.dumps(categories, indent=2)}

For each question, include:
- The question itself
- What the question reveals (what good and bad answers look like)
- A follow-up probe question

Return as JSON with category keys."""

    message = client.messages.create(
        model="claude-sonnet-4-20250514",
        max_tokens=3000,
        messages=[{"role": "user", "content": prompt}]
    )
    return json.loads(message.content[0].text)

Step 3: Build a Scoring Rubric

def generate_rubric(questions_data):
    rubric = {}
    for category, questions in questions_data.items():
        rubric[category] = []
        for q in questions:
            rubric[category].append({
                "question": q["question"],
                "strong_answer_signals": q.get("good_answer", ""),
                "weak_answer_signals": q.get("bad_answer", ""),
                "score_range": "1-5",
                "weight": 2 if category == "technical" else 1
            })
    return rubric

Step 4: Format the Interview Guide

def format_interview_guide(questions_data, rubric):
    guide = "# Interview Guide\n\n"
    guide += "## Instructions\n"
    guide += "Score each answer 1-5. Take notes on specific examples given.\n\n"

    for category, questions in questions_data.items():
        guide += f"## {category.title()} Questions\n\n"
        for i, q in enumerate(questions, 1):
            guide += f"### {i}. {q['question']}\n"
            guide += f"**Look for:** {q.get('good_answer', 'N/A')}\n"
            guide += f"**Follow-up:** {q.get('follow_up', 'N/A')}\n"
            guide += f"**Score:** ___ / 5\n\n"

    return guide

Step 5: Adapt for Different Interview Rounds

def generate_round_specific(job_description, round_type):
    round_configs = {
        "phone_screen": "Brief questions to verify basic qualifications. 15 minutes.",
        "technical": "Deep technical assessment. Coding or problem-solving focus. 45 minutes.",
        "hiring_manager": "Role fit, team dynamics, growth potential. 30 minutes.",
        "culture": "Values alignment and working style. 20 minutes."
    }

    config = round_configs.get(round_type, "General interview. 30 minutes.")

    prompt = f"""Generate interview questions for a {round_type} round.
Context: {config}
Job: {job_description[:1000]}
Return 5 questions with scoring criteria as JSON."""

    message = client.messages.create(
        model="claude-sonnet-4-20250514",
        max_tokens=2048,
        messages=[{"role": "user", "content": prompt}]
    )
    return json.loads(message.content[0].text)

What to Build Next

Add candidate comparison. After all interviews, feed the scores into a ranking system that weights categories by what matters most for the role. The questions are the input. The hiring decision framework is the real system.

Related Reading

Want this system built for your business?

Get a free assessment. We will map every system your business needs and show you the ROI.

Get Your Free Assessment

Related Systems