PTENES
MODULE 3.1

🖥️ Vibe Coding: Live Frontend Fixes

Stop guessing at code. This skill teaches the agent to work like a real developer: it opens the browser on your screen, applies the change live, shows you the result, and only writes to the source code after your approval—always on a safe sandbox branch.

6
Topics
~50
Minutes
Inter.
Level
Practice
Type
1

🔄 The Reverse Flow

Everyone has been through this: you’re staring at a CSS bug—a navbar overlapping the content, a video iframe cut off at the edge, a modal that works on desktop and falls apart on mobile. You describe the problem to the agent, and it dives straight into the code, edits three files, runs the build... and the fix comes out wrong. You describe it again, it edits again, builds again — and now something else is broken.

The traditional AI workflow is backward: it guesses at code changes first and hopes the result turns out right. That's not how a developer works. A developer opens the browser, inspects the element, adjusts the CSS live, sees the result right away — and only then writes the permanent code. Vibe Coding makes your agent work exactly this way.

traditional edit 3 files build broken ✗ rework loop vibe coding live browser approve code ✓ right the first time
Preview before recording

Every fix is validated on screen before touching the code.

Zero lost builds

Ends the "edit → build → revert → repeat" cycle.

Pair programming

Like a developer with DevTools open beside yours.

Frontend, not architecture

Focus on layout and visual bugs—not database schemas.

2

📂 Confirm the workspace

Before you do it any work, the skill requires the agent to confirm the active repository. It detects the current working directory and asks you clearly whether it's the right project for the session. No Git, no browser, no editing until you confirm. It's a small step that prevents costly damage: changing the wrong project.

📂 The repository check

The agent detects the workspace path and presents the confirmation as a hard stop. Something like this:

📂 Repo check: I'm working on /home/voce/projetos/landing-app. Is this the right repository for this session, or should we switch?

If you say the workspace is wrong, it stop immediately and instructs you to reopen the correct project before triggering the flow again.

🔌 Portability note

The skill was originally designed for an environment with a native "hard stop" tool (which blocks and waits for the user). That tool may not exist in other agents.

The lesson applies just as well: replace the call with a direct question and truly stop — proceed only after the answer. The behavior (“stop and wait”) matters more than the tool’s name.

Detect path

Automatically discover the active directory.

Show and wait

Show the path and wait for confirmation.

Wrong = stop

Wrong repo ends the flow immediately.

Before anything else

No destructive action before this step.

3

🌿 Branch-first & git safety

With the workspace confirmed, the next move is create the sandbox before any analysis. The agent checks the git status; if there is uncommitted work, it pauses and offers a local backup. With a clean working tree, it asks for a short description of the task and immediately creates and switches to a local branch. You can experiment without fear: the main is never touched.

terminal · branch-first git
# 1. Verifica se há trabalho não commitado
git status

# 2. (se sujo) oferece backup local antes de começar
git add . && git commit -m "wip: backup antes do vibe"

# 3. cria a sandbox ANTES de abrir o navegador
git checkout -b vibe/fix-navbar-bleed

✓ What to DO

  • ✓Create the branch before to inspect or open the browser.
  • ✓Offer a backup of uncommitted work.
  • ✓Name the branch after the task: vibe/fix-modal-ratio.
  • ✓One dedicated branch per fix.

✗ What NOT to do

  • ✗Edit in the main or master directly.
  • ✗Start tinkering without checking the git status.
  • ✗Panic-revert files if the linter complains.
  • ✗Reuse the same branch for multiple fixes.
git status

Tree state before anything else.

Optional backup

Uncommitted work becomes a local commit.

checkout -b vibe/

An isolated sandbox, created immediately.

No fear

Experiment freely without affecting main.

4

🌐 Visible browser & live injection

Now comes the part that gives the skill its name. The agent identifies the target URL—it could be a local dev server (http://localhost:3000) or a hosted staging/production URL. If it's local, it starts the server in the background; if it's hosted, it skips this step. Then it launches an automated browser visible, NOT headless, on your screen — you watch the automation happen live.

With the page open, the agent inspects the DOM (saving you from copying/pasting HTML) and injects CSS/JS live to test fixes — without editing any project files. It takes screenshots of the changes and shows them to you. Alternatively, it generates a plain JavaScript snippet for you to paste into your own browser's console.

Illustrative recreation—not a real screenshot
localhost:3000 · visible browser
live page
DevTools · injection
document.querySelector('.navbar')
  .style.position = 'relative';

💡 Practical tip: session recovery

If the browser reloads (intentionally or by accident) and the live injections are lost, it’s simple: re-inspect the DOM and reapply the CSS/JS. No scratch files or complex injection logs — the way forward is to keep the process lightweight.

Local or hosted

localhost with a dev server, or a staging URL.

Visible, not headless

You watch the automation on your screen.

Live injection

CSS/JS on the running page, zero files.

Screenshots

Visual proof of the fix, shown to you.

5

⛔ The hard stops

This is the heart of the skill. They are four mandatory approval gates. The agent literally can’t skip steps: it pauses and waits for your “go ahead” at every critical moment. Your code, your rules. Each gate has a clear boundary, and none lets the next step happen on its own.

1

Visual approval

In the troubleshooting loop

After injecting the fix, the agent stops and asks: "How does it look? Do you want to iterate more on the design, or are we ready to think about the code strategy?". Approval here only allows moving on to the strategy — does not apply code.

2

Strategy approval

Before touching the code

The agent searches the repository for where the elements are defined and proposes the most robust approach (a _overrides.scss global? a nested React component? a Tailwind utility?). It explains why and asks for explicit approval.

3

Code review

After saving the files

After applying the changes on the local branch, the agent stops and asks: “Review the diff in the Source Control panel and check it in the browser before pushing.” You decide whether the code is good you, checking locally — not it.

4

Push approval

Before any git command that sends changes

Only now does it ask for the destination remote and confirm "ready to commit and push?" Each push goes to a new, dedicated branch — never directly to the main.

🚫 Anti-steamroll rule

É strictly prohibited combining steps into a single response. Phrases like "I'll sketch out the strategy and apply it all at once" or "since you approved it, I'll go ahead and apply it" are a violation of the workflow.

Presenting the strategy and applying the code in the same response breaks the rule. Each step requires your own explicit approval. If the agent is about to combine the two, it stops.

4 gates

Visuals · strategy · code · push.

Gate rule

Approving one step does not approve the next.

Anti-merge

Strategy and application, never together.

You decide

The user approves each critical moment.

6

✏️ Persist, review & wrap up

With the strategy approved, the agent translates the browser's temporary injection into clean, permanent source code. It removes temporary utility classes, console logs, and hacks used during live testing. Notice the change in vocabulary: it’s "persist in the source", don't hardcode it. Only the final, polished fix becomes code — the git history stays clean, without a dozen failed attempts.

⛔ During "persist": no terminal, no reverting

At this step, the agent is forbidden to run any terminal command—no npm, npx, and no git command (not even git diff, or git add). It only edits the files and saves them.

And if a background compiler complains: don’t panic or revert (git checkout -- file). Leave the files as they are — the user handles compilation.

terminal · push (only after approval) git · one at a time
# Em PowerShell (Windows) NÃO encadeie com &&.
# Rode um comando por vez:
git add .
git commit -m "Fix: navbar bleed-through on staging"
git push origin vibe/fix-navbar-bleed

✅ Session wrap-up (required)

After a successful push, the vibe coding session is complete. The agent says it’s finished and asks you to open a new chat for the next fix.

Why? To avoid context bleed between tasks: a clean chat prevents branch conflicts and context confusion from the previous fix.

Scope limit: if you ask for a new architecture (e.g., a database schema) in the middle of a vibe session, it gently reminds you that Vibe Coding is for layout and visual bugs, and recommends a standard plan/task.

Persist in the source

Clean code, not "hardcode".

No reverting

Linter complained? Let the user handle it.

One command at a time

Compatible with PowerShell, without &&.

New chat

The next fix starts from scratch.

Output example — a complete session

See how the agent handles fixing a cropped video iframe inside a modal—from the repo check to the push, stopping at each gate.

📂 [repo check] "I'm in /app/landing. Is this the right repo?” → you: yes
🌿 [branch] clean git status → git checkout -b vibe/fix-video-modal
🌐 [browser] opens localhost:3000/curso visible, inspects the .modal iframe, sees the cut at the bottom edge
🔧 [live] injects max-width: 680px in the container with padding-bottom → screenshot
⛔ [hard stop #1] "How did it turn out?" → you: perfect, persist it
📋 [strategy] grep locates VideoModal.jsx → suggest adjusting the max-width from the wrapper there
⛔ [hard stop #2] approves strategy → you: you can
✏️ [persist] edits the component, clears the temporary classes, saves
⛔ [hard stop #3] "Review the diff in Source Control" → you: approved
🚀 [push] "remote? → origin" → add, commit, push in vibe/fix-video-modal
✅ [end] "Session complete. Open a new chat for the next one."

🛠️ Practical exercises

Exercise 1 — Map the gates

Choose a real visual bug in your project (navbar, modal, iframe). Write, one line each, what the agent would say at each of the 4 hard stops. This trains your eye to recognize when it's about to overstep.

Exercise 2 — Trigger prompt

Use this copyable prompt to start a vibe coding session with your own agent:

I want to do vibe coding. The bug: [describe the visual problem]. The URL: [localhost:3000/page or staging URL]. Before anything else: confirm the workspace, create a sandbox branch, and open the visible browser. DO NOT edit any files until I approve the change on screen.

Exercise 3 — Create a runnable SKILL.md

Write your own concise version of the skill. Save it as vibe-coding/SKILL.md in your project's skills folder and launch it by requesting a visual fix. Adapt the "hard stop" and "browser" tools to your agent's native equivalents.

--- name: vibe-coding description: Fixes frontend bugs (CSS/HTML/DOM), prioritizing live visual feedback in the browser before saving changes to code. Use when testing CSS/HTML changes, fixing clipped elements, or visually adjusting layouts. --- # Vibe Coding CRITICAL DIRECTIVE: DO NOT edit any repo files when reading the request. Open the target URL FIRST. Only save changes to code after visual approval. ## Workflow - [ ] Confirm workspace: detect the active directory, show it, and WAIT for confirmation. - [ ] Branch first: check `git status`, offer a backup, create `git checkout -b vibe/[desc]`. - [ ] Visible browser: open the URL (NOT headless), inspect the DOM, inject CSS/JS live, take a screenshot. - [ ] HARD STOP #1 — visual approval: “How does it look?” Proceed only with “yes, save it.” - [ ] Strategy (no code): grep the source, propose the most robust approach and explain why. - [ ] HARD STOP #2 — strategy approval. - [ ] Save to source: translate the injection into clean code. NO terminal, NO reverting. - [ ] HARD STOP #3 — user reviews the diff. - [ ] Push: ask for the remote, then add/commit/push to a dedicated branch (one command at a time). - [ ] Wrap up: session complete; ask for a new chat for the next fix. ## Hard rules - Anti-merge: strategy and implementation NEVER in the same response. - One branch per fix. Never push directly to main. - Scope: frontend/layout only. Architecture → standard plan.

🎯 Module Summary

✓
Reversed flow — see the adjustment in the browser before touching the code, like a real developer.
✓
Confirm workspace — the right repo before any git, browser, or editing.
✓
Branch-first — sandbox vibe/ created immediately; main remains untouched.
✓
Visible browser — live CSS/JS injection, screenshots, zero files edited.
✓
4 hard stops — visual design, strategy, code, and push; the agent doesn’t bulldoze ahead.
✓
Persist and finish — only the final fix becomes code; start a new chat for the next one.

Next Module:

3.2 — Funnel Builder: one prompt, an entire funnel