# Best Practices for System Commands

System Commands allow Drizz to interact directly with the device and application lifecycle beyond standard UI-based actions. Because they operate at a lower system level launching apps, killing processes, clearing data, or managing multi-app workflows, they must be used carefully and with precise syntax. This section outlines best practices to ensure stability, prevent unintended resets, and maintain predictable test execution when working with powerful commands.

### Recommended Best Practices for Writing System Commands:

1. Use system commands only when UI-based commands are insufficient\
   They operate outside normal UI interactions.
2. System command syntax must be exact\
   Any deviation results in failure.
3. Avoid chaining multiple system actions in one step\
   Each must be executed independently.
4. Use CLEAR\_APP cautiously\
   It resets the entire app state and may invalidate prior steps.
5. Prefer OPEN\_APP for multi-app workflows\
   Helps test external handoffs (payments, maps, verification apps).
6. Always validate after a system command\
   e.g., after KILL\_APP, validate the home/login screen.


---

# 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://docs.drizz.dev/commands-reference/system-command/best-practices-for-system-commands.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.
