Is it swordmaster or swordsmaster?
I have seen both spellings. What is the right one?
If both are right, what is the correct way to use each one?
According to this Ngram, there was a brief spike in 1938 where 'swordsmaster' was used more frequently than 'swordmaster.' This was, in my opinion, due to a single (or few) author(s) in that year that used the form with the 's.' However, since 1980, 'swordmaster' is used between 20 and 50 times more frequently than 'swordsmaster' (in books that Google catalogs for their Ngrams.)
Also, a search for 'swordsmaster' on Google.com returns 1.1M entries for 'swordmaster' automatically, for whatever that is worth. When you correct it to find the entries for 'swordsmaster' explicitly, it comes back with almost 500k entries anyway.
Merriam-Webster has no entry for either word, at least in their online free dictionary.
My opinion is that they would both be correct. They are certainly close enough for someone to determine the intent behind the word. Personally, I'd use the 'swordmaster' version as it seems to 'flow' easier from my tongue. However, if there was a precedent for one form over another in a corpus of work, I'd likely conform to whatever form was already existent.
As others have pointed out, both spellings are commonly used. Whether they are both correct may be harder to determine.
I remember Stephen Pinker referring to a similar effect in The Language Instinct. His example was that an eater of mice would often be referred to as a mice eater, whereas an eater of cats (he may have used a different example) would be a cat eater. He made no judgement about correctness, but suggested that the singular form was always acceptable but the plural variant would sound odd except when the plural was irregular, and that this form was becoming more common.
If you want to base your choice on something other than common usage then my preferred approach is to look for similar constructions where I am already confident about the correct form and try to find a rule that I can apply universally. By this principle if you are happy that, for example, food intended for dogs should be called dogs food or a blanket for use on horses should be a horses blanket then a master of swords should be a swords master.
As for contracting it to one word, I don't know but perhaps it comes from comparison with German, where, I believe, Schwertmeister is an accepted word.