Code Knowledge Tracing (CKT) aims to model students' programming proficiency from their coding activities. Existing approaches mainly rely on answer records and lack problem descriptions and knowledge concepts, which fail to capture the inherent information. To solve this problem, we propose ECKT, an Enhanced Code Knowledge Tracing framework using Large Language Models (LLMs), which simulate human cognitive process through chain-of-thought prompting and adapts quickly to new tasks with limited data using few-shot learning. Specifically, ECKT generates detailed problem descriptions and knowledge concepts from student code, enhancing the model's understanding of programming concepts and proficiency. Additionally, ECKT incorporates task difficulty information by correlating problems with difficulty levels based on student performance scores. This integration allows for a more accurate assessment of student proficiency across varying levels of difficulty. Also, ECKT can explicitly capture the essential information of code and learn a better representation of them. Experimental results demonstrate that ECKT effectively improves the performance of knowledge tracing in programming education. This advancement not only supports personalized learning but also contributes to a deeper understanding of coding activities.