Mammaliaformes

Mammaliaformes ("mammal-like") is a clade which contains the mammals and their closest extinct relatives.
Living members of the clade include the monotremes (Monotremata), marsupials (Marsupialia) and the eutherians (Placentalia).
Mammaliforms have highly specialized molar teeth, with cusps and flat regions for grinding food. This is a single inherited system in present mammals, but it seems to have evolved convergently in pre-mammals more than once. Instead of having many teeth that are frequently replaced, mammals have one set of baby teeth and later one set of adult teeth which fit together precisely. This may help to grind food, and make it easier to digest.
Lactation (milk) and fur, along with other features, also characterize the Mammaliaformes, though these traits are difficult to study in the fossil record. The fossilized remains of Castorocauda lutrasimilis are an exception to this.
Evolution of early mammals
Fossils of Mesozoic proto-mammals are scarce. There were only 116 in 1979, but this has changed in recent times. There were about 310 in 2007, with an increase in quality: there are "at least 18 Mesozoic mammals [with] nearly complete skeletons".
Ecological niches in the Mesozoic
There is still some truth in the "small, nocturnal insectivores" stereotype, but recent finds show that proto-mammals gradually developed a variety of lifestyles. For example:
Castorocauda, a member of Docodonta lived in the Middle Jurassic about 164 million years ago (mya). It was about long, weighed , had limbs that were adapted for swimming and digging and teeth adapted for eating fish. Another docodont, Haldanodon, also had semi-aquatic habits. Aquatic tendencies were probably common among docodonts, since they lived in wetland environments.
Multituberculates are allotherians that survived for over 125 mya (from mid-Jurassic, about 160 mya, to late Eocene, about 35 mya) are often called the "rodents of the Mesozoic". They may have given birth to tiny live neonates rather than laying eggs.
Fruitafossor, from the Upper Jurassic about 150 mya, was about the size of a chipmunk. Its teeth, forelimbs and back suggest that it broke open the nest of social insects to prey on them (probably termites.
Spinolestes also had adaptations for digging, so it also might have had anteater-like habits. It is notable for quills like those of modern spiny mice.
Volaticotherium is from the boundary with the Lower Cretaceous about 125 mya. It is the earliest-known gliding mammal and had a gliding membrane that stretched out between its limbs, rather like a modern flying squirrel. This suggests it was active mainly during the day. It is not the only example of this type of locomotion.
Repenomamus, from the early Cretaceous 130 mya, was a stocky, badger-like predator that sometimes preyed on young dinosaurs. Two species have been recognized, the largest over a metre long.
Ichthyoconodon is known from mollariforms found in marine deposits. These teeth are sharp-cusped and similar in shape to those of piscivorous mammals. This has been taken to mean that it was a marine mammal, one of the few examples known from the Mesozoic.
This paints a picture of small-sized mammals being already quite successful and diversified in the Jurassic and early Cretaceous.
Taxonomy
In some sources Class Mammalia takes the place of Mammaliaformes, and includes all members of that clade.