Adding Tasks to Rake

Hi

I see a lot of projects (like Rails) add built-in tasks to rake.
Is there some documentation on an ‘offical’ way add these
tasks?

Would it be possible to create a gem that could add tasks to rake.
Of course, this would need to be somewhat independent of the
rake release version.

Jim F.