The data-driven transient stability assessment (TSA) of power systems can predict online real-time prediction by learning the temporal features before and after faults. However, the accuracy of the assessment is limited by the quality of the data and has weak transferability. Based on this, this paper proposes a method for TSA of power systems based on an improved extreme gradient boosting (XGBoost) model. Firstly, the gradient detection method is employed to remove noise interference while maintaining the original time series trend. On this basis, a focal loss function is introduced to guide the training of the XGBoost model, enhancing the deep exploration of minority class samples to improve the accuracy of the model evaluation. Furthermore, to improve the generalization ability of the evaluation model, a transfer learning method based on model parameters and sample augmentation is proposed. The simulation analysis on the IEEE 39-bus system demonstrates that the proposed method, compared to the traditional machine learning-based transient stability assessment approach, achieves an average improvement of 2.16% in evaluation accuracy. Specifically, under scenarios involving changes in topology structure and operating conditions, the accuracy is enhanced by 3.65% and 3.11%, respectively. Moreover, the model updating efficiency is enhanced by 14-15 times, indicating the model's transferable and adaptive capabilities across multiple scenarios.