Could you please specify the term "skill id"?
If "skill id" is a spell id then you could get it out of the spell link:
Code:
local name, rank = GetSpellInfo(spellName, spellRank);
DEFAULT_CHAT_FRAME:AddMessage("Spell: |Hspell:" .. SpellID .."|h|r|cff71d5ff[" .. name .. " " .. rank .. "]|r|h");