Capitalism corrupts everything and every death penalty sentence carried out likely carries the stains of greed, imperialism, and corporate interests. False convictions are rampant and always target minorities. Under Capitalism it can only act as a tool for genocide.
During a Revolution, yes.
Revolutionaries rarely have the resources to hold large numbers of POWs in prisons, so the worst of them should be executed (neo-nazis/nazis, high level war criminals, etc). Those are completely irredeemable in those circumstances anyway.
For other "normal" POWs I support a strategy used by Mao against the Nationalists. He had POWs go through a course, like a school course, about Marxism, with assignments, quizzes and tests, etc., and afterwards the graduates would receive an actual diploma stating they have successfully completed the course and were allowed to either join the revolutionaries, go home peacefully, or even go back to the Nationalist armies.
Those that went back to the Nationalist armies were seen as too compromised by the Nationalist armies and either sent home anyway, or in most cases outright imprisoned and sometimes executed. So many did not rejoin their previous commands for obvious reasons.
So under such a strategy, you can't lose.
After a Revolution, no.
No need. Not even for those who are irredeemable, such as someone who performs heinous crimes or what not. Life sentences should suffice for those who shouldn't return to society at large. Those in prison should have access to education, personal fulfillment, and work for fair pay which they can send to their families, have personalized experiences in prison (within reason, obviously everything should comply with safety standards of the convict, but what is the harm in allowing a convict to have a potted tomato plant or whatever if they aren't going to misuse it?), etc. Solitary confinement and other methods of prison torture should go away completely, with other safety methods researched and utilized to ensure safety regarding the very very very very rare individual who is unsafe to interact with anyone and everyone (after all, even some 35 year old who spent the last 5 years murdering 20 children managed to go the first 30 years without doing so, right?).
Most of those who have committed the most heinous of crimes will likely have some form of mental illness at the root of it. Trauma could be likely, or forms of delusion or other mechanisms. Therapy and thorough documenting of their cases could not only help the individual recover, but may lead to new therapeutic techniques or lead to better establishing the root causes of such issues which may in turn assist therapists in wider society treat those who are at risk of this type of behavior before they start such behavior, or otherwise help policymakers establish policies which are more inclusive to prevent others from acquiring the traumas which may have triggered the thoughts in the inmate which led to their conviction.
Not to mention that even under ideal communism, the criminal justice system will still be limited by human capacity. Even if the process is somehow 100% automated or performed by AI, that too will be limited by the biases and other human limitations of the automation engineer or Machine Learning/AI programmer and the likely human created/gathered data it is fed. There is a non-zero percent chance of a false conviction, so that means there would be a non-zero percent chance of a wrongful murder at the hands of the state during the execution of a death penalty.
Also, after the revolution, as poverty decreases so will crime. A prison system which is not privatized and which operates under a government driven to eradicating poverty and establishing a society built on true egalitarian principles will have far far fewer prisoners and fewer crimes. Why risk altercations with individuals and law enforcement by spending hours pickpocketing in subways for such few gains when you can spend that same amount of time pursuing free education or a job doing something fulfilling which will pay much more and provide much more satisfaction? Need a rush of adrenaline? Become a skydiving instructor or rock climbing guide. Prison space will invariably open up and the resources necessary to support the few left over whose crimes are not related to poverty will certainly be there.
(Disclaimer: I have no experience with this. I am also a bit of an idiot sometimes.)
In a non-socialist society? No. I do not trust the laws to be ethical, and I do not trust the people who make these decisions because they've (probably) been absorbing capitalist propaganda since they were born.
In a socialist society? Maybe, in some extreme cases where the culprit is so incredibly reprehensible and impossible to rehabilitate that everyone would be safer if they were dead, and only if every step of the judicial process was completely transparent (I think it should be transparent in any case, but especially for the death penalty). In most cases, forced rehabilitation (through labour and education) is a better solution, in my opinion.
Fidel in his autobiography has a long section on the death penalty. Most of the political leaders have come around to be against it, but the people still vastly prefer it, especially for horrendous crimes.
He says that one day, after patient education to the public on why its not necessary, and life in prison is preferable for those cases, then they'll hold a referendum on it and ban it.
What about atrocities that were so well documented so as to be certain it happened and who did it? Don't get me wrong, wrongful execution is the biggest problem with the death penalty, but if your defendant was someone like Josef Mangele or Heinrich Himmler, I don't think you need to worry about that.
In socialism - with the disclaimer of penal system being socialist one, that is focused on rehabilitation, yes for the worst cases of crime and corruption.
This I disagree with. I don't think mental states should be punished with death. Child molesters, or people who actively fight for fascism or whatever, maybe, but merely thinking the wrong way should not be punishable by death, instead, re-education for fascists and monarchists or psychiatric treatment in the cases of mental disorders like pedophilia (which, again, is a distinct concept from acting on it and actually victimizing a child) are necessary.