# Claude Code

Run Claude Code AI assistant with Anthropic integration.

## YAML Parameters

```typescript
interface YAMLParameters {
  /** Anthropic integration (ANTHROPIC) */
  integration: string;
  type: "CLAUDE_CODE";
  /** Unique identifier for the action within the pipeline. */
  action: string;
  /** List of prompts to send to Claude Code. Each entry has a type (INLINE or FILE) and a value */
  prompts?: object[];
  /** The Claude model to use (e.g. claude-sonnet-4-20250514) */
  model?: string;
  /** Claude Code settings JSON or path to settings file */
  settings?: object;
  /** Additional CLI arguments to pass to Claude Code */
  claude_args?: string;
  /** When set to true, bypasses permission checks in Claude Code */
  dangerously_skip_permissions?: boolean;
  /** The directory in which the pipeline filesystem will be mounted. */
  working_directory?: string;
  /** The dependencies and directories to be cached and available to every execution in this pipeline. */
  cached_dirs?: string[];
  /** If set to true, the filesystem will not be mounted in the container. */
  mount_filesystem_disable?: boolean;
  /** The path preceding the colon is the filesystem path (the folder from the filesystem to be mounted in the container). The path after the colon is the container path (the path in the container, where this filesystem will be located). */
  volume_mappings?: string[];
  /** The hostname of the container in which the action is run. The container will be available under this name in the docker network for services. */
  main_service_name?: string;
  /** All build commands are run as the default user defined in the selected Docker image. Can be set to another username (on the condition that this user exists in the selected image). */
  run_as_user?: string;
  /** The entrypoint to use for the Docker container. */
  entrypoint?: string;
  /** If set to true, resets the default entrypoint set by the image. */
  reset_entrypoint?: boolean;
  /** If set to true, the cached version of the image is used, instead of being pulled each time. */
  cache_base_image?: boolean;
  /** If set to true, use cached image on timeouts (only for official images). */
  ignore_image_pull_failures?: boolean;
  /** The path in the container to export. */
  export_container_path?: string;
  /** The name of the Docker image. */
  docker_image_name?: string;
  /** The tag of the Docker image. */
  docker_image_tag?: string;
  /** The location of the image used by the action. */
  image_location?: "PUBLIC_REGISTRY" | "PRIVATE_REGISTRY" | "ACTION" | "ARTIFACT_REGISTRY";
  /** The type of registry from which the image is retrieved. */
  docker_registry?: "NONE" | "DOCKER_HUB" | "AMAZON_ECR" | "GOOGLE_GCR" | "GOOGLE_ARTIFACT_REGISTRY" | "OTHER" | "GIT_HUB_CONTAINER_REGISTRY" | "ARTIFACT_REGISTRY" | "DIGITAL_OCEAN_CONTAINER_REGISTRY";
  /** The identifier of the artifact from artifact registry. */
  artifact?: string;
  /** If set to true, the image from another action will be used. */
  use_image_from_action?: boolean;
  /** The name of the action from which the Docker image will be used. */
  docker_build_action_name?: string;
  /** The URL of the Docker registry. */
  registry?: string;
  /** If set to true, the registry will be accessed over HTTP instead of HTTPS. */
  insecure_registry?: boolean;
  /** The target stage of the Dockerfile. */
  target_stage?: string;
  /** If set to true, images will not be pruned after the build. */
  do_not_prune_images?: boolean;
  /** The username for the Docker registry. */
  login?: string;
  /** The password for the Docker registry. */
  password?: string;
  /** The list of services attached to the build environment. */
  services?: ServiceYaml[];
  /** The list of target servers or clusters. */
  targets?: object[];
  /** Specifies when the action should be executed. */
  trigger_time?: "ON_EVERY_EXECUTION" | "ON_SUCCESS" | "ON_FAILURE" | "ON_BACK_TO_SUCCESS" | "ON_WARNING" | "ON_WAIT_FOR_APPROVE" | "ON_TERMINATE";
  /** The list of variables for dynamic action execution. The action runs once for each value. */
  loop?: string[];
  /** Defines whether the action should be executed on each failure. Restricted to and required if the trigger_time is ON_FAILURE. */
  run_only_on_first_failure?: boolean;
  /** When set to true the action is disabled. By default it is set to false. */
  disabled?: boolean;
  /** The timeout in seconds. */
  timeout?: number;
  /** If set to true the execution will proceed, mark action as a warning and jump to the next action. Doesn't apply to deployment actions. */
  ignore_errors?: boolean;
  /** Delay time between auto retries in seconds. */
  retry_interval?: number;
  /** Number of retries if the action fails. */
  retry_count?: number;
  /** Defines whether the action should run in parallel with the next one. */
  run_next?: "WAIT_ON_SUCCESS" | "IN_SOFT_PARALLEL" | "IN_HARD_PARALLEL";
  /** The list of trigger conditions to meet so that the action can be triggered. */
  trigger_conditions?: TriggerConditionYaml[];
  /** The list of variables you can use in the action. */
  variables?: VariableYaml[];
}
```

## Type Definitions

```typescript
interface ServiceYaml {
  /** Service type: MYSQL, POSTGRES, MONGO_DB, REDIS, ELASTICSEARCH, etc. */
  type: string;
  /** Version of the service to run. */
  version?: string;
  /** Path to the database dump file to restore. */
  dump_path?: string;
  /** When true, preserve service data between builds. */
  persistent?: boolean;
  /** Connection configuration for the service (host, port, user, password, db). */
  connection?: ServiceConnectionYaml;
  /** Custom Docker image name for the service. */
  docker_image_name?: string;
  /** Tag of the custom Docker image. */
  docker_image_tag?: string;
  /** Custom Docker registry URL. */
  registry?: string;
  /** Username for Docker registry authentication. */
  login?: string;
  /** Password for Docker registry authentication. */
  password?: string;
  /** Location of the Docker image: PUBLIC, PRIVATE_REGISTRY, ACTION. */
  image_location?: "PUBLIC_REGISTRY" | "PRIVATE_REGISTRY" | "ACTION" | "ARTIFACT_REGISTRY";
  /** Docker registry type: DOCKER_HUB, GCR, ECR, GITHUB, GITLAB, etc. */
  docker_registry?: "NONE" | "DOCKER_HUB" | "AMAZON_ECR" | "GOOGLE_GCR" | "GOOGLE_ARTIFACT_REGISTRY" | "OTHER" | "GIT_HUB_CONTAINER_REGISTRY" | "ARTIFACT_REGISTRY" | "DIGITAL_OCEAN_CONTAINER_REGISTRY";
  /** When true, use image built by a previous action. */
  use_image_from_action?: boolean;
  /** Name of the action that built the Docker image. */
  docker_build_action_name?: string;
  /** Working directory inside the container. */
  working_directory?: string;
  /** Custom volume mappings for the container. Format: host_path:container_path. */
  volume_mappings?: string[];
  /** Custom entrypoint for the container. */
  entrypoint?: string;
  /** Commands to execute inside the container. */
  inline_commands?: string;
  /** Cloud region for the service (when using cloud integrations). */
  region?: string;
  /** Port to wait for before considering service ready. */
  wait_for_port?: number;
  /** Integration identifier for cloud provider authentication. */
  integration?: string;
  /** Directories to cache between executions. */
  cached_dirs?: string[];
  /** When true, pass pipeline variables to the service container. */
  pass_variables?: boolean;
  /** User to run the container as. */
  run_as_user?: string;
  /** When true, continue even if pulling the Docker image fails. */
  ignore_image_pull_failures?: boolean;
  /** When true, cache the base Docker image. */
  cache_base_image?: boolean;
}

interface TriggerConditionYaml {
  /** The type of trigger condition */
  trigger_condition: "ALWAYS" | "ON_CHANGE" | "ON_CHANGE_AT_PATH" | "VAR_IS" | "VAR_IS_NOT" | "VAR_CONTAINS" | "VAR_NOT_CONTAINS" | "DATETIME" | "SUCCESS_PIPELINE" | "DAY" | "HOUR" | "OR" | "VAR_LESS_THAN" | "VAR_LESS_THAN_OR_EQUAL" | "VAR_GREATER_THAN" | "VAR_GREATER_THAN_OR_EQUAL" | "ACTION_STATUS_IS" | "ACTION_STATUS_IS_NOT" | "TRIGGERING_USER_IS" | "TRIGGERING_USER_IS_NOT" | "TRIGGERING_USER_IS_IN_GROUP" | "TRIGGERING_USER_IS_NOT_IN_GROUP";
  /** The value to compare the trigger variable against */
  trigger_variable_value?: string;
  /** The name of the variable to check in the trigger condition */
  trigger_variable_key?: string;
  /** The timezone for datetime trigger conditions (e.g., 'UTC', 'Europe/Warsaw') */
  timezone?: string;
  /** The hours when the datetime trigger should activate (0-23) */
  trigger_hours?: number[];
  /** The days when the datetime trigger should activate (1-7, where 1 is Monday) */
  trigger_days?: number[];
  /** The project name for cross-project pipeline triggers */
  project?: string;
  /** The pipeline name for cross-pipeline triggers */
  pipeline?: string;
  /** The email of the user who can trigger the pipeline */
  trigger_user?: string;
  /** The name of the group that can trigger the pipeline */
  trigger_group?: string;
  /** The file paths that must change to trigger the pipeline */
  trigger_condition_paths?: string[];
  /** The action status to check for action status triggers */
  trigger_status?: "SUCCESSFUL" | "FAILED" | "SKIPPED" | "SUPPRESSED";
  /** The name of the action to check status for */
  trigger_action_name?: string;
  /** The list of nested trigger conditions for OR/AND operators */
  trigger_operands?: TriggerConditionYaml[];
}

interface VariableYaml {
  /** The name of the variable */
  key: string;
  /** The value of the variable */
  value?: string;
  /** The type of the added variable */
  type?: "VAR" | "FILE" | "SSH_KEY" | "IOS_KEYCHAIN" | "IOS_PROVISION_PROFILES" | "SSH_PUBLIC_KEY" | "GPG_KEY";
  /** If set to true the variable value will be encrypted and hidden */
  encrypted?: boolean;
  /** The optional description of the variable */
  description?: string;
  /** Initial path for the variable */
  init_path?: string;
  /** Default value for the variable */
  defaults?: string;
  /** Specifies where to copy the file on each run. Set if type is FILE, SSH_KEY, IOS_KEYCHAIN, or IOS_PROVISION_PROFILES. */
  file_path?: string;
  /** File permission set on copy to a container on each run. Set if type is FILE, SSH_KEY, IOS_KEYCHAIN, or IOS_PROVISION_PROFILES. */
  file_chmod?: string;
  /** Set if type is FILE, SSH_KEY, IOS_KEYCHAIN, or IOS_PROVISION_PROFILES. If it's NONE, the variable can be used as a parameter in an action. For CONTAINER, the given key is additionally copied to an action container on each run */
  file_place?: "NONE" | "CONTAINER";
  /** Whether the file is binary */
  binary?: boolean;
  /** Public value for SSH key type variables */
  public_value?: string;
  /** Fingerprint of SSH key */
  key_fingerprint?: string;
  /** Checksum of the variable value */
  checksum?: string;
  /** Password for certificates */
  password?: string;
  /** Passphrase for encrypted SSH keys */
  passphrase?: string;
  /** Key identifier for iOS certificates, provisioning profiles, or GPG keys */
  key_identifier?: string;
  /** If set to true the variable value can be set by Buddy actions */
  settable?: string;
  /** Encoding of the variable value. Use `b64` for binary files (certificates, images, compiled blobs) where the value is already base64-encoded. Omit or set to `text` for plain text files (JSON, XML, config) — the system will handle encoding automatically. Only applies to non-encrypted asset variables (FILE, SSH_KEY, SSH_PUBLIC_KEY, IOS_KEYCHAIN, IOS_PROVISION_PROFILES). */
  encoding?: "text" | "b64";
}

```

## YAML Examples

### Run Claude Code with all options

```yaml
  - action: "Run Claude Code"
    type: "CLAUDE_CODE"
    trigger_time: "ON_EVERY_EXECUTION"
    integration: "my_anthropic_integration"
    prompts:
      - "Review the code and suggest improvements"
      - file: ".buddy/review-prompt.md"
    model: "claude-sonnet-4-20250514"
    settings: "{\"permissions\": {\"allow\": [\"Read\", \"Grep\"]}}"
    claude_args: "--verbose --max-turns 5"
    dangerously_skip_permissions: false
    working_directory: "/buddy/my-repo"

```

### Minimal Claude Code action

```yaml
  - action: "Quick review"
    type: "CLAUDE_CODE"
    integration: "my_anthropic_integration"
    prompts:
      - "Review the code"

```

### Claude Code with file-based prompts

```yaml
  - action: "Claude Code from prompt files"
    type: "CLAUDE_CODE"
    trigger_time: "ON_EVERY_EXECUTION"
    integration: "my_anthropic_integration"
    prompts:
      - file: ".buddy/code-review.md"
      - file: ".buddy/security-check.md"
    model: "claude-sonnet-4-20250514"

```

### Claude Code with settings from file

```yaml
  - action: "Claude Code with custom settings"
    type: "CLAUDE_CODE"
    trigger_time: "ON_EVERY_EXECUTION"
    integration: "my_anthropic_integration"
    prompts:
      - "Fix all lint errors"
    model: "claude-sonnet-4-20250514"
    settings:
      file: ".buddy/claude-settings.json"
    dangerously_skip_permissions: true

```

### Claude Code with inline and file prompts

```yaml
  - action: "Claude Code mixed prompts"
    type: "CLAUDE_CODE"
    trigger_time: "ON_EVERY_EXECUTION"
    integration: "my_anthropic_integration"
    prompts:
      - "You are a code reviewer."
      - file: ".buddy/review-rules.md"
      - "Focus on security issues."
    model: "claude-sonnet-4-20250514"
    claude_args: "--max-turns 10"

```


---
Original source: https://buddy.works/docs/yaml/yaml-actions/claude-code