Noted, thanks.
Sure. The XDG Base Directory Specification should be that document (version 0.8 today).
I think there is no an API or standard way to ask a System if it is an XDG system because it’s a chicken-egg problem. What I’ve seen it is mostly done is checking for the $XDG_CONFIG_HOME value and if not, checking for the $HOME/.config folder; failing that “means” not XDG.
The tool published in the Freedesktop site for scripting is a Python tool called pyxdg, and it has a module dedicated to the Base Directory specification. You can see specifically how they define the xdg_config_home as:
xdg_config_home = os.environ.get('XDG_CONFIG_HOME') or \
os.path.join(_home, '.config')
TLDR: The XDG Base Directory Specification should be that document.