What is the Barba.js skill?
Barba.js is a skill in the freshtechbro design skills repository. It guides an AI coding agent to add fluid page transitions to a multi-page site with the Barba.js library: wrapper and container markup, the leave and enter lifecycle, sync crossfades, namespace rules, router and prefetch plugins, and common pitfalls.
Barba.js is a small library, described in the skill as about 7kb, that intercepts link clicks, fetches the next page and animates between the old and new content. The skill teaches an agent to set that up correctly.
The effect is that a multi-page site feels like a single page app while keeping separate URLs and server-rendered pages. The skill covers the markup, the lifecycle order and the mistakes that cause flicker or instant swaps.
The core pieces it explains
- Wrapper: the outer element, with persistent header, nav and footer kept outside the container.
- Container: the content that is replaced on each navigation.
- Namespace: a name per page type, used in transition rules and views.
- Hooks: eleven lifecycle points from before to after, plus once hooks for the first load.
- Views: page-specific setup and cleanup logic.
Who the Barba.js skill is for
Best for
- Portfolio, agency and brand sites that want animated navigation between pages.
- Developers who already use GSAP and want leave and enter timelines.
- Sites that need per-page scripts initialised and cleaned up on each transition.
Not for
- Apps already built with a client-side router, where framework transitions fit better.
- Sites where every page must load scripts and widgets exactly as a fresh load would, unless you re-initialise them.
- Users who need the simplest possible site. Transitions add moving parts.
Use it with UiChemy
Barba.js changes how pages swap in a theme or custom front end. For building the pages themselves in WordPress, UiChemy Composer writes HTML, CSS and JS inside Elementor or Gutenberg. Click Get Started on uichemy.com.
How to install Barba.js Skill: Page Transitions for AI Coding Agents
/plugin install extended-3d-scrollThe skill's related list says Locomotive Scroll can be combined with Barba for smooth scrolling between pages.Add the marketplace
Run
/plugin marketplace add freshtechbro/claudedesignskillsonce.Install the bundle
Run
/plugin install extended-3d-scroll. The README lists Barba among its six skills.Or copy the folder
Clone the repository and copy
.claude/skills/barba-jsinto your project's skills directory.Install the library
The skill uses
npm install --save-dev @barba/core, with @barba/router, @barba/prefetch and @barba/head as optional plugins.
Check that it loaded
Ask your agent to add a fade transition between two pages. It should wrap the body, mark a container with a namespace and return promises from leave and enter.
Key features
- Wrapper, container, namespace markupDefines the three data attributes Barba needs and where static and dynamic elements belong.
- Async and sync flowsExplains the default leave then enter sequence and the sync mode that runs both at once for crossfades.
- Eleven lifecycle hooksLists the order from beforeOnce through after, and splits them into global, transition and view hooks.
- Transition recipesExamples for fade, crossfade, slide with overlap, and a loading indicator, each returning promises.
- Conditional rulesUses from and to namespaces or route names to pick a different transition for home, product-to-product and a default fallback.
- Router and prefetch pluginsShows @barba/router for route-based rules and @barba/prefetch to load pages on hover.
- GSAP timelinesBuilds staggered leave and enter timelines so headings and content animate in order.
- Re-initialising scriptsHooks for analytics page views, social widgets and syntax highlighting that must run again after each swap.
- Performance guidancePrefetching, a container minimum height to prevent layout shift, GPU-friendly properties, listener cleanup and deferred image loading.
- Six pitfallsForgetting to return promises, external links, CSS conflicts between pages, stale title and meta tags, enter flicker and sync layout shift.
Frequently asked questions
What is the Barba.js skill?
It is a skill in freshtechbro/claudedesignskills that teaches an AI coding agent to build page transitions with Barba.js. It covers the wrapper and container structure, lifecycle hooks, views, transition rules, router and prefetch plugins, GSAP animation and common pitfalls.
How do I install the Barba.js skill?
In Claude Code, add the marketplace with /plugin marketplace add freshtechbro/claudedesignskills, then run /plugin install extended-3d-scroll, a bundle that includes Barba. You can also copy .claude/skills/barba-js from a clone. The library itself installs from @barba/core.
Why do my Barba.js transitions finish instantly?
The skill lists this as pitfall one: the hook does not return a promise. Return the GSAP tween or use async and await so Barba waits for the animation. Without that, the new container is swapped in as soon as the animation starts.
How do I update the page title with Barba.js?
The skill points out that title and meta tags do not update on their own. Use the @barba/head plugin, or copy the title and meta content from the next page's HTML in an after hook. Skipping this hurts both users and search snippets.
How do I stop the new page flashing before it animates in?
Set the container's starting state to hidden, either in CSS or in a beforeEnter hook with GSAP set. The skill also advises position absolute on containers during sync transitions so stacked pages do not shift the layout.
Is Barba.js bad for performance or SEO?
It keeps real URLs and server-rendered pages, which is the point of the approach. Costs come from extra scripts and animation. See Web Performance and Animation Performance for measuring them, and test with reduced motion.
What are Barba.js skill alternatives?
For scroll effects without page swaps, use GSAP ScrollTrigger. For React apps the skill's related list suggests the Framer Motion skill, which this repo calls motion-framer. Accessible Motion covers reduced motion.
Does the skill work in Cursor or Codex?
The repo presents itself as a Claude Code plugin marketplace and also supports uploading skills to claude.ai. It does not state support for Cursor or Codex. Barba.js itself is framework-agnostic JavaScript, but the skill packaging is not documented for other agents.


