Extending libguestfs discusses how to add a new libguestfs API. It’s really quite simple, requiring just a change to a single file to describe the parameters, return value, tests and documentation, plus an implementation (in C). All of the daemon RPC, documentation and language bindings get generated from the description (which is usually only 4 or 5 lines long), with the upshot being that you don’t have to write any of that. I covered the same topic a long time ago on this blog.
Also I refreshed the guestfish recipes page although it still needs a lot more work.