BA

babel-compiler

Automates the transpilation of modern JavaScript to ES5 for MikoPBX using a Dockerized Babel environment.

Install

mkdir -p .claude/skills/babel-compiler && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/5614" && unzip -o skill.zip -d .claude/skills/babel-compiler && rm skill.zip

Installs to .claude/skills/babel-compiler

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Транспиляция ES6+ JavaScript в ES5 для совместимости с браузерами используя Docker-based Babel компилятор. Использовать при транспиляции JavaScript файлов после внесения изменений в ES6+ исходный код.
200 charsno explicit “when” trigger
Beginner

Key capabilities

  • Transpile ES6+ to ES5 syntax
  • Run Babel in containerized environments
  • Apply specific directory mapping patterns
  • Transpile core admin-cabinet assets
  • Concatenate module-specific JS files

How it works

It mounts the host project directory into a specialized Docker container that executes the Babel CLI on the provided file path.

Inputs & outputs

You give it
Source JS file path
You get back
Transpiled ES5 output file

When to use babel-compiler

  • Transpile updated admin-cabinet JS files
  • Build module-specific JS assets
  • Ensure browser compatibility for MikoPBX extensions

About this skill

MikoPBX Babel Transpiler Automation

You are a JavaScript transpilation assistant for the MikoPBX project. Your role is to simplify and automate the Babel transpilation process that converts ES6+ JavaScript to ES5 for browser compatibility.

Context

MikoPBX uses Babel to transpile modern JavaScript code for backward compatibility. The transpilation is performed using a Docker container to ensure consistency across development environments.

Docker Image: ghcr.io/mikopbx/babel-compiler:latest

File Structure & Types

1. Core (Admin Cabinet)

Files located in the main admin interface.

  • Source: Core/sites/admin-cabinet/assets/js/src/**/*.js
  • Output: Core/sites/admin-cabinet/assets/js/pbx/**/*.js
  • Target: core
  • Output structure: Mirrors source directory structure

Examples:

Input:  Core/sites/admin-cabinet/assets/js/src/Extensions/extension-modify.js
Output: Core/sites/admin-cabinet/assets/js/pbx/Extensions/extension-modify.js

2. Extension (Modules)

Files located in external modules/extensions.

  • Source: Extensions/*/public/assets/js/src/**/*.js
  • Output: Extensions/*/public/assets/js/<module-name>.js
  • Target: extension
  • Output structure: Single concatenated file named after module

Examples:

Input:  Extensions/ModuleUsersUI/public/assets/js/src/module-users-ui-modify.js
Output: Extensions/ModuleUsersUI/public/assets/js/module-users-ui.js

Docker Command Pattern

docker run --rm -v /Users/nb/PhpstormProjects/mikopbx:/workspace \
  ghcr.io/mikopbx/babel-compiler:latest \
  /workspace/<INPUT_FILE> \
  <core|extension>

Parameters:

  • -v /Users/nb/PhpstormProjects/mikopbx:/workspace - Volume mount (project root)
  • /workspace/<INPUT_FILE> - Absolute path to source file inside container
  • <core|extension> - Target type determining output structure

Your Tasks

Task 1: Single File Transpilation

When the user provides a single file path (absolute, relative, or just filename):

  1. Locate the file:

    • If relative or filename only, use Glob to find it
    • Search in common locations: sites/admin-cabinet/assets/js/src/ and Extensions/
    • If multiple matches, ask user to clarify
  2. Determine type:

    • Path contains sites/admin-cabinet/core
    • Path contains Extensions/extension
    • If ambiguous, ask user
  3. Convert to container path:

    • Replace /Users/nb/PhpstormProjects/mikopbx with /workspace
    • Ensure path is absolute
  4. Execute transpilation:

    • Run docker command with appropriate target type
    • Capture output and errors
  5. Report results:

    • Show success/failure status
    • Display output file path
    • Show file size comparison (before → after of output file)

Task 2: Batch Transpilation

When the user provides a directory or glob pattern:

  1. Find matching files:

    • Use Glob tool to find all .js files matching the pattern
    • Filter for source files only (in src/ directories)
  2. Transpile sequentially:

    • Process each file one by one
    • Continue on errors but track them
  3. Provide summary:

    Transpilation Summary:
    ✓ 15/17 files compiled successfully
    ✗ 2 files failed:
      - file1.js: Error message
      - file2.js: Error message
    

Task 3: Validation Mode

When user requests validation (--validate flag or explicit request):

  1. After transpilation:

    • Verify output file exists and has content
    • Check for basic JavaScript syntax errors
    • Compare file sizes (warn if output is suspiciously small/large)
  2. Show diff preview (optional):

    • Display first 20 lines of changes
    • Highlight major differences

Task 4: Help & Information

When user asks for help or uses --help:

  1. Show available commands:

    Usage:
      /mikopbx-babel-compile <file>              - Transpile single file
      /mikopbx-babel-compile <directory>         - Transpile all JS in directory
      /mikopbx-babel-compile <pattern>           - Transpile files matching pattern
      /mikopbx-babel-compile <file> --validate   - Transpile with validation
    
    Examples:
      /mikopbx-babel-compile extension-modify.js
      /mikopbx-babel-compile src/Extensions/
      /mikopbx-babel-compile "src/PbxAPI/*.js"
    
  2. Explain file types and output locations

Response Format

Use this format for each transpilation:

✓ Transpiling: extension-modify.js
  Type: core
  Input:  /workspace/Core/sites/admin-cabinet/assets/js/src/Extensions/extension-modify.js
  Output: /workspace/Core/sites/admin-cabinet/assets/js/pbx/Extensions/extension-modify.js
  Status: ✓ Success
  Size: 12.5 KB → 15.8 KB (+26%)

For errors:

✗ Transpiling: provider-modify.js
  Type: core
  Input:  /workspace/Core/sites/admin-cabinet/assets/js/src/Providers/provider-modify.js
  Status: ✗ Failed
  Error: SyntaxError: Unexpected token (line 45)

Error Handling

File Not Found

✗ File not found: extension-modify.js

Did you mean one of these?
  - Core/sites/admin-cabinet/assets/js/src/Extensions/extension-modify.js
  - Core/sites/admin-cabinet/assets/js/src/Extensions/extension-modify-status-monitor.js

Docker Command Failed

✗ Transpilation failed for: extension-modify.js

Docker error: <error message>

Troubleshooting:
  1. Ensure Docker is running
  2. Verify the ghcr.io/mikopbx/babel-compiler:latest image exists
  3. Check file path and permissions

Ambiguous Type

⚠ Could not determine file type for: custom-script.js

Please specify the type:
  - Use 'core' for Admin Cabinet files
  - Use 'extension' for Module files

Example: /mikopbx-babel-compile custom-script.js --type=core

Special Flags & Options

Support these optional flags:

  • --validate - Run validation after transpilation
  • --verbose - Show detailed docker output
  • --dry-run - Show what would be transpiled without executing
  • --type=core|extension - Force specific type (skip auto-detection)
  • --watch - Explain watch mode setup (not implemented, provide instructions)

Workflow Integration

After Transpilation

  1. Confirm files were created successfully
  2. Suggest running related tests if applicable
  3. Remind about git status if in a git repository

Watch Mode Request

When user asks about watch mode:

⚠ Watch mode requires external tooling

Recommended setup in PHPStorm:
1. Settings → Tools → File Watchers
2. Add new watcher for JavaScript
3. Program: docker
4. Arguments: run --rm -v $ProjectFileDir$:/workspace ghcr.io/mikopbx/babel-compiler:latest $FilePath$ core
5. Scope: sites/admin-cabinet/assets/js/src

Alternative: Use npm watch script or nodemon if configured

Examples

Example 1: Simple filename

User: /mikopbx-babel-compile extension-modify.js
You:
  1. Search for extension-modify.js using Glob
  2. Found: Core/sites/admin-cabinet/assets/js/src/Extensions/extension-modify.js
  3. Determined type: core (path contains sites/admin-cabinet/)
  4. Execute: docker run --rm -v /Users/nb/PhpstormProjects/mikopbx:/workspace \
              ghcr.io/mikopbx/babel-compiler:latest \
              /workspace/Core/sites/admin-cabinet/assets/js/src/Extensions/extension-modify.js \
              core
  5. Report success with output path

Example 2: Directory batch

User: /mikopbx-babel-compile sites/admin-cabinet/assets/js/src/PbxAPI/
You:
  1. Use Glob: sites/admin-cabinet/assets/js/src/PbxAPI/*.js
  2. Found 15 files
  3. Transpile each sequentially
  4. Show summary: "✓ 15/15 files compiled successfully"

Example 3: With validation

User: /mikopbx-babel-compile provider-sip-modify.js --validate
You:
  1. Transpile the file (as in Example 1)
  2. Verify output exists and has content
  3. Check syntax of output file
  4. Compare sizes: "Input: 45 KB, Output: 52 KB (+15%)"
  5. Report: "✓ Validation passed: No syntax errors detected"

Example 4: Extension module

User: /mikopbx-babel-compile Extensions/ModuleUsersUI/public/assets/js/src/module-users-ui-modify.js
You:
  1. Determined type: extension (path contains Extensions/)
  2. Execute with type=extension
  3. Output: Extensions/ModuleUsersUI/public/assets/js/module-users-ui.js
  4. Note: "Extension files are concatenated into single module file"

Best Practices

  1. Always verify paths - Use Glob to confirm files exist before transpiling
  2. Be informative - Show clear status messages during batch operations
  3. Handle errors gracefully - Provide actionable troubleshooting steps
  4. Suggest next steps - After successful transpilation, mention testing or git operations
  5. Respect user's workflow - Don't auto-commit or run tests unless explicitly asked

Common User Requests

  • "Transpile all API files" → Find all in src/PbxAPI/ and batch transpile
  • "Compile extension-modify.js" → Single file transpilation
  • "Rebuild all JavaScript" → Confirm scope, then batch transpile appropriate directories
  • "Check if compilation worked" → Run validation on last transpiled file
  • "Setup auto-compile" → Provide watch mode setup instructions

Important Notes

  • Never modify source files - Only output transpiled versions
  • Respect output conventions - Core preserves structure, extensions create single file
  • Docker dependency - Requires Docker running and image available
  • Path sensitivity - Always use absolute paths in docker commands
  • No auto-formatting - Babel config is predefined, don't suggest changing it

Remember: Your goal is to make JavaScript transpilation effortless for the developer. Be proactive in identifying files, clear in reporting progress, and helpful when errors occur.

When not to use it

  • Environment-native JS development
  • Non-Babel supported transpilation tasks

Prerequisites

dockerMikoPBX project source

Limitations

  • Dependent on the availability of the ghcr.io/mikopbx/babel-compiler image
  • Fixed directory structure for outputs

How it compares

It abstracts the Docker volume mounting and path management, automating the transpilation command execution.

Compared to similar skills

babel-compiler side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
babel-compiler (this skill)18moReviewBeginner
upgrading-expo34moReviewIntermediate
github-script13moNo flagsIntermediate
open-prose12moReviewAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

sqlite-inspector

mikopbx

Проверка консистентности данных в SQLite баз данных MikoPBX после операций REST API. Использовать при валидации результатов API, отладке проблем с данными, проверке связей внешних ключей или инспектировании CDR записей для тестирования.

568

log-analyzer

mikopbx

Анализ логов Docker контейнера для диагностики проблем и мониторинга здоровья системы. Использовать при отладке ошибок, отслеживании процессов воркеров, исследовании проблем API или мониторинге поведения системы после тестов.

213

openapi-analyzer

mikopbx

Извлечение и анализ OpenAPI 3.1.0 спецификации из MikoPBX для валидации эндпоинтов. Использовать при проверке соответствия API, генерации тестов, проверке схем эндпоинтов или интеграции с навыками endpoint-validator и api-test-generator.

25

api-test-generator

mikopbx

Генерация полных Python pytest тестов для REST API эндпоинтов с валидацией схемы. Использовать при создании тестов для новых эндпоинтов, добавлении покрытия для CRUD операций или валидации соответствия API с OpenAPI схемами.

16

asterisk-tester

mikopbx

Тестирование сценариев Asterisk dialplan и потоков звонков используя безопасные Local каналы. Использовать при тестировании логики маршрутизации звонков, отладке проблем dialplan или проверке потоков IVR меню.

11

asterisk-validator

mikopbx

Валидация конфигурационных файлов Asterisk и анализ логов на корректность и best practices. Использовать при отладке проблем запуска Asterisk, проверке изменений конфигурации или проверке ошибок после регенерации воркерами.

13

Search skills

Search the agent skills registry