If you want to make official 3DS software, you can use Nintendo's software development kit. You need to sign a non-disclosure agreement to gain access to the tools and to purchase development hardware. Don't do this unless you plan on developing a game to sell on the eShop. https://developer.nintendo.com
Yes, I don't remember how exactly but if you look at some open source homebrew they usually have a script included to create a cia, you can use that as a basis.
Also, it's possible to use Unity for 3DS from the leaked SDK to create cias that will run on a hacked console. But it's designed for n3DS only and will likely run slowly on o3DS.