Back
work about explorations resume
Overview
Solution
Context
Prototyping
Implementation
Reflection

margin

Hackathon Project | Cal Hacks 12.0

Role

Product Designer, Developer

Tools

Figma, HTML, CSS,
JavaScript, VS Code Extension API, Claude API

Team

2 Designers, 1 PM

Skills

Sketch
Prototyping
Frontend Development

Timeline

36 hours

Margin Preview

Overview

For designers to learn and think in code.

While AI-powered coding tools like Cursor have democratized code generation for non-technical designers, a critical challenge remains: understanding and modifying the generated code. Designers often find themselves staring at blocks of code that work but feel like a black box, uncertain about how to interpret, debug, or tweak what they've created.

margin is a VS Code extension that transforms code into an educational experience, helping designers build a mental model of how their visual ideas translate into functional code. By combining visual structure breakdowns, AI-powered explanations, and interactive learning features, margin empowers designers to move from code generation to code comprehension.

Solution

A tool that makes code transparent and accessible.

We built a VS Code extension that helps designers understand what their code is doing and how it works.

Toggle Mode
Code Legend
Hover Summary
File Visualization

Context

The rise of vibecoding and the comprehension gap.

AI coding assistants have created the concept of "vibecoding", describing what you want and letting AI generate the code. It's been revolutionary for designers who want to prototype ideas without deep technical knowledge.

But this approach creates a fundamental problem: designers can generate code they don't understand. When something breaks or needs modification, they're stuck. They can ask the AI to fix it, but they're not learning. They remain dependent on the tool rather than building competence.

Prototyping

Design questions.

To get started, we wanted to pose foundational questions that our tool should explore.

Design Questions

Implementation

Iterations and implementation.

Challenge 1

VSCode Extension Architecture

Creating a VS Code extension requires understanding the extension API, managing editor decorations, and handling real-time code parsing. We had to quickly learn the extension development workflow and figure out how to inject visual elements into the code editor without disrupting the developer experience.

Solution: We focused on the TextEditor API and Decoration API, creating a minimal viable architecture that could highlight code and show hover tooltips. We prioritized read-only features first to avoid complex state management.
Challenge 2

Intelligent Code Parsing

To provide meaningful highlights and explanations, we needed to parse different file types (HTML, CSS, JavaScript, React) and identify code structures. Building a robust parser from scratch wasn't feasible in our timeframe.

Solution: We leveraged the VS Code language services and TextMate grammars that VS Code already uses for syntax highlighting. This gave us token-level code understanding without building our own parser. For semantic understanding, we integrated Claude API to analyze code chunks.
Challenge 3

Performance & User Experience

Real-time code analysis and AI API calls could create lag, especially for larger files. We needed to ensure the extension felt snappy and didn't interrupt the coding workflow.

Solution: We implemented debouncing for hover events and caching for AI responses. The file visualization is generated once on file open and updated only when the file is saved. Decorations are applied asynchronously to avoid blocking the UI thread.
Challenge 4

Balancing Education vs. Distraction

Too many visual indicators could overwhelm users and make the code harder to read. We needed to find the right balance between providing helpful context and maintaining code readability.

Solution: We made all features opt-in through the toggle mode and used subtle color highlights that don't drastically change the appearance of code. The legend is collapsible, and hover explanations only appear on user action, keeping the interface clean by default.

Final Thoughts

Learnings...

This project taught me that the most impactful tools might be the ones that help you understand how to do things yourself. Building margin reinforced that good educational design is about scaffolding learning.

Working under hackathon constraints also taught me to prioritize features. We had to ask: What's the minimum viable version that still creates genuine learning value?

With more time...

I would love to build interactive tutorials that guide designers through making their first code changes with margin's assistance. Something like a "learn by doing" mode where margin suggests small modifications to try.

I'd also explore a community feature where designers could share annotated code snippets, creating a library of "explained code" that others can learn from.

Vantage Project

view another project

Vantage

A journey-based navigation system that organizes XR design elements according to when they appear during the user experience.

Frontend Development AR/VR