.github/skills/code-standards/SKILL.md
NetAlertX coding standards and conventions. Use this when writing code, reviewing code, or implementing features.
npx skillsauth add netalertx/netalertx netalertx-code-standardsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Keep code files under 500 lines. Split larger files into modules.
Do not re-implement functionality. Reuse existing methods or refactor to create shared methods.
server/db/db_helper.py functions (e.g., get_table_json)DeviceInstance in server/models/device_instance.py)Always validate and normalize MACs before DB writes:
from plugin_helper import normalize_mac
mac = normalize_mac(raw_mac)
MANDATORY: All subprocess calls must set explicit timeouts.
result = subprocess.run(cmd, timeout=60) # Minimum 60s
Nested subprocess calls need their own timeout—outer timeout won't save you.
from utils.datetime_utils import timeNowUTC
timestamp = timeNowUTC()
This is the ONLY function that calls datetime.datetime.now() in the entire codebase.
⚠️ CRITICAL: ALL database timestamps MUST be stored in UTC This is the SINGLE SOURCE OF TRUTH for current time in NetAlertX Use timeNowUTC() for DB writes (returns UTC string by default) Use timeNowUTC(as_string=False) for datetime operations (scheduling, comparisons, logging)
Use sanitizers from server/helper.py before storing user input. MAC addresses are always lowercased and normalized. IP addresses should be validated.
chmod or chown during operations.devcontainer/scripts/setup.sh/data for persistent config/db/tmp for runtime logs/api/nginx state/data/db or use relative pathstools
Manage NetAlertX configuration settings. Use this when asked to add setting, read config, get_setting_value, ccd, or configure options.
development
Load synthetic device data into the devcontainer. Use this when asked to load sample devices, seed data, import test devices, populate database, or generate test data.
tools
Create and run NetAlertX plugins. Use this when asked to create plugin, run plugin, test plugin, plugin development, or execute plugin script.
devops
Clean up unused Docker resources. Use this when asked to prune docker, clean docker, remove unused images, free disk space, or docker cleanup. DANGEROUS operation. Requires human confirmation.