SPOILER ALERT: Do not read ahead if you have not watched “Empire” Season 3, episode 3, which aired Wednesday, Oct. 5 on Fox.

“Empire” welcomed its biggest name yet on this week’s episode with Mariah Carey playing — what else? — a superstar songstress.

The hit show, which has gained a reputation for flaunting a who’s-who of guest stars, has considerably toned down the guests this season, instead focusing on the central Lyon family, but when Carey became available, the “Empire” team jumped at the chance.

In fact, Carey’s relationship with co-creator Lee Daniels and executive producer/director Sanaa Hamri goes way back. In the ’90s, Hamri was hired to cut a music video for the singer, and later was chosen to direct her first-ever music video with Carey’s “Thank God I Found You” remix. The collaboration marked Hamri’s foray into directing and was the start of a long professional partnership between the two.

“We just really grew close,” Hamri tells Variety, crediting Carey for bringing her under her wing.

“I directed a bunch of stuff for her, went on tour with her many times, and I learned a lot about filmmaking through the eye of a music video director,” Hamri says. “I went on to do film and television, but we definitely have a lot of history together and I feel like I got a great glimpse of the music industry through her eyes and around her — like what really went down in the business. I met all these people because she opened that doorway for me at that time. It’s very kismet.”

Carey is also close with Daniels, so together, the “Empire” EPs knew they had to find a part for her — especially because she’s a fan of the show.

“She had told Lee and myself that she wanted to be on the show, and when we found the right opportunity, in terms of weaving her in for a critical storyline for one of our characters, that’s when Lee and I turned to each other and said we should get her in,” Hamri explains.

On Wednesday night’s episode, Carey played Kitty, a musician who comes to Empire to record a duet with Jamal (Jussie Smollett), who’s been struggling to perform, due to PTSD from when he was shot in Season 2. Their collaboration is hot, but Jamal has to pop pills in order to muster up the ability to get back into the studio.

Here, Hamri tells Variety more about having Carey on “Empire.” Plus, is Jamal in danger of an addiction?

How involved was Mariah in the role? Did she have any input on the character or the look of Kitty?

With Mariah, she always has input because she’s been around for awhile and she really knows what she’s doing. We’re very collaborative on “Empire” and every time we have a guest star, we definitely talk to them about what we’re thinking and listening to what they say so we had a bunch of conversations. Her and I spent hours on the phone talking about the nail color, what we’re going to do with her ensemble — we talked about emulating a slight ’60s vibe.

You and Lee Daniels know Mariah, but for the others, what was it like to have her on set?

She’s amazing on set. It’s like her domain. Our cast, they embrace everybody and they’re so warm. They’re also used to that type of celebrity around. I think it was more like the production office and the crew that was like, “Oh my god, Mariah is here today!” She came, she was professional, she was an actress, she did the scenes, and it just felt like another day on the job. But the set was definitely buzzing that day.

Will we see Mariah in any more episodes?

We’ve talked about her coming back. She’s a very busy lady, and it was hard enough to get that one day with her — we shot that all in one day because of her schedule. But we want to have her back.

How did the duet between her and Jamal come about?

“Infamous” is a song that she wrote and produced for us. It’s just the perfect sexy, sultry song that in essence, even though it’s Kitty and Jamal doing the duet, it’s really the subtext of Cookie (Taraji P. Henson) and Lucious (Terrence Howard) and it just works so well because if you really listen to the words, she said, “It’s dangerous, it’s infamous, a greater love,” and to me, that’s the subconscious love affair that is constantly going on with Cookie and Lucious and that works so well thematically for our show.

It seems like that duet gets Jamal out of his funk, but was it Kitty and the music that helped him overcome his PTSD? Or was it the pills?

Here’s the thing: I think it’s very obvious, the reason why we did this storyline — it’s to show that even with Kitty coming and being one of Jamal’s favorite artists, he first doesn’t want to perform. He’s first not able to, and he pops a pill. So now we’re at a place where Jamal can sing in a recording studio, but only with his medication. That means that not only does he have PTSD, but he’s maybe starting to get hooked on his pain killers. That is definitely going to be a place that we’re going to have to track and watch Jamal carefully.

Angelo (Taye Diggs) tries to go in for a kiss with Cookie. She’s really playing hard to get. Will we see them get together, and how soon may that come about?

We’re going to have to see what Cookie does because Cookie is over it. She’s street smart and she’s heartbroken, so she’s going to make any dude wait for it and work for it. We have to see if Angelo is really going to be able to cut the mustard and be able to hang on long enough before she’s willing to let her guard down, and I think that’s part of her journey. As you see, there are flashbacks of her old boyfriend Barry and the reason why she’s having flashbacks is because Taye Diggs’ character is reminding her of the boyfriend she used to have when she was younger, and he was the opposite of Lucious. She made a choice when she met Lucious and she didn’t continue and follow Barry, so Angelo brings up all these issues for her. She’s reflecting on her past, she’s reflecting on the fact that she made a choice.

Tariq (Morocco Omari) was behind Andre’s (Trai Byers) arrest. How bad is this going to get?

There are no limits and no limits for Tariq. He is an almost bastard child that was not treated the way he thought he should be treated by his family. While being the half-brother of Lucious, the father did not favor him. He is completely obsessed with Lucious because it’s so personal to him. He’s going to do anything to bring down his empire, he’s going to go for everyone and he’s not going to stop. You can see that he was able to pull some strings to get Andre arrested, and it’s just going to get worse.

At the end of the episode, Cookie and Lucious are now at odds. They are always back-and-forth, but is this time different?

It will get pretty bad because Cookie is now getting more and more sucked into Angelo’s world and you’ve got Lucious who is seeing the love of his life get away. There’s going to be a lot of double-crossing and new revelations that are going to come out of this. We’re going to see again, how great is their love and is it going to survive? And he’s got Anika (Grace Gealey) living with him, so that’s a whole other thing!