"From each according to ability, to each according to need" is only a feature of the higher stage of communism (regularly referred to as just "communism"),
For the lower stage of communism (regularly referred to as "socialism"), it's "From each according to ability, to each according to work".
>In a higher phase of communist society, after the enslaving subordination of the individual to the division of labor, and therewith also the antithesis between mental and physical labor, has vanished; after labor has become not only a means of life but life's prime want; after the productive forces have also increased with the all-around development of the individual, and all the springs of co-operative wealth flow more abundantly – only then can the narrow horizon of bourgeois right be crossed in its entirety and society inscribe on its banners: From each according to his ability, to each according to his needs!
- Karl Marx, Critique of the Gotha Programme