A short but complete example:
Set up the world:
The Demo is a room.
A magic egg is a kind of thing.
The player is carrying 2 magic eggs.
Declare the action itself:
Shaking is an action applying to one thing.
Describe the syntax the player uses to perform that action:
Understand "shake [something]" as shaking.
Write rules for the different rule books (before, check, carry out, report, instead):
Carry out shaking a magic egg:
say "The egg vanishes.";
remove the noun from play;
And a minimal test script:
Test me with "shake egg".
The Inform 7 IDE comes with two complete manuals, both of which contain a lot of information about this. If you are looking for an explanation of how things work, Writing with Inform is your friend. You should look at chapters 7 (Basic Actions), 12 (Advanced Actions) and 17 (Understanding). If you are more in a "learning by doing" mode, you could do well to have a look at The Inform Recipe Book, in particular chapter 6 (Commands).