James picks a deliberately awkward example. A brother or sister is naked, and destitute of daily food, and someone says to them, Depart in peace, be ye warmed and filled — and gives them nothing. He asks the obvious question: what does it profit?
His point is not that works earn salvation; the letter assumes readers who already claim faith. His point is diagnostic. A faith that never reaches the hands is not a weaker version of faith. It is, in his words, dead, being alone — the way a body without breath is not a resting body but a corpse.
This is uncomfortable in a religious culture that prizes right belief and treats action as optional application. James will not allow the split. Shew me thy faith without thy works, and I will shew thee my faith by my works. He is saying that faith is not directly observable, and that behavior is the only place it becomes visible to anyone else.
He then reaches for Abraham, of all people — the man Paul uses to argue for justification by faith. James is not contradicting him. He is pointing out that when Abraham was tested, the faith he had already been credited with actually did something. Belief that costs nothing and changes nothing has not yet been tested enough to know what it is.