Skyrmions have attracted significant interest due to their topological spin structures and fascinating physical features. The skyrmion phase arises in materials with Dzyaloshinskii-Moriya (DM) interaction at interfaces or in volume of non-centrosymmetric materials. However, although skyrmions were generated experimentally, one critical intrinsic relationship between fabrication, microstructures, magnetization and the existence of skyrmions remains to be established. Here, two series of CoFeB ultrathin films with controlled atomic scale structures are employed to reveal this relationship. By inverting the growth order, the amount of defects can be artificially tuned, and skyrmions are shown to be preferentially formed at defect sites. The stable region and the density of the skyrmions can be efficiently controlled in the return magnetization loops by utilizing first-order reversal curves to reach various metastable states. These findings establish the general and intrinsic relationship from sample preparation to skyrmion generation, offering an universal method to control skyrmion density.