Establishing a development workflow can make the process of coding, testing, and deployment an enjoyable experience. The steps I show you separate the code from the UI as much as possible. I expand upon the following process in detail in the sections that follow:
MMExecute().Let's start by creating a simple JSF command. We can do this by performing a few actions within Fireworks and then saving the steps displayed in the History panel (select Windows > History) as a command:

Figure 1. Creating a simple command
You should now see the command you just saved listed in the main toolbar's Commands menu. Try deleting your rectangle and executing the command you just created (select Commands > Draw Rect). If you saved the correct steps in your History panel, a new rectangle should appear with the same specifications as the one you previously created.
Fireworks created a new JSF (JavaScript Fireworks) file and saved it to a special directory on your hard drive. The file contains JavaScript code that performs the actions you selected in the History panel. Fireworks sees this new file and displays it in the list of commands in the Commands menu. When you select the command from the menu, the JavaScript within this file is interpreted by Fireworks. This behavior should be familiar to anyone who has created a macro in a program like Microsoft Word.
Fireworks commands that are saved from the History panel are stored in your user profile folder:
(Windows) C:\Documents and Settings\<User Name>\Application Data\Macromedia\Fireworks 8\Commands
(Mac OS) Macintosh HD:Users:<User>:Library:Application Support:Macromedia:Fireworks 8:Commands
Fireworks commands that are accessible to all users are stored in the following location:
(Windows) C:\Program Files\Macromedia\Fireworks 8\Configuration\Commands
(Mac OS) Macintosh HD:Applications:Macromedia:Fireworks 8:Configuration:Commands
Likewise, command panels are stored in similar locations:
(Windows) C:\Documents and Settings\<User Name>\Application Data\Macromedia\Fireworks 8\Command Panels
(Mac OS) Macintosh HD:Users:<User>:Library:Application Support:Macromedia:Fireworks 8:Command Panels
and here:
(Windows) C:\Program Files\Macromedia\Fireworks 8\Configuration\Command Panels
(Mac OS) Macintosh HD:Applications:Macromedia:Fireworks 8:Configuration:Command Panels
Browse to your Commands folder and open the file you just created using your text editor of choice. (The lightweight Notepad++ is a great choice that provides syntax highlighting.) If you followed the earlier steps and created a new rectangle, you should see something similar to the following code:
fw.getDocumentDOM().addNewRectanglePrimitive({left:36, top:39, right:101, bottom:104}, 0);
fw.getDocumentDOM().setFillColor("#99cc33");
The first line calls the addNewRectanglePrimitive method of the Fireworks Document Object Model (DOM) and passes two parameters, a Rectangle object and a corner roundness value:
dom.addNewRectanglePrimitive(boundingRectangle, roundness);
The second line calls the setFillColor method and passes a hexadecimal color value. The setFillColor method, like most available methods, performs operations on the currently selected element(s) on the Stage. Because a new rectangle was just created, that same rectangle is now selected and the setFillColor method behaves as expected.
Experiment with the values passed to addNewRectanglePrimitive and setFillColor, save Draw Rect.jsf and rerun the command within Fireworks. You have now performed an action that you will perform countless times if you proceed with Fireworks extension development.