Joy Van Asperen of Balclutha asks :-
The leaves on my flowering cherry tree are being eaten by a worm which is green then turns black. I also notice slime and small black flies. What is this?
John Charles, an entomologist in HortResearch's BioProtection Group, responded.
You have provided a fair description of an insect called the 'cherryslug', Caliroa cerasi (L.) (Hymenoptera: Tenthredinidae). The slug-like insect you see on the leaves is the larval stage; the adult is a small black insect (about 1cm long) with 2 pairs of wings. It is a sawfly (Tenthredinidae), which is a primitive type of wasp. It is a Palaearctic species, and a minor pest of some fruit trees throughout Europe. It was first recorded in New Zealand in about 1870, and it may also attack some ornamental shrubs and hawthorn hedges.
The cherryslug overwinters under the ground in silken cocoons as the final of seven larval stages. The adults (almost all females, that reproduce parthenogenetically) emerge in late spring and lay eggs into the mesophyll of young leaves. The larvae soon hatch and feed by rasping the upper epidermis and mesophyll of the leaf - producing the characteristic damage that you photographed. The head is rather hidden under the body and the larva excretes a protective, shiny slime, which gives it the 'slug-like' appearance. The larva develops for 6 weeks or so and then drops off to pupate in the soil. Some then stay there until the following spring, while some emerge to repeat the cycle for a second generation from mid-summer to autumn.
It does have some natural enemies that provide some control, but if numbers are too high then a garden insecticide may be required to prevent unsightly damage to foliage.