Does the compatibility level for sql server work reliably for scripts?
No the compatibility level is to allow deprecated features to work not to prevent you from writing code that won't work on a lower version. 

If your production machine is SQL Server 2005, you must develop on a SQL server 2005 machine to ensure that features allowed in 2005 are the only ones in the code.  

Of course in Books online there is a page which shows all the features that are new in 2008, so you could simply forbid your developers from using them. And check for them in code reviews, but developing against a correct database is the only real solution.

The list is not short and exotic, the compatibility mode is not intended to allow you to develop on a higher database and deploy to a lower one.