To add Rating fields to a library add the following two fields to a content type, just add the following elements as FieldRefs element.
<FieldRef ID="{5a14d1ab-1513-48c7-97b3-657a5ba6c742}" Name="AverageRating" /> <FieldRef ID="{b1996002-9167-45e5-a4df-b2c41c6723c7}" Name="RatingCount" /> You can also add these fields to document libraries as well. Just add the following Field elements to the Fields element in your schema.xml. <Field ID="{5a14d1ab-1513-48c7-97b3-657a5ba6c742}" Name="AverageRating" StaticName="AverageRating" DisplayName="Rating (0-5)" Description="Average value of all the ratings that have been submitted" Group="Ratings" Type="AverageRating" Decimals="2" Min="0" Max="5" ShowInEditForm="TRUE" ShowInDisplayForm="TRUE" ShowInNewForm="FALSE" SourceID="http://schemas.microsoft.com/sharepoint/v3" RowOrdinal="0" /> <Field ID="{b1996002-9167-45e5-a4df-b2c41c6723c7}" Name="RatingCount" StaticName="RatingCount" DisplayName="Number of Ratings" Description="Number of ratings submitted" Group="Ratings" Type="RatingCount" Min="0" Decimals="0" ShowInEditForm="FALSE" ShowInDisplayForm="TRUE" ShowInNewForm="FALSE" SourceID="http://schemas.microsoft.com/sharepoint/v3" RowOrdinal="0" />