ai gemma technical Claude Code Git Worktrees CDance 2.5 Spec-Driven Development Web Engineering Cloudflare UI/UX Automation

Architecting High-Fidelity Web Interfaces: A Spec-Driven Workflow Using Claude Code, Git Worktrees, and CDance 2.5

5 min read

Architecting High-Fidelity Web Interfaces: A Spec-Driven Workflow Using Claude Code, Git Worktrees, and CDance 2.5

In the current landscape of generative AI, a significant divide has emerged between "AI slop"—generic, unpolished, and structurally weak applications—and high-end, production-ready software. The difference lies not in the model's raw power, but in the engineering methodology applied to the prompt lifecycle. This post outlines a rigorous, five-stage technical framework for utilizing AI agents like Claude Code and Codex to build sophisticated, motion-rich web applications that leverage proven UX patterns and advanced deployment pipelines.

Phase ary: Context Engineering via Spec-Driven Development

The primary failure point in AI-assisted development is insufficient context. When an LLM is forced to "guess" features or styling, the resulting accuracy drops precipitously. To mitigate this, we implement a Grooming Skill—an iterative interviewing agent that relentlessly interrogates the developer to extract requirements.

This process moves beyond simple prompting into Spec-Driven Development. The goal is the programmatic generation of two critical artifacts:

  1. spec.md: A comprehensive technical specification detailing all application functionalities, user stories, and feature sets.
  2. decisions.md: A persistent log of every architectural choice, tech stack decision (e.g., NestJS, Tailwind CSS), and UI requirement made during the grooming session.

By maintaining a decisions.md file, we ensure that as the conversation depth reaches 30 to 100 turns, the agent retains the necessary state-awareness to prevent regression or "context drift."

Phase 2: Reverse Engineering Proven UX via Deep Research

Rather than attempting to reinvent complex UI/UX patterns from scratch—a process prone to high error rates—the most efficient strategy is to clone and adapt successful existing architectures. Using Claude Code’s Deep Research Skill, we can analyze live production environments (e.g., CoinMarketCap) to identify the underlying UI libraries, component structures, and design tokens in use.

The workflow involves:

  • Target Identification: Providing URLs of high-performing applications as structural baselines.
  • Component Extraction: Using agents to identify open-source primitives (e.g., Radix UI, Shadcn/ui) that mirror the target's functionality.
  • Template Leveraging: Utilizing existing Vercel templates or NestJS commerce repositories to establish a functional codebase before applying custom business logic.

This approach leverages "proven conversion" patterns—utilizing layouts that have already been optimized for high daily active users (DAU).

Phase 3: Parallelized Design Iteration via Git Worktrees

Once a baseline version (v1.0) is established, the challenge shifts to customization and brand differentiation. To avoid the "AI slop" look, we utilize an Impeprising Skillset categorized into three stages: Start, Iterate, and Polish.

To prevent merge conflicts when running multiple design variations simultaneously, we employ Git Worktrees. Instead of forcing a single agent to experiment within one branch—which leads to overwritten files and broken states—we instruct the agent to fork the project into multiple concurrent worktrees (e.g., worktree-small, worktree-medium, worktree-large).

Each sub-agent is assigned a specific design target:

  • Small Change: Modifying CSS variables, design tokens, and color palettes (e.g., shifting from a default theme to a custom Yellow/Black/White palette).
  • Medium Change: Altering typography scales, component density, and table layouts.
  • Large Change: Complete structural redesigns of the visual language.

This parallelized execution allows for side-by-side comparison in the browser across different ports (e.g., port 5175 vs. 5176), enabling a data-driven selection of the optimal UI direction before merging the chosen branch back into main.

Phase 4: Implementing High-End Motion via CDance 2.5 and Hicksfield.ai

The final differentiator between standard web apps and premium digital experiences is motion. We move beyond static CSS transitions by integrating AI-generated video assets that drive scroll-based animations.

Using the Hicksfield.ai ecosystem, specifically the CDance 2.5 model, we can generate high-fidelity, physics-based animations. The technical pipeline is as follows:

  1. Frame Analysis: An agent (Codex/Claude) analyzes an inspiration video frame-by-frame to extract motion vectors and key events.
  2. Prompt Synthesis: This analysis is converted into a structured prompt for hicksfield.ai's generative engine.
  3. Asset Generation: Using GPT Image 2 for initial character/object sketches (cost-effective) followed by CDance 2.5 for the high-fidelity video generation (high-compute).
  4. Scroll-Driven Integration: The resulting MP4 is processed via an "Animate Website" skill, which utilizes JavaScript to tie the video playback progress to the user's scroll position on the about or landing pages.

This creates a seamless, immersive experience where elements appear to move, expand, or transform in direct response to user interaction, mimicking high-end sites like Apple’s product landing pages.

Phase 5: Production Deployment via Cloudflare Ecosystem

The final stage is the deployment of the optimized, animated, and refactored codebase. For global availability and low latency, we utilize Cloudflare Pages.

By leveraging the Cloudflare CLI through an AI agent, we automate the build pipeline (npm run build) and the deployment of assets to Cloudflare’s edge network. This ensures that our highly customized, motion-heavy application is served from the nearest PoP (Point of Presence) to the end user, maintaining high performance despite the complexity of the visual assets.

Conclusion: The Future of Agentic Engineering

The transition from a "prompt engineer" to an "AI software architect" requires moving away from single-turn prompts and toward complex, multi-agent workflows involving Git orchestration, spec-driven documentation, and advanced motion integration. By treating AI agents as sub-agents within a larger, structured engineering pipeline, we can build applications that are indistinguishable from those built by traditional high-end design teams.