The secret is: Pronoun before noun
Kann Peter Klaus helfen?
Normal word order. Peter is subject, Klaus is object, so Peter helps Klaus.
Kannst du Klaus helfen?
Still normal word order. Technically pronoun before noun applies, but it doesn't matter anyway. Du is subject, Klaus is object, so you help Klaus.
Kannst du ihm helfen?
And again normal word order. As both subject and object are pronouns, everything's fine. Du is subject, ihm is object, so you help him.
Kann Peter ihm helfen?
Kann ihm Peter helfen?
The more natural word order is the latter one. Peter is subject, but the object usually precedes the subject in that case as the pronoun goes before the noun.
Kann mir jemand helfen?
is better than
Kann jemand mir helfen?
which isn't that wrong, though. But be aware that in some cases it feels quite awkward, and in other cases people wouldn't even notice. You may need to develop a certain language feel, I guess.
Important note: This is a tendency, not a strict rule.
As you probably know, jemand is an indefinit pronoun, but the rule / tendency mentioned above refers to personal pronoun. So,
Kann Peter jemandem helfen?
is correct, but
Kann jemandem Peter helfen?