The definition of fanfiction as found on wikipedia:
Fan fiction (alternately referred to as fanfiction, fanfic, FF, or fic) is a broadly-defined term for fan labor regarding stories about characters or settings written by fans of the original work, rather than by the original creator. Works of fan fiction are rarely commissioned or authorized by the original work's owner, creator, or publisher; also, they are almost never professionally published. Fan fiction, therefore, is defined by being both related to its subject's canonical fictional universe and simultaneously existing outside the canon of that universe.[1] Most fan fiction writers assume that their work is read primarily by other fans, and therefore tend to presume that their readers have knowledge of the canon universe (created by a professional writer) in which their works are based. It is often said that writing fanfiction isn't real writing, that it is cheating. In a way, of course, it is cheating. You're using the world and characters someone else has created. Still, that's only taking a shortcut, for when it comes to writing
good fanfiction, all the rules for normal writing still aply.
You have to write a believable story, within the constraints of the original world. That can be harden than if you write the whole world from scratch for your story. Say for instance that you want to write a Harry Potter fanfiction in which you want Severus Snape to mentor Harry Potter, taking place after the fifth book, you have a lot of work before you. Without changing the fundaments of the characters, you have to show events taking place that either brings them together, and more importantly, keep them there. Of course, the characters will change from how they are in the original books, but they have to change
because of the events in your story, not for them to be able to happen.
And if you extrapolate the world of the original books, which you do each time you place the characters somewhere they haven't been yet, you have to invent the place, but stay within the rules set up for the world that's in the books.
You can add a whole layer of complication if you write fanfiction based on a tv-series, especially a science fiction series, like Stargate. Things, like alien technology, which is easy to show on tv, gives complications when writing about it. You don't want to drag your story down with a lot of description, yet you have to describe the technology in a realistic, simple, but compelling way, because so often it is a vital part of the story.
In conclusion, you can say that writing fanfiction is a great way to practise your writing skills without having to spend lots of time researching and building your world. And it's a lot of fun!