A literary genre is a category of literary composition. Genres may be determined by literary technique, tone, content, or even (as in the case of fiction) length. They generally move from more abstract, encompassing classes, which are then further sub-divided into more concrete distinctions. The distinctions between genres and categories are flexible and loosely defined, and even the rules designating genres change over time and are fairly unstable.
Much of current classical literary genres starting with the ideologies of Aristotle as outlined in his famous treatises, Rhetoric and Poetics. In the treatise Rhetoric, Aristotle arranges rhetorical literary genres into three categories: the deliberative, forensic, and epideictic. He further categorizes genres of poetry in his treatise Poetics, where he also creates three different genre forms: the epic, tragedy, and comedy. Aristotle's ideas regarding literary genre were fine-tuned through the work of other scholars. 
Genres can all be in the form of prose or poetry. Additionally, a genre such as satire, allegory or pastoral might appear in any of the above, not only as a subgenre (see below), but as a mixture of genres. Finally, they are defined by the general cultural movement of the historical period in which they were composed.
Genre should not be confused with age categories, by which literature may be classified as either adult, young adult, or children's. They are also not the same as 'format', such as graphic novel or picture book sub-genre.
Genre ideology began to truly develop with the ideologies and written works of Aristotle, who applied biological concepts to the classification of literary genres. These classifications are mainly discussed in his treatises Rhetoric and Poetics. In these treatises, he outlines rhetorical literary genres as well as prose and poetry genres. In Rhetoric, Aristotle introduces three new rhetorical literary genres: deliberative, forensic, and epideictic. He discusses the goals of the orators in what they hope to accomplish through the use of these rhetorical genres. 
In his treatise Poetics, Aristotle discusses three main prose/poetry genres: the epic, tragedy, and comedy. He discusses these genres as chief forms of imitative poetry, noting that they are representations and imitations of human emotions and characteristics. 
Genre was further developed by numerous literary critics and scholars. Notably, a scholar by the name of Northrop Frye published "Anatomy of Criticism," where he theorizes and verbalizes a system of genres. Through the system, he uses a set of rules to describe the constraints of each genre. In his piece, he defines methodological classifications of the genres of myth, legend, high mimetic genre, low mimetic genre, irony, the comic, and the tragic through the constitution of "the relation between the hero of the work and ourselves or the laws of nature." He also uses the juxtaposition of the "real" and the "ideal" to categorize the genres of romance (the ideal), irony (the real), comedy (transition from real to ideal), and tragedy (transition from ideal to real). Lastly, he divides genres by the audience they are intended for into: drama (performed works), lyric poetry (sung works), and epic poetry (recited works). 
Prior to Frye, there were a number of works written that helped shape literary genre. One of the works was by Cassius Longinus, a philosopher who wrote a treatise called "On the Sublime" which discussed the works of more than 50 literary writers and the methods they used to influence their audiences' emotions and feelings.
The idea of 'imaginative' genre, or genre that exists on factually untrue invented places, people, or things- writing about what does not exist- only started in the Romantic period. The reason for this shift is often attributed to the social events that were taking place in the Western world in terms of wars, infighting and overthrown leadership.  People felt the need for "escapism" to remove themselves from their respective situations. 
Literary works exist in various types, and genres categorize them based on specific shared conventions, as noted above. Genres are then further divided into subgenres. Literature is subdivided into the classic three forms of Ancient Greece, poetry, drama, and prose. Poetry may then be subdivided into the genres of lyric, epic, and dramatic. The lyric includes all the shorter forms of poetry, e.g., song, ode, ballad, elegy, sonnet. Dramatic poetry might include comedy, tragedy, melodrama, and mixtures like tragicomedy.
The standard division of drama into tragedy and comedy derives from Greek drama. This division into subgenres can continue: comedy has its own subgenres, including, for example, comedy of manners, sentimental comedy, burlesque comedy, and satirical comedy, and so on.
Often, the criteria used to divide up works into genres are not consistent, and can be subjects of debate, change and challenge by both authors and critics. However, some basic distinctions can be almost unanimous. For example, a common loose genre like fiction ("literature created from the imagination, not presented as fact, though it may be based on a true story or situation") is well known to not be universally applicable to all fictitious literature, but instead is typically restricted to the use for novel, short story, and novella, but not fables, and is also usually a prose text.
Semi-fiction or spans stories include a substantial amount of non-fiction. It may be the retelling of a true story with only the names changed. It can also work reciprocally, where fictional events are presented with a semi-fictional character, such as Jerry Seinfeld.
The origins of modern genre theory is linked back to the European Romantic movement in the late eighteenth and early nineteenth centuries, where the concept of genre was scrutinized heavily. The idea that it was possible to ignore genre constraints, and the idea that each literary work was a "genre unto itself" gained popularity. Genre definitions were thought to be "primitive and childish." From that point until the twenty-first century, modern genre theory often sought to dispense of the conventions that have marked the categorization of genres for centuries. However, the twenty-first century has brought a new era in which genre has lost much of the negative connotations associating it with loss of individuality or excess conformity.