I am making one right now. The best thing is to write down on paper how the game will work, how pages and information will flow. Try to get every little detail you can think of on paper and work everything out before coding and making the database. I didn't do that and its probably cost me 50 hours or programming having to go back over pages and pages of code to update something I missed because I didn't plan everything out first. The worst part is having to change, add or delete database structure. I have changed my database structure 4 times I think adding and deleting things because of new ideas and finding better ways to do something, mainly because I started programming my game without planning anything out or how it would work.
Just make sure you get a design down and a system of how the game will work and what is needed before jumping to the creation part.
I also found that writing down information on a piece of paper for each page you code is good and an overall paper for things that affect more then one page like (I am going to literally have a book of just notes on different things I have written down). If you hard code a value on this one page, and also use it on another page, if you ever wanted to change that value, you might only make the change on one page and forget you need to change it on the other (I also put in comments saying that it has to be changed on the following pages too). It's best to avoid any programming at all like that but hey sometimes it happens đŸ˜‰
Plan Plan Plan, try to think in terms of coding as you plan like, I need this done, how would I do this in general (make notes so when you get to the coding part you don't have to rethink how you can achieve the goal). Also sometimes ideas flow to your head all at once and you just want to start coding them right away before you forget, I have a pad of paper just to write down ideas that pop into my head, what they are and how I plan on coding them.
As for code examples..... That’ll be hard to show since it all depends on how YOU make the game. I might be able to lend you examples of how to do something specific during the game process since I have a lot done a lot that corresponds to making a game. I mean I have TONS of pages and I don't think you will be able to find any "shells" to make a game like an rpg out there. I guess it might be possible to make a shell for the "fantasy RPG hack and slash build up stats and fight bigger monsters and people" but I don't know of any.
My game is a whole new thing and completely unique that no one has done; although it will also play to a "select" audience that wont be as broad as a fantasy rpg but it will be new and unique. It will be like Alien Adoption Agency AAA in the way its set up and runs. It wont be anything like it at all in story or how to play it, but how its set up to play online (browser based, text and static pictures).
I know I typed a lot and sorry if you read it and got nothing out of it, I hope it helped somewhat. If you have any specific questions or iodeas on how to design a certian element of the game let me know and I will try to help you out.
Oh just thought of another thing, to help you visualize what you need in your plan, make accounts with other rpg games out there and play there game, see how they set it up and how it works. Sometimes it might help you remember something like if you forgot about health points or something (less easily spottable) and saw that they use it in the other game. Try not to copy another games structure verbatum but it'll get you in the right direction.