Skip to content

datarobot-oss/datarobot-agent-skills / skills/datarobot-agent-assist/agent-assist-build

datarobot-agent-assist-build

Flagged

Use when the user wants to design, build, code, or deploy an AI agent on DataRobot; mentions agent_spec.yaml, dress rehearsal, the DataRobot agent template, LangGraph, CrewAI, LlamaIndex, NAT, Base agents, MCP servers, backend APIs, custom frontends, or the DataRobot CLI.

scripts/env_utils.py

View on GitHub
#!/usr/bin/env python3
# Copyright (c) 2026 DataRobot, Inc. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

"""Utility functions for working with .env files."""

import os
import subprocess
import sys
from pathlib import Path


def read_env_variable(env_file: Path, variable_name: str) -> str:
    """
    Read a variable value from a .env file.

    Args:
        env_file: Path to the .env file
        variable_name: Name of the variable to read

    Returns:
        The variable value (stripped of quotes if present)

    Raises:
        FileNotFoundError: If the .env file doesn't exist
        ValueError: If the variable is not found in the file
    """
    if not env_file.exists():
        raise FileNotFoundError(f".env file not found: {env_file}")

    with open(env_file, "r") as f:
        for line in f:
            line = line.strip()
            # Skip empty lines and comments
            if not line or line.startswith("#"):
                continue

            # Split on first = sign
            if "=" in line:
                key, value = line.split("=", 1)
                key = key.strip()
                value = value.strip()

                if key == variable_name:
                    # Remove surrounding quotes if present
                    if (value.startswith('"') and value.endswith('"')) or (
                        value.startswith("'") and value.endswith("'")
                    ):
                        value = value[1:-1]
                    return value

    raise ValueError(f"Variable '{variable_name}' not found in {env_file}")


def ensure_env_file(env_file: Path) -> None:
    """
    Ensure .env file exists, creating it via 'dr dotenv setup' if needed.

    If .env file doesn't exist, runs 'dr dotenv setup --yes' in the parent
    directory of env_file. Prints warnings to stderr if setup fails but does not
    raise an error.

    Args:
        env_file: Path to the .env file (e.g. target_dir / ".env")
    """
    env_file = env_file.resolve()
    if env_file.exists():
        return

    target_dir = env_file.parent
    target_dir.mkdir(parents=True, exist_ok=True)

    try:
        # stderr, not stdout: callers such as list_llm_models.py --json use stdout as a
        # data channel, and a progress line there makes the JSON unparseable.
        print(
            f"No .env file found. Running 'dr dotenv setup --yes' in {target_dir}...",
            file=sys.stderr,
        )
        result = subprocess.run(
            ["dr", "dotenv", "setup", "--yes", "--output", "."],
            cwd=target_dir,
            check=True,
            capture_output=True,
            text=True,
        )
        print(result.stdout, file=sys.stderr)
    except subprocess.CalledProcessError as e:
        print(f"Warning: Failed to run 'dr dotenv setup': {e.stderr}", file=sys.stderr)
        print("Falling back to environment variables...", file=sys.stderr)
    except FileNotFoundError:
        print(
            "Warning: 'dr' command not found. Falling back to environment variables...",
            file=sys.stderr,
        )


def get_datarobot_credentials(target_dir: Path) -> tuple[str | None, str | None]:
    """
    Get DataRobot credentials from target_dir/.env or environment variables.

    Args:
        target_dir: Project directory containing the .env file

    Returns:
        Tuple of (endpoint, api_token); either value may be None if unset
    """
    env_file = target_dir.resolve() / ".env"
    ensure_env_file(env_file)

    endpoint = None
    api_token = None

    if env_file.exists():
        try:
            endpoint = read_env_variable(env_file, "DATAROBOT_ENDPOINT")
        except ValueError:
            pass

        try:
            api_token = read_env_variable(env_file, "DATAROBOT_API_TOKEN")
        except ValueError:
            pass

    if not endpoint:
        endpoint = os.environ.get("DATAROBOT_ENDPOINT")

    if not api_token:
        api_token = os.environ.get("DATAROBOT_API_TOKEN")

    return endpoint, api_token
writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deploymentStars: 323kUpdated Claude CodeCodexVerifiedInstall
xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release.Stars: 118kUpdated Claude CodeCodexVerifiedInstall