As my short list of works shows, I've written Fantasy such as The Fire At The Gates and also pure Science Fiction works such as Automatic Rebellion.
So, what's really the difference between writing Fantasy and writing Science Fiction?
In both cases, the trick of writing a good science fiction or fantasy work (of course, in my humble opinion ...) is introducing one or several items of science fiction or fantasy and keeping the rest of the world (such as it remains ...) as mundane and regular and normal as possible.
It comes out of the desire to test and display how those elements introduced interact with the normal and the mundane.
The science fiction or fantasy elements can be varied. Artificial Intelligence entities. Robots. Space ships. Dragons. Evil wizards. Spirits trapped in gemstones.
So, what is really the difference?
More on this a bit later ...