Command Palette

Search for a command to run...

UnylyUnyly
Back to skills

meshing-guidelines

FreeNo executable scriptsNot checked

Mesh gradient library for SwiftUI. Use for creating, animating, and exporting mesh gradients. Supports 2x2, 3x3, and 4x4 grid templates, animated gradients…

rryamby rryam★ 226 GitHub stars18 installs in other catalogs

About this skill

MeshingKit

MeshingKit is a Swift package for creating mesh gradients in SwiftUI. It provides 68 predefined gradient templates, animated gradients, Metal shader noise effects, and platform-specific export functionality.

Build Commands

# Swift Package Manager build
swift build

# Build for a specific target
swift build --target MeshingKit

# Xcode build for iOS Simulator
xcodebuild build -project Sources/Meshin/Meshin.xcodeproj -scheme Meshin -destination "generic/platform=iOS Simulator"

Test Commands

# Run tests with verbose output
swift test --verbose

# Run tests with code coverage
swift test --enable-code-coverage

Lint

# Run SwiftLint with strict mode
swiftlint --strict

# Pre-commit hook runs on staged files
# Setup: scripts/setup-hooks.sh

Architecture

Main API

MeshingKit.swift exposes static methods for creating gradients:

// Create a static mesh gradient
MeshingKit.gradient(template: myTemplate)

// Create an animated mesh gradient view
MeshingKit.animatedGradient(template: myTemplate)

// Create with custom animation pattern
MeshingKit.animatedGradient(template: template, animationPattern: .fluid)

Template System

GradientTemplate Protocol:

public protocol GradientTemplate: Sendable {
    var size: Int { get }
    var points: [SIMD2<Float>] { get }
    var colors: [Color] { get }
    var background: Color { get }
}

Custom Template Example:

struct MyGradient: GradientTemplate {
    var size: Int { 3 }

    var points: [SIMD2<Float>] {
        [
            SIMD2(0, 0), SIMD2(0.5, 0), SIMD2(1, 0),
            SIMD2(0, 0.5), SIMD2(0.5, 0.5), SIMD2(1, 0.5),
            SIMD2(0, 1), SIMD2(0.5, 1), SIMD2(1, 1)
        ]
    }

    var colors: [Color] {
        [.red, .green, .blue, .yellow, .purple, .orange, .pink, .cyan, .mint]
    }

    var background: Color { .black }
}

PredefinedTemplate Enum:

// All 68 templates
let allTemplates = PredefinedTemplate.allCases

// Search by name (uses NaturalLanguage)
let sunsetTemplates = PredefinedTemplate.find(by: "sunset")

// Access base template
let base = PredefinedTemplate.aurora.baseTemplate

Templates are organized by grid size:

  • GradientTemplateSize2 - 2x2 grids (4 points)
  • GradientTemplateSize3 - 3x3 grids (9 points)
  • GradientTemplateSize4 - 4x4 grids (16 points)

Key Views

AnimatedMeshGradientView: SwiftUI view for animated gradients with configurable speed.

ParameterizedNoiseView: Metal shader-based noise effect for textures and visual effects.

Search

PredefinedTemplate.find(by: token) uses:

  • NaturalLanguage framework for lemmatization
  • CamelCase splitting for method-style queries
  • Semantic matching for gradient names

Export APIs

ExportFormat Enum

public enum ExportFormat: String, CaseIterable, Identifiable, Sendable {
    case png, jpg, mp4
    public var id: Self { self }
    public var fileExtension: String { rawValue }
}

VideoExportError Enum

public enum VideoExportError: Error, Sendable {
    case frameRenderingFailed
    case failedToStartWriting
    case pixelBufferPoolCreationFailed
    case pixelBufferCreationFailed
    case failedToAppendPixelBuffer
    case failedToAddInput
    case failedToCreateOutputURL
    case fileNotAccessible
    case unsupportedFormat
    case photosPermissionDenied
}

iOS - Photo Library

saveGradientToPhotoAlbum:

@MainActor
static func saveGradientToPhotoAlbum(
    template: any GradientTemplate,
    size: CGSize,
    scale: CGFloat = 1.0,
    blurRadius: CGFloat = 0,
    showDots: Bool = false,
    smoothsColors: Bool = true,
    completion: @escaping (Result<Void, Error>) -> Void
)

exportVideoToPhotoLibrary:

static func exportVideoToPhotoLibrary(
    template: any GradientTemplate,
    size: CGSize,
    duration: TimeInterval = 5.0,
    frameRate: Int32 = 30,
    blurRadius: CGFloat = 0,
    showDots: Bool = false,
    animate: Bool = true,
    smoothsColors: Bool = true,
    completion: @escaping (Result<URL, Error>) -> Void
)

PhotoLibraryError:

public enum PhotoLibraryError: Error, Sendable {
    case permissionDenied
    case saveFailed(Error)
}

macOS - Disk Save

saveToDisk:

@MainActor
static func saveToDisk(
    image: NSImage,
    fileName: String = "gradient",
    format: ExportFormat = .png,
    completion: @escaping (Result<URL, Error>) -> Void
)

saveGradientToDisk:

@MainActor
static func saveGradientToDisk(
    template: any GradientTemplate,
    size: CGSize,
    scale: CGFloat = 1.0,
    blurRadius: CGFloat = 0,
    showDots: Bool = false,
    smoothsColors: Bool = true,
    fileName: String = "gradient",
    format: ExportFormat = .png,
    completion: @escaping (Result<URL, Error>) -> Void
)

exportVideo (macOS):

@MainActor
static func exportVideo(
    template: any GradientTe
Full SKILL.md on GitHub

Install meshing-guidelines in Claude Code & Claude Desktop

Sign up to install this skill

Create a free account to reveal the install command and save the skill to your library.

  • Reveal the one-line install command
  • Save skills to your synced library
  • Get notified when skills update
Sign up freeI already have an account

Allowed tools

Tools this skill is permitted to call.

Read
Grep
Glob
Edit
Write
Bash

FAQ

What does the meshing-guidelines skill do?

Mesh gradient library for SwiftUI. Use for creating, animating, and exporting mesh gradients. Supports 2x2, 3x3, and 4x4 grid templates, animated gradients, Metal shaders, and platform-specific export to photo library or disk.

How do I install the meshing-guidelines skill?

Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.

Does the meshing-guidelines skill run scripts?

No, this skill is instructions only (SKILL.md) with no executable scripts.

Related skills

Compare meshing-guidelines with