Markdown Converter
Agent skill for markdown-converter
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Sign in to like and favorite skills
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
# Development npm run dev # Start development server with Turbopack (default port 3000) npm run build # Build for production npm run start # Start production server npm run lint # Run ESLint for code quality # Firebase deployment firebase deploy --only database # Deploy database rules only firebase deploy # Deploy all Firebase config firebase login # Login to Firebase CLI (required once) # Database rules testing firebase deploy --only database:rules # Deploy only security rules # Git workflow (for commits to https://github.com/reallygood83/smartq) git add . git commit -m "descriptive message" git push origin main
SmartQ is an AI-powered educational platform built with Next.js 15 and Firebase, designed to help teachers collect and analyze student questions using Google Gemini API.
Education Level Adaptation System
EducationLevelContext provides level-specific terminology, themes, and AI promptsuseSmartTerminology() for adaptive language/src/styles/themes.ts provides level-specific visual stylingDual Authentication Model
Client-Side API Key Management
/src/lib/encryption.tsReal-time Data Architecture
/sessions/{sessionId}//questions/{sessionId}/, teachers control everything elseSessions: Core teaching units with unique 6-digit access codes
{ sessionId: string, title: string, accessCode: string, // 6-digit student access code sessionType: 'DEBATE' | 'INQUIRY' | 'PROBLEM' | 'CREATIVE' | 'DISCUSSION' | 'QNA', teacherId: string, subjects?: Subject[], isAdultEducation?: boolean, // Teacher-led mode support (NEW) interactionMode?: 'free_question' | 'teacher_led', activeTeacherQuestionId?: string }
Questions: Student submissions linked to sessions with like functionality
{ questionId: string, sessionId: string, text: string, studentId: string, // Anonymous persistent ID isAnonymous: boolean, studentName?: string, likes?: { [studentId: string]: boolean // Like tracking per student } }
Teacher Questions: Teacher-prepared and real-time questions (NEW)
{ questionId: string, sessionId: string, text: string, teacherId: string, order: number, source: 'prepared' | 'realtime', status: 'waiting' | 'active' | 'completed', createdAt: number, activatedAt?: number, completedAt?: number }
Student Responses: Responses to teacher questions (NEW)
{ responseId: string, questionId: string, // Links to TeacherQuestion sessionId: string, studentId: string, text: string, createdAt: number, isAnonymous: boolean, studentName?: string }
AI Analysis Results: Gemini API analysis of collected questions
{ clusteredQuestions: Array<{ clusterId: number, clusterTitle: string, questions: string[], combinationGuide: string }>, recommendedActivities: Activity[], conceptDefinitions: Concept[] }
Theme and Dark Mode System
ThemeContext for light/dark, EducationLevelContext for adaptive theming/src/styles/themes.ts provides level-specific colors and stylingdark: classes for backgroundsdark:text-white for maximum contrast in dark mode - avoid dark:text-gray-*useFullTheme() hook to access complete theme object in componentsFirebase Security Rules
teacherQuestions/) - teacher write-only, students read-onlystudentResponses/) - students write, teachers readquestionAnalyses/) - teacher write-onlyAPI Integration Pattern
/src/app/api/ai/ contains Next.js API routes that proxy to GeminiNavigation and Routing
/teacher/dashboard → /teacher/session/create → /teacher/session/{sessionId}/student/session/{sessionCode}Teacher-led mode provides structured Q&A sessions where teachers control question flow and collect student responses for analysis.
TeacherQuestionManager (
/src/components/teacher/TeacherQuestionManager.tsx)
onValue listenersQuestionTemplates (
/src/components/teacher/QuestionTemplates.tsx)
TeacherQuestionView (
/src/components/student/TeacherQuestionView.tsx)
ParticipationMonitor (
/src/components/teacher/ParticipationMonitor.tsx)
StudentResponseAnalysisDashboard (
/src/components/teacher/StudentResponseAnalysisDashboard.tsx)
Teacher Creates Question → Firebase teacherQuestions/ ↓ Teacher Activates Question → Session activeTeacherQuestionId updated ↓ Students See Active Question → Real-time onValue listener ↓ Students Submit Responses → Firebase studentResponses/ ↓ Teacher Views Responses → Real-time participation monitoring ↓ Teacher Requests AI Analysis → Gemini API analysis ↓ Analysis Results Stored → Firebase questionAnalyses/
session.interactionModeWhen working with Teacher-Led Mode:
interactionMode before rendering teacher-led components{session?.interactionMode === 'teacher_led' && <Component />}When modifying UI components:
useSmartTerminology()dark: classes - use dark:text-white for textWhen working with Firebase:
database.rules.json - deploy with firebase deploy --only databaseonValue listeners for real-time updates, not one-time get() callsteacherQuestions/, studentResponses/, questionAnalyses/, comprehensiveAnalyses/getStoredApiKey(user.uid) with user ID parameter - never call without user IDWhen adding AI features:
/src/app/api/ai//src/lib/aiPrompts.tsRequired
.env.local variables:
NEXT_PUBLIC_FIREBASE_API_KEY=your_firebase_api_key NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=your_project.firebaseapp.com NEXT_PUBLIC_FIREBASE_PROJECT_ID=your_project_id NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=your_project.appspot.com NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=your_sender_id NEXT_PUBLIC_FIREBASE_APP_ID=your_app_id NEXT_PUBLIC_FIREBASE_DATABASE_URL=https://your_project-default-rtdb.firebaseio.com/
Important: The app gracefully degrades when Firebase config is missing, but authentication and real-time features will be disabled. Always verify Firebase connection before making database-related changes.
Mobile Optimization:
Dark Mode Implementation:
dark:text-white for primary text in dark mode (not gray variants)Real-time Interactions:
Educational Content:
Comprehensive Analysis Mode (Default)
Individual Analysis Mode (Optional)
Student Default Behavior Changes
Teacher Components:
TeacherQuestionManager.tsx - Central question management interfaceQuestionTemplates.tsx - Educational template library with Bloom's TaxonomyParticipationMonitor.tsx - Real-time participation trackingStudentResponseAnalysisDashboard.tsx - AI-powered response analysisStudent Components:
TeacherQuestionView.tsx - Interface for responding to teacher questionsAPI Routes:
/api/teacher-questions/create - Create teacher questions/api/teacher-questions/activate - Activate questions for students/api/student-responses/submit - Submit student responses/api/ai/analyze-student-responses - Individual AI analysis of responses/api/ai/analyze-comprehensive - Comprehensive/collective analysis of responses/api/ai/analyze-questions - General question analysis/api/ai/analyze-adult-session - Adult education session analysis/api/ai/instructor-analysis - Instructor-focused analysis/api/ai/learner-analysis - Learner-focused analysis/api/ai/quality-monitoring - Quality monitoring analysis/api/ai/validate-key - Gemini API key validationType Definitions:
/src/types/teacher-led.ts - Complete type system for teacher-led mode/src/types/education.ts - Session mode configurationsfirebase-realtime-database/ ├── sessions/{sessionId}/ │ ├── interactionMode: 'free_question' | 'teacher_led' │ └── activeTeacherQuestionId?: string ├── teacherQuestions/{sessionId}/ │ └── {questionId}/ │ ├── text: string │ ├── status: 'waiting' | 'active' | 'completed' │ └── order: number ├── studentResponses/{sessionId}/ │ └── {responseId}/ │ ├── questionId: string │ ├── studentId: string │ └── text: string ├── questionAnalyses/{sessionId}/ │ └── {questionId}/ │ ├── individualAnalyses: ResponseAnalysis[] │ └── collectiveAnalysis: CollectiveAnalysis └── comprehensiveAnalyses/{sessionId}/ └── {analysisId}/ ├── responseTypeDistribution: object ├── comprehensionLevelDistribution: object ├── keyInsights: object ├── classroomRecommendations: object └── overallAssessment: object
Bloom's Taxonomy Integration:
Assessment Best Practices:
Pedagogical Flexibility:
Zero-Impact Architecture:
Educational Effectiveness:
Technical Reliability:
(session.interactionMode || 'free_question').env.local variables and network connectivitydark:text-white for readable text/* comment */ instead of {/* comment */} inside conditional rendering expressionsgetStoredApiKey(user.uid) is called with user ID parameternpm run build locally to catch TypeScript and JSX errors before deploymentonValue listeners efficiently (clean up in useEffect cleanup)