Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"projectId": "hidden-boat-27453346"
}
1 change: 1 addition & 0 deletions apps/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"cors": "^2.8.5",
"dotenv": "^16.4.5",
"express": "^4.19.2",
"openai": "^6.45.0",
"pino": "^8.20.0",
"pino-pretty": "^11.0.0",
"prisma": "^5.12.1",
Expand Down
22 changes: 22 additions & 0 deletions apps/api/src/prompts/v1/code_generation.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
You are a senior software engineer. Generate a production-grade solution for the following problem.

Problem: {problem_description}

Language: {language}
Difficulty: {difficulty}

Requirements:
- Write clean, well-commented code
- Handle edge cases (empty input, invalid values, boundary conditions)
- Follow {language} best practices and conventions
- Include type hints / type annotations where applicable
- Optimize for readability and maintainability
- DO NOT include any explanation or introductory text — return ONLY the code
- Return the code inside a single markdown code block with the language identifier

Example output format:
```python
def solution(input_data):
# implementation
pass
```
24 changes: 24 additions & 0 deletions apps/api/src/prompts/v1/defend_evaluation.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
You are evaluating a developer's answer in a Defend session. Determine whether their response demonstrates genuine understanding of their code.

Question asked: {question}
Developer's answer: {answer}

Full code context:
{code}

Evaluate on these criteria:
1. Accuracy — Is the answer technically correct?
2. Depth — Does it show understanding beyond surface level?
3. Specificity — Does it reference specific lines, variables, or decisions in the code?
4. Confidence — Does the answer sound certain or guess-like?

Return ONLY a JSON object with no additional text:
{{
"passed": true,
"feedback": "Constructive feedback explaining what was right and what could be improved.",
"score": 85
}}

- passed: true if score >= 60, false otherwise
- feedback: 1-3 sentences with specific, actionable feedback referencing their answer
- score: 0-100 integer reflecting overall understanding
22 changes: 22 additions & 0 deletions apps/api/src/prompts/v1/defend_question.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
You are conducting a Socratic interview about a developer's code submission. The developer has rebuilt a solution from memory during a Defend session. Ask them a probing question to test whether they truly understand the code's design decisions.

Original problem: {problem_description}

Developer's submitted code:
{code}

Conversation so far:
{messages}

Ask ONE probing question that:
- Challenges a specific design choice in their code (data structure, algorithm, pattern)
- Tests understanding of time or space complexity tradeoffs
- Probes error handling or edge cases they may have missed
- Asks WHY they chose one approach over an alternative
- Pushes them to think about scalability or real-world implications

Rules:
- Do NOT ask yes/no questions — require a substantive answer
- Do NOT ask about obvious syntax — ask about design reasoning
- Do NOT repeat a question already asked (check conversation history)
- Return ONLY the question text, no explanations or prefixes
31 changes: 31 additions & 0 deletions apps/api/src/prompts/v1/quiz_generation.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
You are a technical quiz generator. You are given a piece of code and optional annotations explaining parts of it. Generate {count} multiple-choice questions that test deep understanding of the code.

Code:
{code}

Annotations (student's explanations of code sections):
{annotations}

Instructions for each question:
1. Focus on understanding WHY the code works, not just WHAT it does
2. Include exactly 4 options labeled A through D
3. Exactly one option must be correct
4. Include at least one distractor that reflects a common misconception
5. Vary difficulty — some surface-level, some requiring deep reasoning
6. Each question should have a brief explanation of why the correct answer is right

Return ONLY a valid JSON object with no additional text. Use this exact format:
{{
"title": "Comprehension Check: {topic}",
"questions": [
{{
"id": "q-1",
"question": "Why does the code do X on line Y?",
"options": ["Option A text", "Option B text", "Option C text", "Option D text"],
"correct_option": 0,
"explanation": "Brief explanation of why A is correct."
}}
]
}}

Generate exactly {count} questions.
Loading