A bstract The production of prompt D + and $$ {D}_s^{+} $$ <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML"> <mml:msubsup> <mml:mi>D</mml:mi> <mml:mi>s</mml:mi> <mml:mo>+</mml:mo> </mml:msubsup> </mml:math> mesons is studied in proton-lead collisions at a centre-of-mass energy of $$ \sqrt{s_{NN}} $$ <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML"> <mml:msqrt> <mml:msub> <mml:mi>s</mml:mi> <mml:mi>NN</mml:mi> </mml:msub> </mml:msqrt> </mml:math> = 5 . 02 TeV. The data sample corresponding to an integrated luminosity of (1 . 58 ± 0 . 02)nb − 1 is collected by the LHCb experiment at the LHC. The differential production cross-sections are measured using D + and $$ {D}_s^{+} $$ <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML"> <mml:msubsup> <mml:mi>D</mml:mi> <mml:mi>s</mml:mi> <mml:mo>+</mml:mo> </mml:msubsup> </mml:math> candidates with transverse momentum in the range of 0 < p T < 14 GeV /c and rapidities in the ranges of 1 . 5 < y ∗ < 4 . 0 and –5 . 0 < y ∗ < –2 . 5 in the nucleon-nucleon centre-of-mass system. For both particles, the nuclear modification factor and the forward-backward production ratio are determined. These results are compared with theoretical models that include initial-state nuclear effects. In addition, measurements of the cross-section ratios between D + , $$ {D}_s^{+} $$ <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML"> <mml:msubsup> <mml:mi>D</mml:mi> <mml:mi>s</mml:mi> <mml:mo>+</mml:mo> </mml:msubsup> </mml:math> and D 0 mesons are presented, providing a baseline for studying the charm hadronization in lead-lead collisions at LHC energies.