# Best practices

### Use `name="..."` on everything.

All operations support the `name=` parameter which allows you to describe what it is doing. This will make following the output much easier.

### Never modify host or group variables in your scripts.

This will lead to a strange coupling between an inventory and scripts. If you need to track global state, please create an additional python module just for this purpose, or avoid it in the first place.

### Use the type checked API.

Fora is fully typed. While it is more verbose, this allows you to use certain typed variables from an imported wrapper instead of implicitly defined globals to allow for proper type-checking with `mypy` or similar tools.

{% tabs %}
{% tab title="script.py" %}

```python
from fora import script

#@Params       # Implicitly defined, no type available to type-checkers.
@script.Params # Properly typed.
class params:
	#...
```

{% endtab %}

{% tab title="hosts/host.py" %}

```python
# The host variable will always be the current host while loading.
from fora import host as this

#print(groups) <-- unchecked
print(this.groups)
```

{% endtab %}

{% tab title="groups/group.py" %}

```python
from fora import group as this

#print(name) <-- unchecked
print(this.name)
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://oddlama.gitbook.io/fora/usage/best-practices.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
