Boil the potatoes, with their skins on, until tender.
Heat the olive oil in a frying pan and fry the onion until golden.
Peel the potatoes while they are still hot, then pass the potatoes, onion and Swiss chard through a food mill or ricer. Place the mixture in a bowl.
Stir in the egg and flour to form a soft, pliable dough.
Divide the dough into pieces the size of a small fist and roll them out into lengths about 2cm/¾in thick. Cut the lengths into 2cm/¾in long pieces. The gnocchi can be frozen at this stage; spread them out on a well-floured tray and put them in the freezer. When frozen, shake off any excess flour and put them in a bag. Use within 3 months.
To cook, boil the gnocchi in salted water for about two minutes (allowing 1-2 minutes extra cooking time if cooking from frozen). When they're cooked they will bob up to the surface.
Drain well and serve immediately with the sauce of your choice.