What I'm thinking about is, for example being able to access Mathf.Clamp() or Mathf.Slerp() so easily as just putting the name of the class and then function or variable, in any script in the game.

How to write a file like this so it works the same way? thank you in advance

Use a static function:

static function Add (a : int, b : int) : int {
   return a + b;
}

If you saved that in a script called MyMath, then you could do

print ( MyMath.Add(1, 2) );