How did you write these commands? Did you use and documentation for reference? How can I write new commands ?