Best practices for creating and maintaining NetAlertX settings (config.json), including UI, validation, localization, runtime behavior, and implementation consistency.
60
68%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
Fix and improve this skill with Tessl
tessl review fix ./.gemini/skills/settings/SKILL.mdThis skill defines the conventions and best practices for adding or modifying settings in NetAlertX.
The goal is for every setting to be:
Read a setting (backend):
from helper import get_setting_value
value = get_setting_value('SETTING_NAME')Never read app.conf directly. Always use get_setting_value().
Read a setting (frontend):
getSetting("SETTING_NAME")Add a core setting — use ccd() in server/initialise.py:
ccd('SETTING_NAME', 'default_value', 'description')Add a plugin setting — define in the plugin's config.json under the settings key.
| File | Purpose |
|---|---|
/data/config/app.conf | Runtime config (source of truth) |
back/app.conf | Default config (template) |
Use APP_CONF_OVERRIDE for settings that must be set before startup.
Before creating a new setting:
Avoid introducing new setting types unless absolutely necessary.
Setting keys use uppercase snake case.
Good:
UI_DEV_SECTIONS
SCAN_INTERVAL
MQTT_HOSTAvoid:
uiDevSections
scanInterval
ScanIntervalNames should clearly describe the purpose.
Place settings into the most appropriate category.
Keep related settings together.
Avoid creating new categories unless there is a clear need.
Use the simplest type that correctly models the value.
Common types include:
Avoid encoding structured JSON inside string settings.
Always define validation whenever appropriate.
Examples include:
Reject invalid configuration rather than silently accepting it.
Provide sensible defaults that work for a fresh installation.
Avoid defaults that require external services or additional configuration.
A default value should exist in exactly one place.
Use the default_value defined in config.json.
Do not duplicate the same default value elsewhere in Python or JavaScript.
Setting names should be concise.
Examples:
Descriptions should explain:
Avoid implementation details.
Good:
Interval between network scans in seconds.
Bad:
Calls scheduler.py every X seconds.
Boolean settings should read naturally.
Prefer verbs such as:
Examples:
When users must choose from predefined values, use a select setting.
Never require users to remember internal values.
Each option should have a meaningful label.
Use arrays only when multiple independent values are expected.
Examples:
Every setting must have localized language strings.
If the language strings are not defined directly inside config.json, they must exist in en_us.json.
For example, for:
UI_DEV_SECTIONSadd:
"UI_DEV_SECTIONS_name": "Hide device sections",
"UI_DEV_SECTIONS_description": "Select which UI elements to hide on the Devices page."When using external language files, config.json must reference:
"name": [
{
"string": "_GLOBAL_LANG_FILES_"
}
]This tells NetAlertX to resolve the display name from the language files.
app.conf is the source of truth.
Keep the following in mind:
app.conf.config.json are only used when the setting is missing from app.conf.Whenever possible, define new settings inside a plugin's config.json.
Avoid adding hardcoded application settings unless there is a compelling architectural reason.
Plugin settings are the preferred and future-proof approach.
Understand how settings flow through the application.
config.json
│
│ default values
▼
app.conf (source of truth)
│
▼
Settings database table
│
▼
table_settings.json API
│
▼
Frontend (getSetting())The database and API are runtime representations only.
They are regenerated from app.conf during initialization.
Code should never read app.conf directly.
In the Frontend, always retrieve settings through:
getSetting("SETTING_NAME")And in the backend, always retrieve settings through:
get_setting_value("SETTING_NAME")This guarantees the value comes from the generated settings API.
Each setting automatically has a corresponding __metadata entry generated in app.conf.
Do not manually create or modify metadata entries unless working on the settings framework itself.
Backend code should:
A correctly defined setting should render automatically in the existing Settings UI.
Avoid writing custom JavaScript unless absolutely necessary.
If a behaviour can reasonably be controlled through an existing setting type (boolean, select, integer, array, etc.), introduce a setting instead of hardcoding special-case logic.
Configuration is preferred over implementation-specific behaviour whenever practical.
Avoid:
If unavoidable:
Every user-facing setting should eventually be documented.
Include:
Before submitting a PR, verify:
_GLOBAL_LANG_FILES_ used where appropriate.20ddf48
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.