SAD but true: Krysty Wilson-Cairns is rare. She’s a young woman, she’s from a working-class background, she’s Scottish and she works in movies. More than that: she works on movies like 1917, the extraordinary new First World War film directed by Sir Sam Mendes. “I always dreamed of writing a war movie,” she says, “but I never thought as a young female writer I’d be given the chance.”

The story of how the 32-year-old Glaswegian did get the chance is interesting, and unexpected, and features some strong supporting characters: a single mum putting herself through college, a Scottish granny obsessed with Global Video and two guinea pigs intent on killing a human.

The guinea pigs featured in Wilson-Cairns’s first piece of writing and give you an idea of what’s she about: she did her apprenticeship on the grand-guignol TV horror Penny Dreadful and now she’s writing about the horror of the Somme. She’s interested in the unconventional and the dark and the frightening. And the human.

All of it shows in the script she wrote with Mendes for 1917. It has some of what you’d expect from a First World War movie – the muddy trenches, the aloof officers, the hope that it will be over by Christmas – but mostly it doesn’t. The story follows two young soldiers on the Western Front tasked with delivering a message that will prevent a massacre and it unfolds in one, long, continuous shot through some of the landscapes of the First World War we see less often: in the air, in the water, under the ground.

But it’s the two central characters that we care about and there’s one moment in particular, in which one of the soldiers talks about his mother, that came straight from Wilson-Cairns’s experiences. When she was preparing for the movie, she tells me, she and her mum went for a trip round the sites and cemeteries of the First World War in northern France and it was there that a lot of the story and the emotions fell into place for her.

“I was there with my mum and I was reminded often how many mothers came to France from 1919 onwards,” she says. “All those cemeteries were built for mothers and wives.”

Wilson-Cairns says it’s no accident, given her experiences in France, that her film ended up being about two men trying to stop a battle. “This is an anti-war movie,” she says. “The very notion of war as a last resort – a war should be no resort.”

Writing a war movie was always a dream for Wilson-Cairns.

She admitted: “I never thought as a young female writer I would be given the chance, especially one on this scale.

“There’s so much in this that would’ve been a red flag but Sam Mendes being the man that he is, he always picks the best person for the job regardless of who they are. He doesn’t always hire people who are like him.”

And Krysty Wilson-Cairns is definitely not like Sam Mendes. She grew up in the Shawlands area of Glasgow in what she calls an un-ordinary family. Her mum was a single mother and when Wilson-Cairns was growing up it was just the two of them.

“She was an incredible woman,” says Wilson-Cairns. “She decided to go back to college; she didn’t have any qualifications when my father left. So she went back to college and I was watching my mum researching and studying when I was three years old. It always inspires me.”

Wilson-Cairns’s grandparents were also a big influence on her. Her grandfather was from Govanhill and her gran, who was from the Gorbals, left school when she was nine. Every week, she and Wilson-Cairns would go to the library and choose a book and you’d better have read it by the end of the week because there’d be questions.

A love of movies was also something passed down from her grandparents. They would go to Global Video in Shawlands, sometimes three or four times a week, and Wilson-Cairns would pick a film and her grandparents would pick a film and they’d watch each other’s choices. Her grandfather loved war movies so Wilson-Cairns saw a lot of them.

Her grandparents were also a big influence in other ways. They spent every spare penny they had to help pay for her to go to a private school, Craigholme on the South Side of Glasgow; they also encouraged her to have opinions and to have confidence in her abilities – confidence which led to her first becoming involved in film and television when she was 14 years old.

“They used to film Taggart at Govan,” she says, “and I went down to the set and said, ‘Can I watch?’ and they let me. I went every day in the summer holidays and I kept hanging around and eventually they gave me odd jobs and that slowly built into every holiday and I worked on commercials as a runner when I was 16.”

At home, Wilson-Cairns’s mother – the matriarch of a family that saw education as the top priority – wasn’t entirely happy when her daughter said she wanted to have a career in television, but the compromise was that she would at least get a degree.

So she joined a film and television course at the RSAMD, which is where she wrote her first piece of fiction – the story about the guinea pigs out to kill a human. Her tutors said: this is great, give us more.

Gradually, at RSAMD and later at the National Film and Television School in London (paid for with a bar job), Wilson-Cairns began to get a sense of what she wanted to write about and – perhaps surprisingly, given the struggles of her own family – it wasn’t kitchen-sink dramas.

“I have a huge respect for the people who write them,” she says, “and they’re often very profound, but it was never going to be me.”

Wilson-Cairns was given a job by Mendes fives years ago after meeting the director, who was executive producer of television series Penny Dreadful at the time.

The horror thriller was exactly the kind of thing she wanted to be writing, and she thinks the Scottish film and television industry should be doing much more of the same.

She also thinks it’s a bit sad that she had to go to London to find the kind of magical, mystical work she wanted to do. “I left to go to London for that reason because they would never make a big-budget sci-fi thriller up here, so I thought, ‘Well, I need to go where it’s going to be.’”

1917 is released on January 10