Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

create-script

БесплатноБез исполняемых скриптовНе проверен

Codify discovered processes into standalone, reusable Python scripts. Use when the user has figured out a process (API integration, data pipeline, automation…

vichannnnnот vichannnnn★ 56 звёзд на GitHub

Об этом скилле

Create Script Skill

Turn discovered processes into production-ready Python scripts with CLI interfaces.

When to Use

  • After exploring an API and figuring out the request flow
  • After solving a data transformation problem
  • When automating a manual process
  • When the user wants to capture a working solution as a reusable tool

Workflow

Step 1: Gather Context

Review the conversation to identify:

  • What process was discovered or solved
  • What API endpoints, data sources, or operations are involved
  • What worked and what didn't (avoid repeating mistakes)

Step 2: Identify Requirements

Ask about or determine:

  • Inputs: What data does the script need? (files, API keys, parameters)
  • Outputs: What should the script produce? (files, stdout, API calls)
  • Configuration: What might change between runs? (URLs, credentials, options)
  • Error cases: What can go wrong and how should it be handled?

Step 3: Design Script Structure

Plan the script organization:

  • Break logic into focused functions
  • Identify what should be configurable via CLI arguments
  • Determine what should come from environment variables (secrets)
  • Plan the main flow and error handling

Step 4: Generate the Script

Create a Python script following the template structure below. Include:

  • Clear CLI interface with help text
  • Environment variable handling for secrets
  • Proper error handling and exit codes
  • Logging for visibility into what's happening

Step 5: Provide Usage Examples

After generating the script:

  • Show example invocations
  • Document required environment variables
  • Suggest next steps (testing, scheduling, extending)

Script Template

#!/usr/bin/env python3
"""
[Script description - what it does and why]

Usage:
    python script_name.py [options] <arguments>

Examples:
    python script_name.py --input data.json
    python script_name.py --verbose --output results.csv
"""

import argparse
import logging
import os
import sys

logging.basicConfig(
    level=logging.INFO,
    format="%(asctime)s - %(levelname)s - %(message)s"
)
logger = logging.getLogger(__name__)


def get_config():
    """Load configuration from environment variables."""
    return {
        "api_key": os.environ.get("API_KEY"),
        "base_url": os.environ.get("BASE_URL", "https://api.example.com"),
    }


def validate_config(config):
    """Validate required configuration is present."""
    missing = [k for k, v in config.items() if v is None and k in ["api_key"]]
    if missing:
        logger.error(f"Missing required environment variables: {', '.join(missing)}")
        sys.exit(1)
    return config


def main_logic(args, config):
    """Core script logic goes here."""
    logger.info(f"Processing with input: {args.input}")

    # Implementation here

    return {"status": "success"}


def parse_args():
    """Parse command line arguments."""
    parser = argparse.ArgumentParser(
        description="[Script description]",
        formatter_class=argparse.RawDescriptionHelpFormatter,
        epilog="""
Examples:
    %(prog)s --input data.json
    %(prog)s --verbose --output results.csv

Environment Variables:
    API_KEY     Required. API authentication key.
    BASE_URL    Optional. API base URL (default: https://api.example.com)
        """
    )

    parser.add_argument(
        "--input", "-i",
        required=True,
        help="Input file path"
    )
    parser.add_argument(
        "--output", "-o",
        default="-",
        help="Output file path (default: stdout)"
    )
    parser.add_argument(
        "--verbose", "-v",
        action="store_true",
        help="Enable verbose logging"
    )
    parser.add_argument(
        "--dry-run",
        action="store_true",
        help="Show what would be done without making changes"
    )

    return parser.parse_args()


def main():
    """Main entry point."""
    args = parse_args()

    if args.verbose:
        logging.getLogger().setLevel(logging.DEBUG)

    try:
        config = validate_config(get_config())
        result = main_logic(args, config)

        if result.get("status") == "success":
            logger.info("Completed successfully")
            sys.exit(0)
        else:
            logger.error(f"Failed: {result.get('error', 'Unknown error')}")
            sys.exit(1)

    except KeyboardInterrupt:
        logger.info("Interrupted by user")
        sys.exit(130)
    except Exception as e:
        logger.error(f"Unexpected error: {e}")
        sys.exit(1)


if __name__ == "__main__":
    main()

CLI Design Guidelines

Use argparse (standard library)

Prefer argparse over external dependencies like click:

  • Zero dependencies means easier distribution
  • Familiar to most Python developers
  • Sufficient for most CLI needs

Argument Patterns

Positional arguments for required, obvious inputs:

parser.add_argument("filename", help="File to process")

Flags for optional behavior:

parser.add_ar
Полный SKILL.md на GitHub

Установить create-script в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл create-script?

Codify discovered processes into standalone, reusable Python scripts. Use when the user has figured out a process (API integration, data pipeline, automation task) and wants to turn it into a reusable script, or when the user says "/create-script".

Как установить скилл create-script?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл create-script запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить create-script с