All skills
adithya-s-k avatar

/manimce-best-practices

@6668663
by Adithya S Kadithya-s-k/manim_skill1.1k stars
94

Trigger when: (1) User mentions "manim" or "Manim Community" or "ManimCE", (2) Code contains `from manim import *`, (3) User runs `manim` CLI commands, (4) Working with Scene, MathTex, Create(), or ManimCE-specific classes. Best practices for Manim Community Edition - the community-maintained Python animation engine. Covers Scene structure, animations, LaTeX/MathTex, 3D with ThreeDScene, camera control, styling, and CLI usage. NOT for ManimGL/3b1b version (which uses `manimlib` imports and `manimgl` CLI).

Use this Skill: https://skilld.dev/gh/adithya-s-k/manim_skill/manimce-best-practices

This session only. Nothing lands on disk.

rulesconfig.md

≈1.1k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Configuration

Configure Manim's behavior through files and code.

Configuration Hierarchy

Manim reads configuration from (in order of precedence):

  1. Command-line arguments (highest priority)
  2. User's manim.cfg in current directory
  3. User's global config
  4. Default values (lowest priority)

manim.cfg File

Create a manim.cfg file in your project directory:

[CLI]
# Preview after rendering
preview = True

# Default quality
quality = medium_quality

# Output format
format = mp4

# Frame rate
frame_rate = 30

[output]
# Custom output directory
media_dir = ./media

# Save last frame as PNG
save_last_frame = False

[renderer]
# Background color
background_color = BLACK

[style]
# Default font
font = Arial

Common Configuration Options

CLI Section

[CLI]
# Quality presets: low_quality, medium_quality, high_quality, production_quality, fourk_quality
quality = medium_quality

# Preview video after rendering
preview = True

# Frame rate
frame_rate = 30

# Output format: mp4, gif, mov, webm, png
format = mp4

# Transparent background
transparent = False

# Progress bar: display, leave, none
progress_bar = display

Rendering Section

[renderer]
# Background color (hex or color name)
background_color = #1e1e1e

# Renderer type: cairo, opengl
renderer = cairo

Resolution

[CLI]
# Frame dimensions
pixel_width = 1920
pixel_height = 1080

Programmatic Configuration

Access and modify config in your Python code:

# Access config values
config.pixel_width  # e.g., 1920
config.frame_rate  # e.g., 30
config.background_color  # e.g., BLACK

# Modify config (before creating scenes)
config.pixel_width = 1920
config.pixel_height = 1080
config.frame_rate = 60
config.background_color = BLUE_E

In Scene

class MyScene(Scene):
    def construct(self):
        # Access frame dimensions
        width = config.frame_width
        height = config.frame_height

        # Create rectangle matching frame size
        frame_rect = Rectangle(
            width=width,
            height=height,
            stroke_color=WHITE
        )
        self.add(frame_rect)

Background Color

In Config File

[renderer]
background_color = BLACK
# Or hex color
background_color = #1a1a2e

In Code

class DarkBackground(Scene):
    def construct(self):
        self.camera.background_color = "#1a1a2e"
        # ... rest of scene

Output Directory Structure

Default media directory structure:

media/
├── videos/
│   └── scene_file/
│       ├── 480p15/       # Low quality
│       ├── 720p30/       # Medium quality
│       ├── 1080p60/      # High quality
│       └── 2160p60/      # 4K quality
├── images/
│   └── scene_file/
│       └── SceneName.png
└── Tex/                  # LaTeX cache

Custom Output Directory

[output]
media_dir = ./output

Or via CLI:

manim --media_dir ./output file.py Scene

Tex Configuration

For LaTeX rendering:

[tex]
# Custom preamble
preamble = \usepackage{amsmath}\usepackage{amssymb}

# Tex compiler
tex_compiler = latex

Caching

[CLI]
# Disable caching (useful for debugging)
disable_caching = True

# Max cached files
max_files_cached = 100

Viewing Current Config

# Show all config values
manim cfg show

# Show specific section
manim cfg show CLI

# Write current config to file
manim cfg write

Project-Specific Config

Create manim.cfg in your project root:

[CLI]
quality = high_quality
preview = True
frame_rate = 60

[renderer]
background_color = #0d1117

[output]
media_dir = ./renders

Plugins

Manim has an extensible plugin system:

# List installed plugins
manim plugins -l

# Install a plugin
pip install manim-pluginname

Enable plugins in manim.cfg:

[CLI]
plugins = manim-pluginname
# For multiple plugins:
plugins = plugin1,plugin2

Best Practices

  1. Use manim.cfg for project defaults - Consistent settings across team
  2. Keep quality low during development - Faster iteration
  3. Set background_color in config - Not in every scene
  4. Use custom media_dir - Keep renders organized
  5. Commit manim.cfg to version control - Share settings with collaborators

Source: SKILL.md on GitHub

No alerts17d5 checks · Risk SAFE
  • Gen Agent Trust Hub17d

    This skill is a comprehensive educational resource for the Manim Community Edition library. It provides best practices, templates, and example scripts for creating mathematical animations and visualizations. No security risks or malicious patterns were identified.

  • Socket17d

    No alerts

  • Snyk17d

    Risk: LOW · No issues

  • Runlayer7mo

    37 files scanned · No issues

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 6668663. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 months ago.

Dormantupdated 8 months ago
  • Python
  • manim
  • animation
  • latex
  • mathtex
  • 3d
  • rendering
  • scene
  • visualization

README badge

README badge for adithya-s-k/manim_skill/manimce-best-practices

Provides best practices and patterns for Manim Community Edition, the Python animation library for mathematical visualizations. Covers Scene structure, animations, LaTeX rendering, 3D graphics, positioning, and CLI usage with organized rule files, working examples, and templates.

Generated from the current SKILL.md.

Does this skill cover ManimGL or just Manim Community Edition?
Only Manim Community Edition (ManimCE). It does not apply to ManimGL/3b1b version, which uses `manimlib` imports and the `manimgl` CLI instead.
What topics are included in this skill?
Scene structure, mobjects, animations (creation, transformation, groups), text and LaTeX rendering, styling, positioning, 3D visualization, timing and updaters, camera control, CLI usage, and common geometric shapes.
Does this skill include working examples?
Yes. It includes five complete example files demonstrating basic animations, math visualization, updater patterns, graph plotting, and 3D visualization, plus three scene templates for 2D, camera-controlled, and 3D scenes.
What should I do if text rendering fails in my Manim scripts?
Check your manimpango installation requirements, as text rendering failures often stem from manimpango configuration issues. The skill also recommends running `manim checkhealth` to verify your overall installation.
How do I render a scene with different quality levels?
Use quality flags with the manim CLI: `-ql` for low quality (fast, development), `-qm` for medium, `-qh` for high, and `-qk` for 4K. For example: `manim -pqh scene.py MyScene`.

Generated from the current SKILL.md. These answers refresh after source changes.