Given an expertise social network and a task consisting of a set of required skills, the team formation problem aims at finding a team of experts who not only satisfy the requirements of the given task but also communicate to one another in an effective manner. To solve this problem, Lappas et al. has proposed the Enhance Steiner algorithm. In this work, we generalize this problem by associating each required skill with a specific number of experts. We propose three approaches to form an effective team for the generalized task. First, we extend the Enhanced-Steiner algorithm to a generalized version for generalized tasks. Second, we devise a density-based measure to improve the effectiveness of the team. Third, we present a novel grouping-based method that condenses the expertise information to a group graph according to required skills. This group graph not only drastically reduces the search space but also avoid redundant communication costs and irrelevant individuals when compiling team members. Experimental results on the DBLP dataset show the teams found by our methods performs well in both effectiveness and efficiency.