Tools: Report: How I Built a Self-Improving AI Election Assistant
PromptWars #GoogleForDevelopers #BuildWithAI #Hack2skill #NextJS #AI The clock was ticking. The PromptWars Virtual Challenge 2 was in full swing, and
the stakes couldn't be higher. With over 4 million submissions expected, themath was brutal: to rank in the top 400, you have to be in the top 0.01%. "Good enough" was not going to cut it. I didn't just need a functional app; Ineeded a masterpiece of innovation, execution, and social impact. Mostimportantly, I needed to build it fast. Here is the story of how I built VoteIQ—a production-ready, multi-lingual,AI-powered Election Education Assistant—and equipped it with a"Self-Improvement" engine that lets it evolve while I sleep. 🚀 The PromptWars challenge is a testament to the power of generative AI. Organizedby Google for Developers and Hack2skill, it tasks builders with creatingimpactful solutions using the Gemini API. The deadline: May 3rd, 2026. The competition: 4 million people. The goal:Top 400. When you are competing against 4 million people, your choice of problem mattersas much as your code. I chose Election Education. In a world of deepfakes andmisinformation, providing citizens with a clear, gamified, and accessible way tounderstand the voting process is a high-impact mission. But to win, thetechnical execution had to be flawless. Most developers treat AI as a glorified autocomplete. They ask for a component,copy-paste it, and move on. My strategy was different: I wanted the AI to be theArchitect, the Developer, and the QA Engineer. To hit that top 0.01% bracket, I focused on three pillars: This isn't just an app; it's a living software organism. For a 1-hour build, there is no room for configuration hell. I chose a stackoptimized for speed and Vercel’s edge network: Using the Web Speech API, VoteIQ allows users to speak directly to the AI.Whether you ask in English or Hindi, the Gemini-powered brain responds withaccurate, non-partisan election data. It’s not just a chat; it’s a conversation. 👤 Personalized Voter Profile Instead of a wall of text, users take a 10-question interactive quiz. Geminianalyzes these responses to generate a "Voter Persona"—helping users identifywhat issues they care about most and providing a custom checklist for electionday. 🗺️ Interactive Election Timeline I used Framer Motion to build a vertical, animated progress tracker. As usersscroll, they see the journey from registration to the polling booth, completewith "Where am I?" tracking. The "Election IQ Quiz" features progressive difficulty levels. But the standoutis the Election Simulator, where users play as a candidate, making budget andpolicy decisions to see how they impact "Public Trust" and "Support" metrics. 🌐 Multi-Language & PWA Democracy is for everyone. VoteIQ supports English, Hindi, Tamil, and Telugu.Furthermore, it’s a Progressive Web App (PWA), meaning voters inlow-connectivity areas can install it on their home screens and access cachededucational content offline. This is the feature that I believe puts VoteIQ in the top 400. I didn't justwrite the code; I wrote a Self-Improvement script that runs via GitHub Actions. Every 8 hours, a GitHub Action triggers a Node.js script. This script reads thecore components of the app and sends them to Gemini with a specific prompt:"Identify one UI improvement for accessibility and one performance bottleneck inthis code." The AI then generates a patch. While I'm sleeping, the app is literally gettingbetter. The GitHub Workflow (.github/workflows/auto-improve.yml): name: AI Self-Improvementon: schedule: - cron: '0 */8 * * *' # Runs every 8 hours workflow_dispatch: jobs: improve: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Use Node.js uses: actions/setup-node@v3 with: node-version: '20' - run: npm install - name: Run AI Auditor env: GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} run: node .github/scripts/improve.js - name: Commit Improvements uses: stefanzweifel/git-auto-commit-action@v5 with: commit_message: "AI: Automated UI/UX Enhancement" The Improvement Script (.github/scripts/improve.js): const { GoogleGenerativeAI } = require("@google/generative-ai");const fs = require("fs");const path = require("path"); const genAI = new GoogleGenerativeAI(process.env.GEMINI_API_KEY); async function improveComponent(fileName) { const model = genAI.getGenerativeModel({ model: "gemini-pro" }); const filePath = path.join(process.cwd(), fileName); const code = fs.readFileSync(filePath, "utf8"); const prompt = You are a Senior Frontend Engineer. Analyze this Next.js component for accessibility (ARIA labels) and visual polish. Return ONLY the improved code. File: ${fileName}\n\nCode:\n${code}; const result = await model.generateContent(prompt); const improvedCode = result.response.text(); // Basic validation to ensure we don't commit empty files if (improvedCode.length > code.length * 0.5) { fs.writeFileSync(filePath, improvedCode); console.log(Successfully improved ${fileName}); }} improveComponent("components/VoiceChatbot.tsx"); To build this in an hour, I couldn't afford a "back-and-forth" with the AI. Iused a Master System Prompt. Instead of asking "Build me a navbar," I provided the full context: "You are an expert full-stack developer competing in PromptWars. Build aNext.js 14 navbar with Tailwind CSS. It must include a language toggle (EN, HI,TA, TE), a dark mode toggle, and use Framer Motion for hover effects. Ensurefull TypeScript types and mobile responsiveness." By providing the Role, Context, Constraints, and Technical Stack in a singleprompt, I reduced the iteration time by 90%. Deploying on Vercel was the final piece of the puzzle. With the next.config.jsoptimized and PWA manifests in place, the deployment took less than 2 minutes. Analytics: I enabled Vercel Speed Insights to monitor the "Real ExperienceScore," ensuring the app stays fast as it evolves. Results & Learnings: The Power of 1 Hour ⏱️ What surprised me most wasn't that I could build an app in an hour—it was thedepth of the app. VoteIQ isn't just a hackathon project. It’s a blueprint for how we can use AI tobridge the gap between complex government processes and the everyday citizen. Bymaking the election process transparent, gamified, and voice-accessible, we canincrease voter turnout and reduce the power of misinformation. The next step? Integrating a RAG (Retrieval-Augmented Generation) system to pullin live candidate affidavits directly from official government PDFs. The revolution won't be televised; it will be coded. Live Demo: https://election-assistant-xi.vercel.app/ Source Code: https://github.com/Majenayu/election-assistant If you're competing in PromptWars or any AI challenge, remember: Don't justbuild an app. Build a system that builds a better app. Good luck to all 4 million participants. See you in the Top 400! 🏆 Templates let you quickly answer FAQs or store snippets for re-use. as well , this person and/or - The Challenge: Standing Out in a Sea of Millions 🌊 - The Strategy: Building the "Evolution Machine" 🧠 - Accessibility at Scale: If a rural voter in India can’t use the app in theirlocal language via voice, the app has failed.- Gamified Education: People hate reading manuals but love playing games. Iturned the election process into a simulator.- The Self-Improving Loop: I built a CI/CD pipeline where Gemini audits thecode every few hours, identifies UX friction points, and suggests (orcommits) improvements. - The Tech Stack: Performance Meets Intelligence 🛠️ - Next.js 14 (App Router): For Server Components, SEO, and lightning-fastrouting.- TypeScript: Because in a competition this big, a single undefined error cankill your ranking.- Tailwind CSS: For that "Apple-meets-Election" aesthetic (Glassmorphism +Indian election colors).- Gemini 1.5 Pro: The heavy lifter for real-time chat, profile analysis, andcode auditing.- Framer Motion: For those high-end, "premium" feeling animations.- Lucide React: For consistent, beautiful iconography. - Core Features: Beyond the Basics ⚡ - The Secret Weapon: Auto-Improvement 🤖 - Building with AI: The Prompting Strategy 🎯 - Deployment Journey: Edge-Ready 🚀 - Environment Variables: I secured the GEMINI_API_KEY in Vercel's dashboard.- Edge Runtime: For the Chat API route, I used the Edge runtime to ensure lowlatency for voice responses.- Analytics: I enabled Vercel Speed Insights to monitor the "Real ExperienceScore," ensuring the app stays fast as it evolves.- Results & Learnings: The Power of 1 Hour ⏱️ - Speed: AI scaffolding allowed me to spend 45 minutes on "Hard Logic" (likethe Voice API) and only 15 minutes on "UI/UX."- Quality: The Gemini-generated TypeScript interfaces were cleaner than what Iwould have written under pressure.- Automation: Seeing the first "AI: Automated UI/UX Enhancement" commit hit myGitHub repository was a moment of pure magic. - Impact & Future: Democracy 2.0 🗳️ - Try It Yourself 🔗 - Live Demo: https://election-assistant-xi.vercel.app/- Source Code: https://github.com/Majenayu/election-assistant