Context free grammar where number of a's is larger than number of b's in any prefix of the string The prefixes of the string aabab are a, aa, aab, aaba, aabab.
If the number of a's should be greater or equal to the number of b's, the grammar would be 

S -&gt; aS | aSbS | e,

but I need it with strictly more a's than b's in any prefix.
I thought of this grammar, but I'm not sure it is correct.

S -&gt; aS | aSAbA | a
 A -&gt; aA | aAbA | e
In short, take your grammar for  the language having a greater or equal number of $a$'s in every prefix, but rename the startsymbol to $P$, i.e.
$$
 P \to aP \mid aPbP \mid \varepsilon.
$$
Then simply note that your condition requires a word to start with an $a$, hence the following will do the job:
$$
 S \to aP.
$$
For if $S \to w$ then $w = auv$ with $|u|_a \le |u|_b$, where $|u|_a$ denotes the number of $a$'s in $u$ (and analog for $|u|_b$), hence for the prefixes of $w$ the assertion follows. And conversely it works the same.

For your given grammar, this is correct (but I leave my answer as it seems to be simpler). For a proof note that if the produced word contains at least one $b$, then it must have at least two $a$'s before it, and this is what your production $aSAbA$ takes care of, where from $A$ we can just derive words having at most as many $a$'s as $b$'s in every prefix.

Let me give another approach to think about this. Might be a little bit to much theory, but just for education and reasoning. Note that the famous Dyck language is defined as
$$
 D := \{ w \in \{a,b\}^{\ast} :  |u|_a \le |u|_b \mbox{for each prefix $u$ of $w$ and } |w|_a = |w|_b \}.
$$
It is quite simple to give a grammar for this language, for example
$$
 S \to \varepsilon \mid SS \mid aSb.
$$
Now if we denote by $\mbox{pref}(L)$ the set of prefixes of some language $L$ then your initial language of words having at most as many $a$'s as $b$'s in any prefix is $\mbox{pref}(D)$. And it is quite easy to derive a grammar from it, just make sure every production could be finished any time on the right (for a general argument see this post), hence we could give the grammar
$$
 S \to \varepsilon \mid SS \mid aSb \mid aS \mid a
$$ 
where the production $S \to aS$ could also be leaved out. Now simply note that words fulfilling your restriction have to start with an $a$ and proceed as above.