Toby See the Extension docs. There's a command php flarum/flarum generate:extension that builds a skeleton for you.
askvortsov Quick update for new users: correct link to docs is https://docs.flarum.org/extend/ An extension boilerplate can be made using the Flarum CLI, see https://discuss.flarum.org/d/26525-rfc-flarum-cli-alpha