An advanced prompt system designed to help students debug Python code through guided learning rather than direct solution provision. This system employs educational psychology principles and adaptive AI techniques to create an effective learning experience.
python-debugging-assistant/
βββ README.md # This file
βββ prompts/
β βββ core_prompt.txt # Main debugging assistant prompt
β βββ beginner_variant.txt # Specialized for beginners
β βββ advanced_variant.txt # Specialized for advanced users
β βββ examples/ # Example interactions
βββ documentation/
β βββ design_rationale.md # Detailed design decisions
β βββ implementation_guide.md # Technical implementation
β βββ testing_framework.md # Testing and validation
βββ tests/
β βββ sample_buggy_code/ # Test cases with buggy code
β βββ expected_responses/ # Expected AI responses
β βββ evaluation_metrics.py # Testing framework
βββ examples/
β βββ beginner_interaction.md
β βββ intermediate_interaction.md
β βββ advanced_interaction.md
βββ LICENSE
- Copy the core prompt from
prompts/core_prompt.txt - Paste into your preferred AI assistant (ChatGPT, Claude, etc.)
- Submit student code for debugging assistance
- The AI will provide guided hints without revealing solutions
- Clone this repository
- Review the implementation guide in
documentation/ - Adapt the prompts for your specific educational platform
- Use the testing framework to validate effectiveness
Instead of fixing bugs directly, this system:
- Asks Strategic Questions: Guides students to discover issues themselves
- Provides Progressive Hints: Builds understanding step-by-step
- Maintains Student Agency: Keeps problem-solving control with the learner
- Adapts to Skill Level: Adjusts complexity based on code analysis
- β Solution-Proof Design: Multiple safeguards prevent direct answers
- β Adaptive Difficulty: Automatically adjusts to student skill level
- β Pedagogically Sound: Based on educational research and best practices
- β Scalable Architecture: Works across different programming concepts
- β Comprehensive Testing: Includes validation framework and metrics
Encouraging Mentor Approach
- Rationale: Creates psychological safety essential for effective learning
- Implementation: Positive reinforcement, patient questioning, enthusiasm for process
- Research Basis: Growth mindset theory and educational psychology findings
Adaptive Communication
- Beginners: Simple language, more explicit guidance, concept building
- Advanced: Technical terminology, deeper questioning, optimization discussions
- Detection: Automated analysis of code complexity and structure patterns
The "One Bug Rule"
- Problem: Students get overwhelmed with multiple corrections
- Solution: Focus on most critical issue first
- Benefit: Reduces cognitive load, improves success rates
Progressive Hint System
Level 1: "What do you think happens when you run line 15?"
Level 2: "Remember that Python lists start at index 0"
Level 3: "Try adding a print statement after the loop to see your variable's value"
Level 4: "The issue seems to be in how you're updating your counter variable"
Multi-Layer Protection
- Structural: Response templates with no solution sections
- Behavioral: Explicit "never provide corrected code" instructions
- Pedagogical: Focus on debugging process, not final answer
- Technical: Hint progression system with built-in stopping points
- Language: Simple, jargon-free explanations
- Guidance Level: More explicit direction and concept explanation
- Patience Factor: Expect more iterations, provide more encouragement
- Focus Areas: Basic syntax, fundamental concepts, debugging mindset
- Language: Technical terminology appropriate, assume knowledge base
- Guidance Level: Socratic questioning, challenge assumptions
- Complexity: Discuss alternative approaches, optimization, best practices
- Focus Areas: Logic efficiency, code architecture, advanced debugging techniques
- Learning Outcomes: Students solve problems independently after guidance
- Skill Transfer: Improved debugging ability on new, unseen problems
- Engagement: Continued effort and deeper questioning from students
- Satisfaction: Positive feedback on learning experience
- Standardized buggy code test cases
- Blind evaluation of AI responses
- Student outcome tracking
- Comparative analysis with traditional debugging help
# Student submits this buggy code:
def find_max(numbers):
max_num = 0
for num in numbers:
if num > max_num:
max_num = num
return max_num
# AI Response (following our prompt):
# "Great start! I can see you understand the basic loop structure and comparison logic.
# Let me ask you this: what happens if your list contains only negative numbers?
# Try testing your function with the input [-5, -2, -8, -1]. What result do you get,
# and is that what you'd expect for the 'maximum' value?"# Advanced student code with subtle bug:
class DataProcessor:
def __init__(self):
self.data = []
def process_batch(self, batch):
results = []
for item in batch:
results.append(self.transform(item))
return results
def transform(self, item):
# Complex transformation logic
return item * 2 + 1
# AI Response focuses on architectural considerations:
# "Interesting approach with the class structure! I notice you're processing batches sequentially.
# Given that each transform() call seems independent, what are your thoughts on the potential
# for optimization here? Also, consider what happens to your instance state during concurrent
# operations. Have you considered thread safety implications?"git clone https://github.com/[your-username]/python-debugging-assistant.git
cd python-debugging-assistant- General Use:
prompts/core_prompt.txt - Beginner Focus:
prompts/beginner_variant.txt - Advanced Focus:
prompts/advanced_variant.txt
- Copy chosen prompt to your AI platform
- Test with sample code from
tests/sample_buggy_code/ - Validate responses using
tests/evaluation_metrics.py
- Modify prompts for your specific curriculum
- Adjust hint progression levels
- Add domain-specific debugging patterns
python tests/evaluation_metrics.py --prompt core_prompt.txt --test-suite basic- AI never provides direct solutions
- Responses are encouraging and supportive
- Hints are appropriate for detected skill level
- Students can solve problems after guidance
- Debugging skills transfer to new problems
documentation/design_rationale.md- Deep dive into design decisionsdocumentation/implementation_guide.md- Technical implementation detailsdocumentation/testing_framework.md- Validation and metricsexamples/- Real interaction examples at different skill levels
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-improvement - Test your changes using the validation framework
- Submit a pull request with detailed description
MIT License - see LICENSE file for details.
This system succeeds because it:
- Respects the Learning Process: Maintains student agency in problem-solving
- Builds Transferable Skills: Teaches debugging mindset, not just bug fixes
- Adapts to Individual Needs: Responds appropriately to different skill levels
- Prevents Dependency: Students learn to debug independently
- Scales Effectively: Works across different programming concepts and complexity levels