Task Cookbook
These pages document common custom tasks for specific use cases. It is hoped that these will be copied and modified for your use case, and also provide a basis for understanding how to extend Capistrano for your own usage.
You can also look in most Capistrano repositories (including core) for rake tasks to see further example of how it works.
Feel free to contribute more via a Pull Request.