A molecular dynamics workflow to simulate the desorption–extraction of shale gas is proposed for predicting the production of shale gas. • A novel desorption–extraction MD workflow based on the EF-NEMD is proposed. • Some factors affecting the recovery are examined. • Large amount of methane in micropores is unrecoverable due to the stronger adsorption. • The recovery decline curves could be obtained in the proposed MD workflow. • Models of enhancement of recovery by pressure difference and temperature are built. Understanding microscopic process of gas desorption is important to production forecast in shale gas development. In usual simulations on the gas desorption process, the desorption occurs in a non-equilibrium state, but stops when the desorption–adsorption equilibration is reached. This is contrary to the continuous process in gas production. A workflow based on non-equilibrium molecular dynamics (NEMD) is proposed in this work to simulate the continuous desorption in the illite nanoslits by introducing an intermittent extraction into the whole process. A production curve is obtained in the workflow, and a pseudo decline-curve analysis (PDCA) can be provided in molecular simulation. The variation of desorption–extraction with pore size ( H ), temperature ( T ) and pressure difference ( ΔP ) is discussed. The attraction of illite–methane in the narrower slits is stronger than that in the wider slits. In the early stage, the extraction is dominated by the free gas in the wider slits. And in the later stage, the desorption of adsorbed gas in the narrower slits is the main process. The ΔP and T promote the desorption and extraction mainly in the early stage. The ΔP promotes the desorption in the wider slits more remarkably, while the desorption in the narrower slits is enhanced more by a higher T . The enhancement of desorption by ΔP and T in the early stage is modeled. The newly developed MD workflow and obtained PDCA model can be readily extended to study the extraction and production prediction of shale gas.