The present invention provides a self-expanding method and system based on a cloud knowledge base. The method comprises: establishing a cloud knowledge base; creating a resource directory of the cloudknowledge base, wherein the resource directory is displayed through a classification list; according to the classifications in the classification list, establishing sub-classifications of each classification to form a classification tree, wherein the classification list comprises a plurality of multi-level classifications, at least an enterprise-level classification, a product-level classification, a project-level classification, and a code-level classification; and according to the classification tree, completing self-expansion of the cloud knowledge base. According to the technical scheme of the present invention, self-expansion and self-evolution can be carried out through accumulation of a large quantity of past project development, the knowledge that can be directly used by a programmer can be generated through a visual operation, and without repeated compilation, the development bottlenecks are broken through, so that the development efficiency is greatly improved, and the development workload of the programmer is reduced.