Skip to main content
skill CX Codex

cobejs — Claude Code skill: lightweight cobe globe

A skill that walks the agent through building a small spinning globe with cobe, markers included. Handy for hero sections and about pages.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add MengTo/Skills --skill cobejs -a claude-code
Open on GitHub

What cobejs does

The skill covers the cobe library end to end: canvas setup, options, markers and instance lifecycle. Your agent gets the call patterns — createGlobe(canvas, {...}), the phi, theta, scale, dark and diffuse options, baseColor, markerColor, glowColor, and a markers array of coordinates. Pausing the animation is globe.toggle(), cleanup is globe.destroy().

It also lists the mistakes that bite. The canvas needs a CSS size plus separate width/height scaled for DPR, or the render looks soft. On window resize the parameters have to be recomputed. For mobile it advises clamping DPR between 1 and 2, since higher values drop frames.

A full recipe for a responsive globe with markers ships with it: measuring via getBoundingClientRect, listening for resize and rebuilding the instance. Before writing code the skill has the agent ask about globe size and placement, marker locations and colors, and whether drag-to-rotate is wanted or ambient spin is enough. Worth answering up front — redoing the layout later costs more.

What it helps with

  • drop a spinning globe into a hero section
  • place city markers by latitude and longitude
  • keep the globe responsive on window resize
  • clamp DPR on mobile to hold the frame rate
  • wire cobe into a React or Next.js page

Example prompts for the agent

  • add a cobe globe to the hero section
  • put a marker on Singapore and change its color
  • make the globe spin on its own, no drag

How to install cobejs

1Skills CLI (Vercel)

npx skills add MengTo/Skills --skill cobejs -a claude-code

2Manually: put the files in place

~/.claude/skills/cobejs/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/cobejs/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about cobejs

How do I install cobejs in Claude?

Run npx skills add MengTo/Skills --skill cobejs -a claude-code. The skill file lands at ~/.claude/skills/cobejs/SKILL.md.

What does cobejs do?

It guides the agent through building a lightweight WebGL globe with cobe: canvas setup, markers, rotation and performance. React and Next.js integration is covered too.

Which pitfalls does the skill cover?

Canvas sizing mismatches, missing updates on resize, and DPR set too high on mobile. For the last one it advises clamping between 1 and 2.

Source text

SKILL.md · MIT
---
name: cobejs
description: Use when adding a lightweight interactive globe with cobe (canvas setup, markers, interaction, performance, integration with React/Next.js).
---

# cobe.js — Lightweight WebGL Globe Skill

## When to use
- A “spinning globe” / location markers in hero or about pages
- You want a small, focused globe lib (not full three.js)
- Decorative + interactive (markers, rotation) with minimal setup

## Key APIs/patterns
- Core:
  - `import createGlobe from "cobe"`
  - `const globe = createGlobe(canvas, { ...options, onRender(state) { ... } })`
- Important options (common):
  - `devicePixelRatio`, `width`, `height`
  - `phi`, `theta` (rotation angles)
  - `scale`, `dark`, `diffuse`
  - `baseColor`, `markerColor`, `glowColor`
  - `markers: [{ location: [lat, lon], size, color? }]`
- Lifecycle:
  - `globe.toggle()` pauses RAF
  - `globe.destroy()` removes instance

## Common pitfalls
- Canvas sizing mismatch
  - Set CSS size AND set canvas `width/height` scaled for DPR.
- Not updating on resize
  - Recompute width/height and recreate or update params.
- Too high DPR on mobile
  - Clamp DPR to 1–2.

## Quick recipe: responsive globe with markers
```js
import createGlobe from "cobe";

const canvas = document.getElementById("cobe");
let phi = 0;

function setup() {
  const rect = canvas.getBoundingClientRect();
  const dpr = Math.min(window.devicePixelRatio, 2);
  canvas.width = Math.round(rect.width * dpr);
  canvas.height = Math.round(rect.height * dpr);

  const globe = createGlobe(canvas, {
    devicePixelRatio: dpr,
    width: canvas.width,
    height: canvas.height,
    phi: 0,
    theta: 0.2,
    dark: 0,
    diffuse: 1.2,
    scale: 1,
    mapSamples: 16000,
    mapBrightness: 6,
    baseColor: [0.2, 0.2, 0.25],
    glowColor: [1, 1, 1],
    markerColor: [0.8, 0.5, 1],
    markers: [{ location: [1.3521, 103.8198], size: 0.08 }],
    onRender: (state) => {
      state.phi = phi;
      phi += 0.01;
    },
  });

  return globe;
}

let globe = setup();
window.addEventListener("resize", () => {
  globe.destroy();
  globe = setup();
});
```

## What to ask the user
- Globe size and placement (hero, section, card)?
- Marker locations + colors (brand-aligned)?
- Interaction needs (drag to rotate vs. ambient spin)?

© MengTo · MIT · MengTo/Skills

Similar skills

Everything for Frontend and UI →

From the same set148

gsap-scrolltrigger-storytelling A skill for scroll-driven product storytelling: pinned scenes, progressive UI reveals and transitions between sections, built on GSAP ScrollTrigger. CX Codex +1 1,800installs tailwindcss A skill that steers your coding agent through Tailwind CSS UI work: layout, typography, responsive variants, theming and component patterns. CX Codex +1 1,700installs optimize-web-animations Pauses offscreen CSS, Canvas, and WebGL animations and fixes frontend memory leaks. Useful when long browser sessions or heavy page effects cause janky scrolling and high CPU load. CX Codex +1 1,700installs progressive-blur This skill creates a top or bottom CSS progressive blur with layered backdrop-filter masks. Use it for a soft fade at the viewport edge. CX Codex +1 1,700installs webgl-3d-object Guides coding agents to generate standalone Three.js 3D objects with physical materials, directional lighting, and proper memory cleanup. CX Codex +1 1,600installs video-to-superprompt Turns a reference video into a detailed build prompt for UI, motion and scrolling behavior. Use it before recreating a page or app from a video demo. CX Codex +1 1,600installs pricing-page Walks an agent through designing or rewriting a SaaS pricing page: structure, plan design, copy, FAQ, and SEO/AEO markup. CX Codex +1 1,600installs webgl-landing-steering Guides visual direction, Three.js architecture, and performance budgets for WebGL landing pages before writing front-end code. CX Codex +1 1,600installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor