Monochrome particle
Skill itsyuvallavi/monochrome-particle/skills/monochrome-particle
Agent Skill for a configurable Three.js monochrome particle wave background
npx -y skills add itsyuvallavi/monochrome-particle --skill monochrome-particleAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Build or port a configurable full-viewport Three.js layered particle wave background using Points, ShaderMaterial, GLSL waves, soft sprite textures, additive blending, and mobile/desktop density tiers. Use for Next.js/React canvas backgrounds, Three.js Points shaders, monochrome dots, particle wave, animated hero backdrop, or requests to change particle colors, speed, direction, density, point size, opacity, or camera zoom. Portable Markdown instructions: applies in any coding agent or IDE that loads SKILL.md (Cursor, Claude Code, OpenAI Codex, Google Gemini, Windsurf, JetBrains AI, Copilot Chat, VS Code–based agents, or paste into web UIs). Does NOT cover page transitions, SandstormProvider, sandstorm hooks, button-triggered navigation, or route orchestration; only the static/ambient background.
SKILL.md
10.7 KB, ~2.4k tokens by cl100k_base, as published. Nobody here has run it
Monochrome Particle
Portability
This package is not Cursor-specific. It is a portable SKILL.md plus supporting Markdown and a TypeScript example. Use it anywhere the model can read files or pasted instructions:
- Cursor: project or user
.cursor/skills/monochrome-particle/, ornpx skills add itsyuvallavi/monochrome-particlewhen supported. - Other IDEs and agents: follow that product’s documented location for skills, rules, custom instructions, or repository context; if none exists, attach
SKILL.mdandreference.mdto the chat or add them to your project’s agent configuration file.
Tool-specific install mechanics may differ; the implementation contract (customization surface, shaders, cleanup) does not.
Scope
Build a background-only React/Next.js component that owns a fixed full-viewport canvas, WebGLRenderer, layered THREE.Points, buffer geometry with delay and particleDist attributes (never name an attribute distance; it clashes with the GLSL builtin distance()), vertex + fragment shaders, circular sprite texture, animation loop, resize handling, visibility handling, and full WebGL cleanup. Use an orthographic camera whose left/right/top/bottom match the particle grid bounds (viewport half-size plus the same edge buffer used for the grid) so the field always fills the drawable area without perspective frustum clipping (black side gutters).
Do not implement or document these as part of this skill:
SandstormProvider,sandstorm-transition,stormIntensityRef, or syncing storm intensity to routes- "Explore work" or any other button driving the background or navigation
contentOpacityFromStormIntensityor fading page chrome with storm- Any Next.js transition tied to clicking a CTA
If a source implementation contains storm shader code, remove it or keep uStormIntensity fixed at 0. Do not add context providers or navigation triggers.
Customization Contract
Every implementation generated from this skill must expose a simple prop or config API so future LLM requests can safely change the visual result without editing raw shader constants.
Required customization surface:
colors: three gradient stops (start,mid,end) as hex strings or RGB valuesspeed: animation speed multiplierdirection:{ x, y }flow vector used by the wave shaderdensity: particle density multiplier; changing it rebuilds geometrypointSize: point-size multiplieropacity: alpha multiplierzoom: orthographic “camera zoom” (1= full half-extents; larger values zoom in / center crop). Shipped example default1.9. Update the frustum when this changes; no particle rebuild required.
Prefer shader uniforms for runtime-safe visual changes:
uColorStart,uColorMid,uColorEnduFlowDirectionuPointSizeMultiplieruOpacityMultiplier
When the user asks "make it blue and gold", "slow it down", "reverse direction", "make it denser", "make the dots smaller", or similar, edit the config/props first. Do not ask the user to edit GLSL constants for common visual changes.
Optional JSON (or other static config) file
The contract is props on MonochromeDotsBackground (or equivalent). A separate file is not required for correctness.
For demos, Vite apps, or “tune without touching JSX” workflows, it is recommended to keep the same keys in a JSON file (e.g. src/particle-config.json or src/config/backgroundConfig.json), import it in the app root, and spread or pass fields as props. In TypeScript, enable resolveJsonModule: true in the app tsconfig when importing JSON.
Example shape (matches DEFAULT_CONFIG in reference.md):
{
"colors": { "start": "#14b8d2", "mid": "#b066ec", "end": "#ec599e" },
"speed": 1.5,
"direction": { "x": 1, "y": 0.2 },
"density": 1,
"pointSize": 1,
"opacity": 1,
"zoom": 1.9
}
Implementation Recipe
- Use a
"use client"React component withuseEffectanduseRef(Next.js App Router); in Vite or CRA you can omit the directive. - If you mirror props into a ref for the animation loop, derive the object with
useMemoand assignref.currentinsideuseEffect. Do not write toref.currentduring render — React 19’s ESLint plugin reports that as “Cannot access refs during render”. - Install
threeand@types/three. - Use
OrthographicCamerawithleft,right,top,bottomset each rebuild to±(width/2 + buffer)and±(height/2 + buffer)using the samebufferas the particle grid margin. Position the camera on +Z (e.g. 500) andlookAt(0,0,0). Trade-off: no perspective foreshortening; the field looks slightly flatter than with a perspective camera. - Drawable CSS size: implement
readDrawableCssSize(canvas)and use itswidth/heightfor grid math, orthographic frustum updates, andrenderer.setSize. Take the maximum (per axis) of:canvas.clientWidth,getBoundingClientRect()width/height,window.innerWidth/innerHeight,document.documentElement.clientWidth/clientHeight, andvisualViewportwidth/height when defined—so the buffer is never narrower than the painted layout wheninnerWidthlags split sidebars, mobile chrome, or first paint. - Wrap the canvas in a full-bleed layout box: e.g.
position: fixed; inset: 0; width: 100dvw; height: 100dvh(or equivalent), and make the canvasposition: absolute; inset: 0; width/height: 100%; display: block; max-width: none; margin: 0; padding: 0. Layout owns display size; the renderer must not usesetSize(..., true)(do not let Three.js set inline canvas dimensions that fight CSS). - Use
WebGLRendererwithpowerPreference: "high-performance",alpha: false,depth: false,stencil: false, and capped DPR (Math.min(devicePixelRatio, 2)). - Call
renderer.setSize(width, height, false)wherewidth/heightcome fromreadDrawableCssSize(canvas). - Build 2 to 3 particle layers using
BufferGeometry,ShaderMaterial,THREE.Points, and additive blending. Setpoints.frustumCulled = falseso largegl_PointSizedoes not disappear at the frustum edge. - Generate a 32x32 radial-gradient canvas texture for soft circular particles.
- Use distance from the top-left plane origin for the cyan/purple/pink-style gradient, but keep actual colors configurable through uniforms.
- Animate with
requestAnimationFrame, time deltas, and a capped delta to avoid jumps after tab inactivity. - Skip rendering while the tab is hidden.
- Update common visual props (
colors,speed,direction,pointSize,opacity) through refs/uniforms without recreating the WebGL renderer. Updatezoomby changing the orthographic frustum (same drawable width/height; divide half-extents byzoom), not by rebuilding points. - Rebuild particle geometry on density changes or whenever drawable size changes. Debounce rapid
ResizeObservercallbacks withrequestAnimationFrame. On first mount, run two nestedrequestAnimationFrameticks before the first size-dependent build soclientWidth/clientHeightare not zero. - On cleanup, cancel rAF, disconnect
ResizeObserver, remove listeners, dispose textures/geometries/materials/renderer, and clear the scene.
Files To Read
- Read
FULL_BLEED_CANVAS.md(this folder) for edge-to-edge layout,readDrawableCssSize,setSize(..., false), resize observers, and anti-pillarboxing rules—read this before changing sizing or CSS. - Read
reference.mdfor shader contracts, sizing, layers, and performance rules. - Read
examples/MonochromeDotsBackground.tsxfor a complete background-only component: full-bleed wrapper + canvas,readDrawableCssSize, orthographic camera,setSize(..., false),ResizeObserver+window+visualViewport, optionaldocument.bodyportal, and prop-driven customization. - Optional:
examples/particle-config.example.json— copy into your app as e.g.src/particle-config.jsonand import as documented in Optional JSON in this file and inreference.md.
The repository root also has FULL_VIEWPORT_PARTICLE_BACKGROUND.md (extra ortho/parity notes). FULL_BLEED_CANVAS.md is duplicated in this skill folder so vendoring only skills/monochrome-particle/ still includes the full-bleed guide.
Integration
- Mount the component once near the app root. Ensure
#root(or your app shell) is full width or sits above the background withposition: relative; z-index: 1+so a narrowmax-widthon#rootdoes not crop the wrapper if the background stays in-tree. - Default: keep the background in the React tree (no portal) for predictable refs and Vite/CSR dev; opt in to
createPortal(..., document.body)only when#rootis narrow orfixedstacking is unreliable. - The example uses an inline-style full-bleed wrapper (
100dvw/100dvh,fixed,inset: 0) and an absolutely inset canvas at100%×100%. - Avoid negative z-index on the wrapper unless the stacking context is controlled; otherwise the body background can hide WebGL.
- Wire resize to
window,visualViewport(if defined), andResizeObserveron the canvas, wrapper, and optionallydocument.documentElement; coalesce withrequestAnimationFrame. - Keep the component independent from routes, buttons, and page transitions.
Verification
- Changing
colors,speed,direction,density,pointSize,opacity, orzoomproduces the expected visual change. - Resize, rotation, mobile browser chrome show/hide, and tab hide/show work without console errors; no black pillarboxing when the painted area is wider than a lagging
innerWidth. - Unmounting disposes textures, geometries, materials, and renderer resources.
- React StrictMode double-mounting in development can surface fragile WebGL init; prefer idempotent setup/teardown (or disable StrictMode locally while debugging-only if needed).
- No references to sandstorm, route transitions, or CTA-triggered navigation are introduced.
What ships with it: 4 files
31.6 KB alongside SKILL.md
examples/
- FULL_BLEED_CANVAS.md5.6 KB
- reference.md9.1 KB
Gives 0 of the 12 instructions most context ai engineering skills give in ~2.4k tokens
Counted across 1,193 of the 1,976 authors here whose files we hold, read 2026-08-07
- Dispatch a fresh implementer subagent per taskin 48 of 1193, across 19 files
- Dispatch a final code reviewer after all tasksin 33 of 1193, across 8 files
- Provide full task text to the subagentin 30 of 1193, across 9 files
- Review spec compliance before code qualityin 27 of 1193, across 10 files
- Make the hook script executablein 26 of 1193, across 8 files
- Re-snapshot after navigation or DOM changesin 25 of 1193, across 19 files
- Read files before editing themin 22 of 1193, across 11 files
- Answer subagent questions before proceedingin 22 of 1193, across 7 files
- Mark task complete in TodoWrite after approvalin 22 of 1193, across 6 files
- Merge hook into existing settingsin 21 of 1193, across 3 files
- Ask if installation is global or projectin 20 of 1193, across 2 files
- Copy the hook script to target locationin 20 of 1193, across 2 files
Said here and by no other author read
- use an orthographic camera
- expose a config API for props
- prefer shader uniforms for visual changes
- set renderer size using drawable CSS dimensions
- set points frustumCulled to false
- update common visual props through uniforms
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.