How can I efficiently construct a CFG from a language


I am new to CFG’s and automata in general and I came across an exercise where I needed to construct a CFG for the language {a^m b^n | n <= m + 3}.

So m can be infinitely bigger than n but n can only be up to 3 more bigger than m and they can be the same. I have no idea how to make a CFG for this.

What I came up with was:

S -> AB | _  A -> a | aa | aaa | C | _  C -> aC | a | _ B -> bB | b | _ 

But I think this is not even close…

Any help/tips/advice would be much appreciated!