# Your first rule file (/docs/guides/your-first-rule-file)

Write a rule as a JSON file in a text editor, load it in Premiere and make it configurable.



In this tutorial you write a rule file that reports clips played faster than 200 %, load it in the PPROLint panel and see it report a clip of your sequence. You need Premiere Pro with PPROLint installed and a text editor.

Prefer menus to JSON? The same rule is built in the rule editor in [Your first rule](/docs/editor/your-first-rule).

## 1. Create the file [#1-create-the-file]

A rule file is named after its id: `<id>.rule.json`. The id is lower-case words joined by hyphens, and it never changes once the rule is in use. Create `max-clip-speed.rule.json`:

```json title="max-clip-speed.rule.json"
{
  "formatVersion": 1,
  "id": "max-clip-speed",
  "name": "Fast clips",
  "description": "Reports clips played faster than 200 %.",
  "category": "static",
  "scope": "clip",
  "severity": "warning",
  "checks": [
    {
      "condition": { "field": "clip.speed", "operator": "greaterThan", "value": 2 },
      "message": "Clip \"{clip.name}\" on {clip.track} plays at {clip.speed}× speed."
    }
  ]
}
```

What each property does:

* `formatVersion` is always `1`.
* `name` and `description` are what the panel's Rules settings show.
* `category` sorts the rule among the others. `static` means the rule inspects a fact of one item, without comparing it with other clips.
* `scope: "clip"` runs the check once for every clip of the sequence.
* `severity` is how serious a report is: `info`, `warning` or `error`.
* `checks` holds the condition and the message. `clip.speed` is a [field](/docs/reference/fields): 1 is normal speed, so `greaterThan 2` means faster than 200 %. In the message, `{clip.name}`, `{clip.track}` and `{clip.speed}` are replaced by the clip's values.

## 2. Load it in Premiere [#2-load-it-in-premiere]

1. Open the PPROLint panel's settings and choose **Rules**.
2. Click **Open rules folder** and save `max-clip-speed.rule.json` in that folder.
3. Click **Reload rules**. *Fast clips* appears in the list, marked *Custom rule*.

To try it, set a clip's speed to 300 % (**Clip > Speed/Duration**) and run a check. The panel reports:

```text
Clip "Interview" on V1 plays at 3× speed.
```

If the rule does not appear, the Rules settings list the file with its problems above the rules. Each problem gives the JSON path of the faulty value; see [Troubleshooting](/docs/guides/troubleshooting).

## 3. Leave disabled clips alone [#3-leave-disabled-clips-alone]

A disabled clip does not play, so its speed does not matter. Combine two conditions with `all`: every one must hold.

```json
"condition": {
  "all": [
    { "field": "clip.disabled", "operator": "equals", "value": false },
    { "field": "clip.speed", "operator": "greaterThan", "value": 2 }
  ]
}
```

## 4. Make the limit an option [#4-make-the-limit-an-option]

A fixed `2` suits one project, not every one. Declare an **option** with a default, and refer to it as `options.maxSpeed` in the condition and the message:

```json title="max-clip-speed.rule.json"
{
  "formatVersion": 1,
  "id": "max-clip-speed",
  "name": "Fast clips",
  "description": "Reports clips played faster than the allowed speed.",
  "category": "static",
  "scope": "clip",
  "severity": "warning",
  "options": {
    "maxSpeed": { "type": "number", "default": 2, "description": "Highest allowed speed; 1 is 100 %." }
  },
  "checks": [
    {
      "condition": {
        "all": [
          { "field": "clip.disabled", "operator": "equals", "value": false },
          { "field": "clip.speed", "operator": "greaterThan", "value": { "field": "options.maxSpeed" } }
        ]
      },
      "message": "Clip \"{clip.name}\" on {clip.track} plays at {clip.speed}× speed (maximum {options.maxSpeed}×)."
    }
  ],
  "data": { "speed": "clip.speed", "maxSpeed": "options.maxSpeed" }
}
```

`{ "field": "options.maxSpeed" }` in place of a literal value compares the speed with the option. The `data` entries attach the measured speed and the limit to every report, so the panel can show them.

Save the file and click **Reload rules** again.

## 5. Edit it in the panel [#5-edit-it-in-the-panel]

Click the cogwheel next to *Fast clips* in the Rules settings. The [rule editor](/docs/editor) shows every property of your file: change `maxSpeed` to `1.5`, save, and the editor writes the file back. You can switch between the editor and your text editor at any time.

## What you learned [#what-you-learned]

* A rule is one JSON file with a stable id, dropped in the rules folder.
* The `scope` decides which items the check runs against; [fields](/docs/reference/fields) are the values of those items.
* Conditions compare fields with values and combine with `all`, `any` and `not`.
* Options make thresholds configurable; messages and `data` explain each report.

Next, read [How rules work](/docs/how-rules-work), or browse the [built-in rules](/docs/rules) for complete examples.
