Skip to content

tim-hub/powerball-harness / .claude/skills/generate-video

generate-video

Verified

Generates product demo videos and release walkthroughs via Remotion. Use when creating video documentation or animated demos.

FileKindSize
SKILL.mdskill md6.6 KB
assets/backgrounds/backgrounds.jsonconfig4.9 KB
assets/sounds/sounds.jsonconfig5.7 KB
package.jsonmanifest710 B
references/MIGRATION-11.2.mdmarkdown7.9 KB
references/analyzer.mdmarkdown4.5 KB
references/asset-customization.mdmarkdown11.2 KB
references/best-practices.mdmarkdown8.6 KB
references/direction-guide.mdmarkdown14.6 KB
references/generator.mdmarkdown25.9 KB
references/image-generator.mdmarkdown9.0 KB
references/image-patterns.mdmarkdown14.5 KB
references/image-quality-check.mdmarkdown6.9 KB
references/naming-conventions.mdmarkdown6.0 KB
references/planner.mdmarkdown7.6 KB
references/visual-effects.mdmarkdown11.0 KB
remotion/components/BackgroundLayer.tsxother7.5 KB
remotion/components/EmphasisBox.tsxother5.9 KB
remotion/components/ProgressIndicator.tsxother6.8 KB
remotion/components/README.mdmarkdown8.5 KB
remotion/components/TransitionWrapper.tsxother5.7 KB
remotion/components/index.tsscript1004 B
remotion/tsconfig.jsonconfig617 B
schemas/README.mdmarkdown8.1 KB
schemas/animation.schema.jsonconfig5.2 KB
schemas/assets.manifest.schema.jsonconfig5.9 KB
schemas/character.schema.jsonconfig16.0 KB
schemas/direction.schema.jsonconfig4.5 KB
schemas/emphasis.schema.jsonconfig8.6 KB
schemas/examples/scenario-example.jsonconfig1.6 KB
schemas/examples/scene-example.jsonconfig1.6 KB
schemas/examples/video-script-example.jsonconfig5.1 KB
schemas/examples/visual-patterns/comparison-example.jsonconfig1.0 KB
schemas/examples/visual-patterns/concept-example.jsonconfig2.1 KB
schemas/examples/visual-patterns/flow-example.jsonconfig1.8 KB
schemas/examples/visual-patterns/highlight-example.jsonconfig745 B
schemas/scenario.schema.jsonconfig3.6 KB
schemas/scene.schema.jsonconfig8.2 KB
schemas/validate-schemas-basic.jsscript2.7 KB
schemas/validate-schemas.jsscript6.6 KB
schemas/video-script.schema.jsonconfig7.6 KB
schemas/visual-patterns.schema.jsonconfig14.2 KB
scripts/README.mdmarkdown7.4 KB
scripts/generate-schemas.jsexecutablescript6.2 KB
scripts/load-assets.jsexecutablescript14.1 KB
scripts/merge-scenes.jsexecutablescript15.0 KB
scripts/render-video.jsexecutablescript14.0 KB
scripts/template-registry.jsexecutablescript10.0 KB
scripts/validate-scenario.jsexecutablescript8.0 KB
scripts/validate-scene.jsexecutablescript4.3 KB
scripts/validate-video.jsexecutablescript13.0 KB
src/schemas/animation.tsscript3.7 KB
src/schemas/assets.manifest.tsscript2.8 KB
src/schemas/character.tsscript6.5 KB
src/schemas/direction.tsscript3.2 KB
src/schemas/emphasis.tsscript5.2 KB
src/schemas/index.tsscript423 B
src/schemas/scenario.tsscript2.7 KB
src/schemas/scene.tsscript5.5 KB
src/schemas/video-script.tsscript9.4 KB
src/schemas/visual-patterns.tsscript8.2 KB
src/types/README.mdmarkdown4.1 KB
src/types/components.tsscript6.0 KB
src/types/index.tsscript108 B
src/utils/README.mdmarkdown6.1 KB
src/utils/converters.jsscript5.9 KB
src/utils/converters.tsscript5.7 KB
src/utils/index.tsscript109 B
templates/image-prompts/comparison.txtmarkdown1.3 KB
templates/image-prompts/concept.txtmarkdown2.3 KB
templates/image-prompts/flow.txtmarkdown2.8 KB
templates/image-prompts/highlight.txtmarkdown3.2 KB
templates/intro-3min.jsonconfig8.9 KB
templates/teaser-90s.jsonconfig7.0 KB
tests/asset-loader.test.jsscript12.1 KB
tests/character-schema.test.jsscript7.9 KB
tests/converters.test.jsscript8.3 KB
tests/determinism.test.jsscript11.4 KB
tests/e2e/merge-e2e.test.jsscript13.3 KB
tests/e2e/render.test.jsscript6.1 KB
tests/fixtures/minimal-video-script.jsonconfig1.2 KB
tests/merge-scenes.test.jsscript17.2 KB
tests/schema-validation.test.jsscript3.7 KB
tests/validation-integration.test.jsscript12.9 KB
tests/visual-patterns.test.jsscript12.1 KB

scripts/load-assets.js

View on GitHub
#!/usr/bin/env node

/**
 * Asset Loader Utility
 *
 * Loads backgrounds, sounds, and other assets with user override support.
 * Provides fallback defaults when files are missing.
 *
 * Usage:
 *   const { loadBackgrounds, loadSounds, updateManifest } = require('./load-assets.js');
 *   const backgrounds = await loadBackgrounds();
 *   const sounds = await loadSounds();
 */

const fs = require('fs');
const path = require('path');
const os = require('os');

// Asset directories
const SKILL_ROOT = path.join(__dirname, '..');
const ASSETS_DIR = path.join(SKILL_ROOT, 'assets');
const USER_ASSETS_DIR = path.join(os.homedir(), '.harness', 'video', 'assets');

/**
 * Load JSON file with error handling
 * @param {string} filePath - Path to JSON file
 * @returns {Object|null} Parsed JSON or null if not found
 */
function loadJSON(filePath) {
  try {
    if (!fs.existsSync(filePath)) {
      return null;
    }
    const content = fs.readFileSync(filePath, 'utf-8');
    return JSON.parse(content);
  } catch (error) {
    console.warn(`Warning: Failed to load ${filePath}: ${error.message}`);
    return null;
  }
}

/**
 * Load backgrounds with user override support
 *
 * Priority:
 * 1. ~/.harness/video/assets/backgrounds/backgrounds.json
 * 2. {skill}/assets/backgrounds/backgrounds.json
 * 3. Built-in defaults
 *
 * @returns {Object} Backgrounds configuration
 */
function loadBackgrounds() {
  console.log('๐ŸŽจ Loading backgrounds...');

  // Try user override
  const userBackgroundsPath = path.join(USER_ASSETS_DIR, 'backgrounds', 'backgrounds.json');
  const userBackgrounds = loadJSON(userBackgroundsPath);
  if (userBackgrounds) {
    console.log('  โœ… Loaded user backgrounds from:', userBackgroundsPath);
    return userBackgrounds;
  }

  // Try skill defaults
  const skillBackgroundsPath = path.join(ASSETS_DIR, 'backgrounds', 'backgrounds.json');
  const skillBackgrounds = loadJSON(skillBackgroundsPath);
  if (skillBackgrounds) {
    console.log('  โœ… Loaded skill backgrounds from:', skillBackgroundsPath);
    return skillBackgrounds;
  }

  // Fallback to built-in defaults
  console.log('  โš ๏ธ  No backgrounds.json found, using built-in defaults');
  return getDefaultBackgrounds();
}

/**
 * Load sounds with user override support
 *
 * Priority:
 * 1. ~/.harness/video/assets/sounds/sounds.json
 * 2. {skill}/assets/sounds/sounds.json
 * 3. Built-in defaults
 *
 * @returns {Object} Sounds configuration
 */
function loadSounds() {
  console.log('๐Ÿ”Š Loading sounds...');

  // Try user override
  const userSoundsPath = path.join(USER_ASSETS_DIR, 'sounds', 'sounds.json');
  const userSounds = loadJSON(userSoundsPath);
  if (userSounds) {
    console.log('  โœ… Loaded user sounds from:', userSoundsPath);
    return userSounds;
  }

  // Try skill defaults
  const skillSoundsPath = path.join(ASSETS_DIR, 'sounds', 'sounds.json');
  const skillSounds = loadJSON(skillSoundsPath);
  if (skillSounds) {
    console.log('  โœ… Loaded skill sounds from:', skillSoundsPath);
    return skillSounds;
  }

  // Fallback to built-in defaults
  console.log('  โš ๏ธ  No sounds.json found, using built-in defaults');
  return getDefaultSounds();
}

/**
 * Load specific asset file (image, audio, etc.) with user override
 *
 * Priority:
 * 1. ~/.harness/video/assets/{category}/{filename}
 * 2. {skill}/assets/{category}/{filename}
 * 3. null (file not found)
 *
 * @param {string} category - Asset category (backgrounds, sounds, fonts, etc.)
 * @param {string} filename - Asset filename
 * @returns {string|null} Absolute path to asset file or null
 */
function loadAssetFile(category, filename) {
  // Path traversal protection
  if (path.isAbsolute(category) || path.isAbsolute(filename)) {
    console.warn('โš ๏ธ Rejecting absolute path in loadAssetFile');
    return null;
  }
  const normalizedPath = path.normalize(path.join(category, filename));
  if (normalizedPath.includes('..') || normalizedPath.startsWith('/')) {
    console.warn('โš ๏ธ Rejecting path traversal attempt in loadAssetFile');
    return null;
  }

  // Try user override
  const userAssetPath = path.join(USER_ASSETS_DIR, category, filename);
  if (fs.existsSync(userAssetPath)) {
    console.log(`  โœ… Found user asset: ${category}/${filename}`);
    return userAssetPath;
  }

  // Try skill defaults
  const skillAssetPath = path.join(ASSETS_DIR, category, filename);
  if (fs.existsSync(skillAssetPath)) {
    console.log(`  โœ… Found skill asset: ${category}/${filename}`);
    return skillAssetPath;
  }

  // Not found
  console.warn(`  โš ๏ธ  Asset not found: ${category}/${filename}`);
  return null;
}

/**
 * Get default backgrounds (fallback)
 * @returns {Object} Default backgrounds configuration
 */
function getDefaultBackgrounds() {
  return {
    version: '1.0.0',
    backgrounds: [
      {
        id: 'neutral',
        name: 'Neutral',
        type: 'gradient',
        colors: { primary: '#f5f5f5', secondary: '#e0e0e0', accent: '#ffffff' },
        gradient: {
          type: 'linear',
          angle: 135,
          stops: [
            { color: '#ffffff', position: 0 },
            { color: '#f5f5f5', position: 50 },
            { color: '#e8e8e8', position: 100 }
          ]
        }
      },
      {
        id: 'highlight',
        name: 'Highlight',
        type: 'gradient',
        colors: { primary: '#fff9e6', secondary: '#ffe699', accent: '#ffd966' },
        gradient: {
          type: 'radial',
          stops: [
            { color: '#fffef5', position: 0 },
            { color: '#fff9e6', position: 40 },
            { color: '#ffe699', position: 100 }
          ]
        }
      },
      {
        id: 'dramatic',
        name: 'Dramatic',
        type: 'gradient',
        colors: { primary: '#1a1a2e', secondary: '#16213e', accent: '#0f3460' },
        gradient: {
          type: 'linear',
          angle: 225,
          stops: [
            { color: '#0a0a14', position: 0 },
            { color: '#1a1a2e', position: 30 },
            { color: '#16213e', position: 70 },
            { color: '#0f3460', position: 100 }
          ]
        }
      },
      {
        id: 'tech',
        name: 'Tech',
        type: 'pattern',
        colors: { primary: '#0d1b2a', secondary: '#1b263b', accent: '#415a77', grid: '#2d3e50' },
        gradient: {
          type: 'linear',
          angle: 180,
          stops: [
            { color: '#0d1b2a', position: 0 },
            { color: '#1b263b', position: 100 }
          ]
        },
        pattern: { type: 'grid', size: 40, lineWidth: 1, opacity: 0.15 }
      },
      {
        id: 'warm',
        name: 'Warm',
        type: 'gradient',
        colors: { primary: '#fff5eb', secondary: '#ffe6cc', accent: '#ffd9b3' },
        gradient: {
          type: 'radial',
          stops: [
            { color: '#fffaf5', position: 0 },
            { color: '#fff5eb', position: 30 },
            { color: '#ffe6cc', position: 100 }
          ]
        }
      }
    ]
  };
}

/**
 * Get default sounds (fallback)
 * @returns {Object} Default sounds configuration
 */
function getDefaultSounds() {
  return {
    version: '1.0.0',
    sounds: [
      {
        id: 'impact',
        name: 'Impact',
        category: 'emphasis',
        emphasis_level: 'high',
        volume: { default: 0.7, with_narration: 0.4, with_bgm: 0.6 }
      },
      {
        id: 'pop',
        name: 'Pop',
        category: 'emphasis',
        emphasis_level: 'medium',
        volume: { default: 0.5, with_narration: 0.25, with_bgm: 0.4 }
      },
      {
        id: 'transition',
        name: 'Transition',
        category: 'transition',
        emphasis_level: 'low',
        volume: { default: 0.4, with_narration: 0.2, with_bgm: 0.3 }
      },
      {
        id: 'subtle',
        name: 'Subtle',
        category: 'emphasis',
        emphasis_level: 'low',
        volume: { default: 0.3, with_narration: 0.15, with_bgm: 0.25 }
      }
    ]
  };
}

/**
 * Update asset manifest with loaded assets
 *
 * @param {string} manifestPath - Path to assets.manifest.json
 * @param {Object} assets - Assets to add to manifest
 * @returns {boolean} Success status
 */
function updateManifest(manifestPath, assets) {
  try {
    console.log('๐Ÿ“ Updating asset manifest...');

    // Load existing manifest or create new
    let manifest = loadJSON(manifestPath) || {
      version: '1.0.0',
      generated_at: new Date().toISOString(),
      project: {
        name: 'Unknown',
        video_id: 'video-' + Date.now()
      },
      assets: []
    };

    // Add new assets
    if (Array.isArray(assets)) {
      manifest.assets.push(...assets);
    } else {
      manifest.assets.push(assets);
    }

    // Update timestamp
    manifest.generated_at = new Date().toISOString();

    // Write manifest
    const manifestDir = path.dirname(manifestPath);
    if (!fs.existsSync(manifestDir)) {
      fs.mkdirSync(manifestDir, { recursive: true });
    }
    fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2));

    console.log('  โœ… Manifest updated:', manifestPath);
    return true;
  } catch (error) {
    console.error('  โŒ Failed to update manifest:', error.message);
    return false;
  }
}

/**
 * Get asset search paths (for debugging)
 *
 * @returns {Object} Asset search paths
 */
function getAssetPaths() {
  return {
    user: USER_ASSETS_DIR,
    skill: ASSETS_DIR,
    backgrounds: {
      user: path.join(USER_ASSETS_DIR, 'backgrounds'),
      skill: path.join(ASSETS_DIR, 'backgrounds')
    },
    sounds: {
      user: path.join(USER_ASSETS_DIR, 'sounds'),
      skill: path.join(ASSETS_DIR, 'sounds')
    }
  };
}

/**
 * Initialize user asset directory
 * Creates ~/.harness/video/assets/ structure
 *
 * @returns {boolean} Success status
 */
function initUserAssetDir() {
  try {
    console.log('๐Ÿ”ง Initializing user asset directory...');

    const dirs = [
      USER_ASSETS_DIR,
      path.join(USER_ASSETS_DIR, 'backgrounds'),
      path.join(USER_ASSETS_DIR, 'sounds'),
      path.join(USER_ASSETS_DIR, 'fonts'),
      path.join(USER_ASSETS_DIR, 'images')
    ];

    for (const dir of dirs) {
      if (!fs.existsSync(dir)) {
        fs.mkdirSync(dir, { recursive: true });
        console.log(`  โœ… Created: ${dir}`);
      } else {
        console.log(`  โ„น๏ธ  Already exists: ${dir}`);
      }
    }

    // Create README
    const readmePath = path.join(USER_ASSETS_DIR, 'README.md');
    if (!fs.existsSync(readmePath)) {
      fs.writeFileSync(readmePath, getUserAssetReadme());
      console.log(`  โœ… Created: ${readmePath}`);
    }

    console.log('  โœ… User asset directory initialized');
    return true;
  } catch (error) {
    console.error('  โŒ Failed to initialize user asset directory:', error.message);
    return false;
  }
}

/**
 * Get README content for user asset directory
 * @returns {string} README content
 */
function getUserAssetReadme() {
  return `# User Video Assets

This directory contains custom assets for video generation.

## Directory Structure

\`\`\`
~/.harness/video/assets/
โ”œโ”€โ”€ backgrounds/
โ”‚   โ””โ”€โ”€ backgrounds.json    # Custom background definitions
โ”œโ”€โ”€ sounds/
โ”‚   โ””โ”€โ”€ sounds.json         # Custom sound effect definitions
โ”œโ”€โ”€ fonts/
โ”‚   โ””โ”€โ”€ *.ttf, *.otf        # Custom fonts
โ””โ”€โ”€ images/
    โ””โ”€โ”€ *.png, *.jpg        # Custom images
\`\`\`

## Asset Priority

Assets in this directory override skill defaults:

1. **User assets** (~/.harness/video/assets/) - Highest priority
2. **Skill defaults** (skills/generate-video/assets/) - Fallback
3. **Built-in defaults** (hardcoded) - Last resort

## Customization

### Backgrounds

Copy and modify \`backgrounds.json\` from skill defaults:

\`\`\`bash
cp {skill}/assets/backgrounds/backgrounds.json ~/.harness/video/assets/backgrounds/
\`\`\`

Edit colors, gradients, and usage settings.

### Sounds

Copy and modify \`sounds.json\` from skill defaults:

\`\`\`bash
cp {skill}/assets/sounds/sounds.json ~/.harness/video/assets/sounds/
\`\`\`

Add your own audio files and update file paths.

### Fonts

Place custom font files in \`fonts/\` directory:

\`\`\`bash
cp MyFont-Bold.ttf ~/.harness/video/assets/fonts/
\`\`\`

Reference in scene configurations.

### Images

Place custom images (logos, icons) in \`images/\` directory:

\`\`\`bash
cp logo.png ~/.harness/video/assets/images/
\`\`\`

Reference in scene configurations.

## Example

\`\`\`json
// backgrounds.json
{
  "version": "1.0.0",
  "backgrounds": [
    {
      "id": "my-brand",
      "name": "My Brand",
      "type": "gradient",
      "colors": {
        "primary": "#your-color",
        "secondary": "#another-color"
      }
    }
  ]
}
\`\`\`

## Notes

- JSON files must be valid JSON
- Audio files should be MP3 or WAV format
- Image files should be PNG or JPG format
- Font files should be TTF or OTF format

For more information, see: skills/generate-video/references/asset-customization.md
`;
}

// CLI usage
if (require.main === module) {
  const command = process.argv[2];

  switch (command) {
    case 'backgrounds':
      console.log(JSON.stringify(loadBackgrounds(), null, 2));
      break;
    case 'sounds':
      console.log(JSON.stringify(loadSounds(), null, 2));
      break;
    case 'paths':
      console.log(JSON.stringify(getAssetPaths(), null, 2));
      break;
    case 'init':
      initUserAssetDir();
      break;
    case 'test':
      console.log('๐Ÿงช Testing asset loader...\n');
      loadBackgrounds();
      console.log('');
      loadSounds();
      console.log('');
      console.log('๐Ÿ“‚ Asset paths:');
      console.log(JSON.stringify(getAssetPaths(), null, 2));
      break;
    default:
      console.log(`
Asset Loader Utility

Usage:
  node load-assets.js backgrounds   # Load backgrounds configuration
  node load-assets.js sounds        # Load sounds configuration
  node load-assets.js paths         # Show asset search paths
  node load-assets.js init          # Initialize user asset directory
  node load-assets.js test          # Test all loading functions

Programmatic Usage:
  const { loadBackgrounds, loadSounds } = require('./load-assets.js');
  const backgrounds = loadBackgrounds();
  const sounds = loadSounds();
`);
  }
}

// Export functions
module.exports = {
  loadBackgrounds,
  loadSounds,
  loadAssetFile,
  updateManifest,
  getAssetPaths,
  initUserAssetDir
};
rea-changelog-updatemorluto/reaPrepare or rewrite REA release changelogs and GitHub release notes from pinned Git history, with verified contributor thanks and Release Please synchronization.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
academy-guideanthropics/skillsStop and check this skill before finishing any reply to a question about how to use Claude or a Claude product โ€” it recommends matching courses, tutorials, and use cases from Claude Academy (academy.claude.com), Anthropic's learning hub. Trigger on: "how do I", "how can I", "getting started with", "what can Claude do", "teach me", "learn to use"; questions about artifacts, projects, skills, plugins, connectors, MCP; requests about rolling Claude out to a team, class, or organization; and any ask for training materials, onboarding content, or learning resources. Use it when the user is learning how to use a feature or product โ€” not when they are mid-task and just want the task done. This skill composes with other skills: after consulting product documentation to answer how a Claude feature works, also check here for a matching course or tutorial โ€” a docs-grounded answer and an Academy recommendation belong together. Only recommend on a strong match; never invent Academy content.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
claude-apianthropics/skillsReference for the Claude API / Anthropic SDK โ€” model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER โ€” read BEFORE opening the target file; don't skip because it "looks like a one-liner" โ€” whenever: the prompt names Claude/Anthropic in any form (Claude, Anthropic, Fable, Opus, Sonnet, Haiku, `anthropic`, `@anthropic-ai`, `claude-*`, `us.anthropic.*`, `[1m]`); the user asks about an LLM (pricing/model choice/limits/caching) โ€” never answer from memory; OR the task is LLM-shaped with provider unstated (agent/MCP/tool-definition/multi-agent/RAG/LLM-judge/computer-use; generate/summarize/extract/classify/rewrite/converse over NL; debugging refusals/cutoffs/streaming/tool-calls/tokens). SKIP only when another provider is being worked on (overrides all triggers): OpenAI/GPT/Gemini/Llama/Mistral/Cohere/Ollama named in the query; OR `grep -rE 'openai|langchain_openai|google.generativeai|genai|mistralai|cohere|ollama'` over the project hits (run this grep FIRST if no provider named โ€” don't Read the file).Stars: 198kUpdated Claude CodeCodexUnverifiedInstall
doc-coauthoringanthropics/skillsGuide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision docs, or similar structured content. This workflow helps users efficiently transfer context, refine content through iteration, and verify the doc works for readers. Trigger when user mentions writing docs, creating proposals, drafting specs, or similar documentation tasks.Stars: 198kUpdated Claude CodeCodexVerifiedInstall