[verb (dictionary form)] + んじゃない [verb (dictionary form)] + んじゃなかった
んじゃない after a verb in the dictionary form is a spoken "don't!": a reprimand, the way a parent tells off a child or a teacher a pupil. Said with a falling tone, it is an order, not a question.
It comes from someone with the standing to scold. Said to a superior or a stranger it is rude; ask with ないでください instead. The bare prohibitive な – なく泣くな – is blunter and rougher than んじゃない.
In the past, aimed at yourself, it means "I shouldn't have": you did it and wish you hadn't.
The verb stays in the dictionary form; only ない changes to なかった.
With a rising tone and a question mark, the same words are a guess: "I think ~, don't you?" This is a different pattern. It takes any plain form, not only a verb.
くる来るんじゃないきごう! with a falling tone is "Don't come!"; くる来るんじゃないきごう? with a rising one is "I think he's coming".