The review by HM Chief Inspector of Prisons also found handcuffs were used excessively and some people spent too long in cells.
But a report concluded care and safety was generally better in north Wales than elsewhere.
HM Court and Tribunals said it was working to improve secure custody.
During the July 2015 inspections of 26 courts, assessors raised concerns some custody staffing levels compromised detainees' safety and care.
They pointed to Wrexham Magistrates' Court, where cell bells were not answered quickly, some defendants were not checked regularly and staff were sometimes left alone in the custody suite.
Inspectors said the process of identifying vulnerable detainees was inconsistent across Wales and staff needed more training to better understand mental health, drug and alcohol problems.
They also found some workers put too much focus on security rather than the treatment of detainees, but said aspects of care in north Wales were better than elsewhere.
This could be down to workers having more time than their colleagues in busier areas such as south Wales, the report said.
But the review found the use of force to restrain people when needed was rare and most custody staff had good people-skills which helped them calm conflict.
Deputy Chief Inspector of Prisons, Martin Lomas, said: "This report raises concerns about safety and risk management, as well as staff training, and we have made a number of recommendations, some to be resolved nationally, that would contribute to improvements in the care of detainees, particularly the most vulnerable."
A spokesman for HM Courts and Tribunals said it was working to improve and deliver safe and secure custody and to make better use of video links to avoid prisoners being brought to court unnecessarily.
The safety of detainees held in court cells in Wales is being put at risk by low staffing levels in some areas, an inspection has found.