Barbadian singer Rihanna has recorded music for her eight studio albums and has collaborated with other artists for duets and featured songs on their respective albums, which also includes charity songs. After signing a record contract with the Def Jam Recordings in February 2005, Rihanna began to work with producers Carl Sturken and Evan Rogers, who co-wrote and co-produced 12 out of the 15 songs on her 2005 debut album, Music of the Sun. Award-winning songwriter Diane Warren co-wrote the title track, while Grammy Award-winning singer-songwriter Deniece Williams co-wrote the song "Willing to Wait". Sturken and Rogers co-wrote and co-produced 9 songs out of 16 on Rihanna's 2006 album A Girl like Me. The album's lead single "SOS" was written by Evan "Kidd" Bogart and J. R. Rotem. It contains a sped-up sample of "Tainted Love", written in 1965 by Ed Cobb, who was credited as a co-writer on "SOS".
Rihanna's third studio album Good Girl Gone Bad was developed by songwriters and producers with whom she had previously collaborated as well as different artists. Sturken and Rogers co-wrote and co-produced 2 songs out of 13. Different writers and producers, including Christopher "Tricky" Stewart, Timbaland and Norwegian production team Stargate (Tor Erik Hermansen and Mikkel S. Eriksen) significantly contributed to the album, writing and producing a total of nine songs between them. "Don't Stop the Music", the third single to be released from Good Girl Gone Bad, contains a sample of Michael Jackson's "Wanna Be Startin' Somethin'" and attributes to Jackson as a co-writer. The album was re-released in 2008 and featured new songs written by then-boyfriend Chris Brown and Maroon 5. Rated R, Rihanna's fourth studio album, presented a new creative direction for the singer. Ne-Yo, "Tricky" Stewart, Hermansen and Eriksen produced tracks for the album, as well as Chase & Status and Justin Timberlake. The lyrical content cast an ominous, dark and foreboding tone over Rated R, which critics noted as a step away from her more care-free persona of past albums.
Rihanna's fifth studio album Loud saw the singer return to her dancehall roots. Stargate composed three tracks for the album—"Only Girl (In the World)", "What's My Name?" and "S&M". Fellow Barbadian singer-songwriter Shontelle co-wrote the reggae-infused song "Man Down". The singer's sixth studio album in as many years, Talk That Talk, incorporated predominantly R&B songs. Tracks were produced by Calvin Harris, Dr. Luke and Stargate. The album's lead single "We Found Love" was written and produced solely by Harris. Dr. Luke co-wrote and co-produced three songs for the album: "You da One", "Where Have You Been" and "Fool in Love". The lead single from Rihanna's seventh studio album, Unapologetic, is entitled "Diamonds".