How to add user to a group on command line?
To add a user to a group:

dseditgroup -o edit -a vivek -t user developers


(Note: you can also do this with dscl as in @hobs' answer, but you really should both add the user's short name to the GroupMembership list, and also add the user's GeneratedUID to the GroupMembers list.  dseditgroup does both with a single operation.)

To check membership:

dseditgroup -o checkmember -m vivek developers


Or:

dsmemberutil checkmembership -U vivek -G developers


To remove a user from a group:

dseditgroup -o edit -d vivek -t user developers


(Again, you can do this with dscl, but need to remove the user from both GroupMembership and GroupMembers.  dseditgroup does both.)