Magnetic skyrmions are topologically protected spin textures that have nanoscale dimensions and can be manipulated by an electric current. These properties make the structures potential information carriers in data storage, processing and transmission devices. However, the development of functional all-electrical electronic devices based on skyrmions remains challenging. Here we show that the current-induced creation, motion, detection and deletion of skyrmions at room temperature can be used to mimic the potentiation and depression behaviours of biological synapses. In particular, the accumulation and dissipation of magnetic skyrmions in ferrimagnetic multilayers can be controlled with electrical pulses to represent the variations in the synaptic weights. Using chip-level simulations, we demonstrate that such artificial synapses based on magnetic skyrmions could be used for neuromorphic computing tasks such as pattern recognition. For a handwritten pattern dataset, our system achieves a recognition accuracy of ~89%, which is comparable to the accuracy achieved with software-based ideal training (~93%).