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

# Quickstart

> Check a ten-line rating rule, compute a premium with it, and read the message for a mistake, in five minutes.

[Install Relativities](https://docs.canary.effectiveai.app/relativities/setup.md). The installation includes the `rslc` compiler.

## Write a rater

Save this file as `hello/rater.rsl`. It charges \$2 for each \$1,000 of payroll:

```rsl hello/rater.rsl theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
spec {
    rsl: "0.4.1",
    carrier: "Example Mutual",
    state: AZ,
    product: "Staffing Liability",
    effective_date: 2026-01-01
}

Sources = {
    manual: Source = {
        artifact: artifact("00000000-0000-4000-8000-000000000000"),
        kind: pdf
    }
}

Constants = {
    rate_per_1000 [cite: manual:p3] = 2
}

Records = {
    Policy = {
        inputs {
            payroll: Num {precision: int} where self in [0, 100000000]
        },
        step rating {
            premium: Premium [cite: manual:p3] = round(self.payroll / 1000 * rate_per_1000, 2, half_up)
        }
    }
}

RatingOutcomes = {
    premium: Policy.premium
}
```

`rslc examples get minimal --out hello` saves the same file. The `Records` section holds the rule:

* `payroll` is an input. Its type says a whole number from 0 to 100,000,000.
* `premium` is a calculation. It rounds to the cent, half up, and cites page 3 of the manual.

## Check it

```sh theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
rslc check hello/rater.rsl
```

```text theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
PASS hello/rater.rsl (strict)
cost premium: 1 (each list of size 1: 1, 3: 1, 10: 1)
```

`PASS` means that the rater gives a premium for every request it accepts.
The `cost` line is the work of one rating. Here it is a constant.

## Compute a premium

A scenario gives the rater one set of inputs and the value you expect. Save this file as `hello/first.rsl`:

```rsl hello/first.rsl theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
import "rater.rsl"

Scenario = {
    instances = {
        Policy policy = {
            payroll = 250000
        }
    }
    evaluate = {
        targets: [
            policy.premium
        ]
    }
    assert = {
        policy.premium = 500
    }
}
```

```sh theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
rslc eval hello/first.rsl
```

```text theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
PASS hello/first.rsl (passed)
targets: {"policy.premium": {"Num": {"exact": "500", "value": 500.0}}}
PASS assertion: assert@policy
```

A payroll of \$250,000 is 250 thousands, at \$2 each: \$500.

## Make a mistake

Charge by the employee, and let a request send zero employees. Save this file as `broken/rater.rsl`:

> [accordion] broken/rater.rsl
>
> ```rsl broken/rater.rsl theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
> spec {
>     rsl: "0.4.1",
>     carrier: "Example Mutual",
>     state: AZ,
>     product: "Staffing Liability",
>     effective_date: 2026-01-01
> }
>
> Sources = {
>     manual: Source = {
>         artifact: artifact("00000000-0000-4000-8000-000000000000"),
>         kind: pdf
>     }
> }
>
> Constants = {
>     rate_per_1000 [cite: manual:p3] = 2
> }
>
> Records = {
>     Policy = {
>         inputs {
>             payroll: Num {precision: int} where self in [0, 100000000],
>             employees: Num {precision: int} where self in [0, 5000]
>         },
>         step rating {
>             payroll_each: Num = self.payroll / self.employees,
>             premium: Premium [cite: manual:p3] = round(self.payroll_each / 1000 * rate_per_1000, 2, half_up)
>         }
>     }
> }
>
> RatingOutcomes = {
>     premium: Policy.premium
> }
> ```

The new calculation divides by an input that can be 0:

```rsl theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
payroll_each: Num = self.payroll / self.employees,
```

```sh theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
rslc check broken/rater.rsl
```

```text theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
FAIL broken/rater.rsl (strict)
error: E-DIV-ZERO broken/rater.rsl:27:48: divisor `self.employees` has range 0..5000, which includes 0; guard the division (`if self.employees != 0 then … else …`), or narrow the inputs it reads with a refinement
cost premium: 2 (each list of size 1: 2, 3: 2, 10: 2)
```

The check found the request that would fail, before any request was rated.
`rslc explain` gives the reason for a message, a rater that gets it, and the fix:

```sh theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
rslc explain E-DIV-ZERO
```

```text theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
# E-DIV-ZERO: A divisor must exclude zero
...
```

Here the fix is one character: start the range of `employees` at 1.

## Next steps

* [Language guarantees](https://docs.canary.effectiveai.app/rsl/guarantees.md) states what a passing check means.
* [Write your first rater](https://docs.canary.effectiveai.app/rsl/tutorial/first-rater.md) builds a rater with a rate table from a rating manual.
* [RSL at a glance](https://docs.canary.effectiveai.app/rsl/language-tour.md) shows each part of the language on one page.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.