> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ubiquex.io/llms.txt
> Use this file to discover all available pages before exploring further.

# ubx explain

> Plain-English explanation of your infrastructure using Claude.

`ubx explain` reads `.iac` files and uses Claude to produce a structured, plain-English explanation.

<Note>
  Requires `UBX_AI_API_KEY` or `ai.api_key` in `ubx.yaml`.
</Note>

## Usage

```bash theme={null}
ubx explain [path-or-address] [flags]
```

## Examples

```bash theme={null}
ubx explain
ubx explain main.iac
ubx explain unit.aws_s3_bucket_v2.assets
ubx explain --audience exec
ubx explain --audience ops
```

## Flags

| Flag                | Description                       |
| ------------------- | --------------------------------- |
| `--audience string` | `dev` (default), `ops`, or `exec` |

## Audience Modes

| Mode   | Description                                                |
| ------ | ---------------------------------------------------------- |
| `dev`  | Technical — resource types, config details, security notes |
| `ops`  | Operational — scaling, availability, failure modes         |
| `exec` | Non-technical — business purpose only                      |

## Example Output

```
Explaining: main.iac  (audience: dev)

Summary
────────────────────────────────────────────────────────────
This configuration provisions a PostgreSQL database and an S3 storage
bucket for the staging environment.

Resources (2)
────────────────────────────────────────────────────────────
  PostgreSQL database (db.t3.micro)
    Stores application data. skip_final_snapshot = true means no snapshot
    on deletion — appropriate for non-production.

  S3 assets bucket
    Stores static application assets. force_destroy is enabled.

Outputs (1)
────────────────────────────────────────────────────────────
  db_endpoint   RDS connection endpoint for the application tier

Risks
────────────────────────────────────────────────────────────
  • Hardcoded password — use secret() to pull from secrets manager
  • skip_final_snapshot = true — data loss risk on accidental destroy
  • No S3 bucket encryption configured

Next Steps
────────────────────────────────────────────────────────────
Replace hardcoded password with secret("aws_secrets_manager", "..."),
add S3 encryption, verify skip_final_snapshot is intentional.
```

## Setup

```bash theme={null}
export UBX_AI_API_KEY=sk-ant-...
```

Or in `ubx.yaml`:

```yaml theme={null}
ai:
  enabled: true
  api_key: "sk-ant-..."
  model: "claude-haiku-4-5"
```
