AST winter, during a bleak and lengthy Bristol-to-Hull train journey, I started reading Robert Crawford's excellent book, On Glasgow And Edinburgh.

In truth, I was trying to boost my knowledge of Scottish history. Mindful that the referendum was looming (and that I would be doing my stand-up shows in the lead-up to it), I felt I should have an informed stance.

In a chapter discussing early 18th-century Edinburgh, Crawford briefly mentions The Fair Intellectual Club. This was a secret organisation for girls who wished to demonstrate that "women as well as men might participate in intellectual improvement". Crawford described the club thus: "This self-help group's nine teenage members (their number aligned with that of the nine classical muses) studied Tatler, The Spectator, Dryden and other writers. They were, though, advised that 'comedies should be read with caution'."

Crawford explained that the clandestine club was discovered when one of its members fell in love with a man who belonged to an "Athenian Society". This gentleman told his fellows about these innocent maidens who sought moral and cerebral perfection, and The Fair Intellectual Club was brought to the attention of the wider public. In 1718, the ladies published a pamphlet outlining their rules and constitution, with transcripts of speeches made by their members. I was intrigued, and by the time I got off the train at Hull I had resolved to track down a copy of this document and find out more about these remarkable young women. The pamphlet is available from the Gale archive, and it arrived some days later. Despite the linguistic intricacies of the early 18th-century text, I found myself captivated by the story of these thoughtful, fearless girls.

The Fair Intellectual Club was founded by three young women who went out walking in Heriot Gardens one day in 1717. They remarked: "One of us took occasion to propose that we should enter into a society, for improvement of one another in the study and practice of such things as might contribute more effectually to our accomplishment … The honour of our sex in general, as well as our particular interest, was intended when we made that agreement."

The original three members then sought out six other like-minded ladies. Even though the word "feminist" didn't appear until the late 19th century, these women were already exploring fairly radical ideas. They railed against the idea that certain fields of study, such as history and geography, were male preserves, saying: "It is an injustice to deprive us of those means of knowledge. How else shall we express our fondness to have our natures reformed and refute these scandalous aspersions cast upon our sex, that we are made up of pride, affectation, inconstancy, falsehood, treachery, tyranny, lust, ambition, wantonness, levity, disguise, coquetry, and the like ill things, so often in the mouths and writings of men."

The group held weekly meetings where they presented "harangues" on various subjects. They were meticulous in keeping notes and had a very clear set of rules - the first and most important being that members were sworn to utter secrecy. They knew that their conduct "may occasion a great many objections against us, such as, that we go out of our sphere, that we neglect more proper business etc".

Hitherto my knowledge of 18th-century Scotland had been largely confined to the great men of the Enlightenment. I was aware that the English chemist John Amyatt had said: "Here I stand, at what is called the Cross of Edinburgh, and can, in a few minutes, take 50 men of genius and learning by the hand." I knew that David Hume, Adam Smith et al had flourished in the latter part of the century - but The Fair Intellectual Club was convened six years before Smith was even born.

The Edinburgh that the girls inhabited was confined within the city walls, bounded by the Nor Loch, and consisted of dark and crowded closes. The idea of expanding northwards had been suggested, but the space and splendour of the New Town was still decades in the future.

With their quest for self-improvement, I felt that the Fair Intellectuals foreshadowed the general optimism of the Enlightenment. Even though the girls knew that they were unlikely to be able to demonstrate their cerebral powers publicly, they were not discouraged from developing them.

They also preached religious toleration, reflecting the widespread movement from superstition to rationalism that would flourish later in the century. The Bargarran "witches" had been hanged and then burned in Paisley only 20 years before. Concurrently in Edinburgh, Thomas Aikenhead was the last person to be executed in Britain for blasphemy. The Fair Intellectuals urged "true, unaffected and unsophisticated piety" and would not countenance "angry zeal against those who may be of a different persuasion".

When I had finished reading the rules, constitutions and inaugural speeches of the club, I was already weighing up what to do with this story. Although I have written stand-up shows and scripts for TV and radio, I had never considered writing a play before. Yet there was something in this tale that I thought would be ideal for the stage. I was intrigued by these women, who seemed so representative of the times they lived in, and yet so far ahead of them.

In continental Europe at that time women were allowed access to learned circles, if only on the periphery as hostesses. It was not until the middle of the 18th century that Edinburgh could boast its own famous salonniere, Alison Rutherford. Also to come in the late 1700s were the legendary Blue Stockings - but they were older women, already established in society.

It seemed that the three teenage founder members of The Fair Intellectual Club acted in the absence of any real role models for their own sex. I came to think of the girls as feminists in a pre-feminist world. They laid out their aims clearly: "We thought it a great pity that women who excel a great many others in birth and fortune, should not also be more eminent in virtue and good sense, which we might attain unto if we were as industrious to cultivate our minds, as we are to adorn our bodies."

I thought it might be interesting to bring the club's story to light now, as I have recently been inspired by young women like Lucy Anne Holmes of the No More Page 3 Campaign, and Laura Bates of Everyday Sexism. They feel to me like direct spiritual descendants of the Fair Intellectuals. The frustration our 18th-century counterparts felt at being dismissed as trivial and useless is still experienced by women nearly 300 years later.

I also thought that the Scotland of the early 1700s would make a germane backdrop for a show in 2014. Questions about the usefulness of the Scottish-English bond were obviously central to life then as well, as the Union was so new. I began to consider the impact events such as the failure of the Darien scheme and the Jacobite Risings might have had on the lives of our club members and their families.

For the next few months I was working on other things and put the play to the back of my mind. However, I was reading more about that period of Scottish history, and my three main characters were forming in my mind. In January, slots were being allocated for the Edinburgh Fringe. I found myself asking Tommy Sheppard, who runs the Assembly Rooms, whether I could have a venue for my play. I was terrified at making my first foray into drama, but figured that without a deadline I would never get it done.

I took what I already knew about the ladies from their own pamphlet and did more research. The girls of the club were all from respectable Edinburgh families. They were governess-educated, and spoke French and Italian - it had become fashionable for women at that time to master other tongues. It was suggested that a factor in the ladies' desire for improvement was to ensure they compared favourably to the sophisticated continental women that upper-class men met on the Grand Tour.

They met in the chambers of the club's secretary and each paid a subscription, which was donated to the poor. I was unable to find out what had become of the women in later years, or whether the revelation of their society did indeed bring the scorn and censure they had feared. With only sketchy details of the real stories of the women, I was free to imagine their lives. I had a picture of the speaker, Mrs Hamilton, as a small, feisty creature, for example, so I made her a religious zealot who suffers a crisis of faith. And I decided to focus on the three founder members, as teenage girls often have bizarre friendship triangles.

We know these hopeful teenage girls didn't go on to be central figures in the Enlightenment - it took a bit of digging to find any women of the 18th century who made an impact on the world at large. I was nonetheless inspired by the way some women satisfied their hunger for learning in circuitous ways. I discovered Margaret Flamsteed (wife of the first astronomer royal, John Flamsteed) and Marie-Anne Pierrette Paulze (wife of the chemist Antoine Lavoisier), both of whom worked closely with their husbands. The early astronomer Mary Somerville was also in my mind. I looked at contemporary poets such as Elizabeth Singer Rowe and Catharine Trotter Cockburn.

What has happened since I wrote the play has felt slightly magical. I managed to secure the services of one of Scotland's eminent theatre directors, Marilyn Imrie. Together we have assembled a hugely talented cast of young Scottish actors - Caroline Deyga, Jessica Hardwick and Samara MacLaren. I hope we've created something of which The Fair Intellectual Club would approve.

I hope the play will appeal to anyone with an interest in history, but I am also keen to see what teenage girls make of it. The original club pamphlet struck me as sweetly timeless. When I was 15, I had a secret club with my friends Tracy and Vicky, called The Woebegone Spangles. Our aims weren't as lofty as those of the Fair Intellectuals - we made pretend radio programmes. Nonetheless, we enjoyed the secrecy and rule-making. In the chaotic years around puberty, being able to feel in control of some aspect of our lives was really helpful.

The dynamics of female friendship have always interested me, and I have loved films like Mean Girls and Heathers. In this play all the girls betray each other in one way or another, yet they have an incredibly strong bond of friendship. I am still very close to the friends I made in that window between girlhood and womanhood, as we shared such intense experiences. That was what I was trying to recreate with this play. Who knows, at next year's Fringe I may stage a reunion of The Woebegone Spangles.

I've thoroughly enjoyed the experience of creating this show and I am hoping that my involvement with the Fair Intellectuals will not end here. I intend to do more research into the history of the club, and find out more about what became of the ladies involved. They aspired to intellectual stimulation and moral improvement and their influence has rubbed off on me, almost three centuries later. The effect that The Fair Intellectual Club has had on me can neatly be summed up in their own words:

"Oh, how delightful is the pleasure of the mind. No-one knows it but those who value reason and good improvement above fine shapes, beauty and apparel."


The Fair Intellectual Club is at the Assembly Rooms, George Street, Edinburgh, August 1-24 at11am, tickets £9/£10. Box Office or call 0844 693 3008.
Lucy Porter's 10th stand-up show, Me Time, will be at the Stand One from
July 31-August 10