The challenges of gardening in shallow soil are many. Shallow soil is often dry and rocky, so you'll have to choose plants that tolerate low moisture. Adding to the difficulty is that nutrients wash out of the soil quickly, so fertility is usually poor. On the other hand, some shallow soil can be damp, so dry-loving plants will not grow in it.
Many herbs, such as oregano, thyme and lavender are native to the dry, rocky soils of the Mediterranean. You'll find evidence of this in Spanish, Italian and Greek cuisine. In keeping with their origins, many of these herbs require poor, dry soil. Locations that are high in organic matter and nutrients, and those that are wet, will rot most herb roots. Full sun is the best light for most herbs, but most will tolerate partial sun.
Look for low-growers like thyme, oregano, parsley and cilantro. Their shallow roots thrive in shallow soils and shade the soil, moderating moisture. Lavender, rosemary and sage grow in poor, rocky and shallow soil. They also add height and strong fragrance to the herb garden. Shallow-rooted bulbous herbs like garlic and chives store water in their bulbs and survive arid conditions.
Treat your shallow-soiled herb garden like a rock garden and add many other plants for variety. Blue fescue is shallow-rooted and well adapted to drought and poor soil, as are other low growers like Dianthus and Armeria. For real ground huggers that you can actually walk on, plant Irish or Scotch moss -- Sagina and Arenaria spp. -- and Ajuga. Small and medium-sized wildflowers like ox-eye daisy and blanket flower are also suitable.
If your soil is too shallow to grow anything at all, or if your shallow soil is damp, consider building a raised garden using wooden timbers or masonry elements. Ensure a well-drained planting area by using gravel in the bottom and well-drained planting medium in the root zone. Finely shredded bark, sand, compost and fine gravel make an excellent mix that provides a suitable balance of drainage, moisture retention and nutrition.