You have to create your own (`nt:unstructured`) nodes tree somewhere in the repo, for example, `/apps/my-migration-project/rules`, and create there all the rule definitions you need as children. The OSGi configuration file for the ComponentRewriteRuleServiceImpl I believe should be placed somewhere in /apps/.../config..., as usual.
All those XML pieces on the documentation page are definitions for those migration rules, you should go through them and get what you need for your project.
Some kind of a sample that you are looking for, you can see at the end of that page, I am copying it here:
<teaser jcr:primaryType="nt:unstructured"
jcr:title="GeoDemo Teaser"
cq:rewriteRanking="1">
<aggregate jcr:primaryType="nt:unstructured">
<patterns jcr:primaryType="nt:unstructured">
<imagePattern
jcr:primaryType="nt:unstructured"
sling:resourceType="foundation/components/image"/>
<titlePattern
jcr:primaryType="nt:unstructured"
sling:resourceType="geometrixx/components/title"/>
<textPattern
jcr:primaryType="nt:unstructured"
sling:resourceType="foundation/components/text"/>
</patterns>
</aggregate>
<replacement jcr:primaryType="nt:unstructured">
<text
jcr:primaryType="nt:unstructured"
sling:resourceType="geodemo/components/content/teaser"
jcr:title="${'./[pattern:titlePattern]/jcr:title'}"
jcr:description="${./[pattern:textPattern]/text}"
textIsRich="${./[pattern:textPattern]/text}"
fileReference="${'./[pattern:imagePattern]/fileReference'}"
/>
</replacement>
</teaser>
For this sample rule, it should find some node with such children as image, title, and text (resource types in the patterns section) and convert the whole parent node to one `geodemo/components/content/teaser` element.
Note that you can mark properties that you are looking for as optional, and also you can add the `cq:rewriteFinal` property to the replacement section to stop checking the processed node for other rules once it is replaced by one of them.