We provide a general approach to the classification results of stable solutions of (possibly nonlinear) elliptic problems with Robin conditions. The method is based on a geometric formula of Poincaré type, which is inspired by a classical work of Sternberg and Zumbrun and which gives an accurate description of the curvatures of the level sets of the stable solutions. From this, we show that the stable solutions of a quasilinear problem with Neumann data are necessarily constant.As a byproduct of this, we obtain an alternative proof of a celebrated result of Casten and Holland, and Matano.In addition, we will obtain as a consequence a new proof of a result recently established by Bandle, Mastrolia, Monticelli and Punzo.