Short answer. The law lets you resign on the spot, without the usual one-month notice, only for serious causes: serious insult to your honor, inhuman and unbearable treatment, or a crime or offense committed against you or your immediate family by the employer or a representative, plus causes genuinely comparable to those.
What the law says
An employee may put an end to the relationship without serving any notice on the employer for any of the following just causes: Serious insult by the employer or his representative on the honor and person of the employee; Inhuman and unbearable treatment accorded the employee by the employer or his representative; Commission of a crime or offense by the employer or his representative against the person of the employee or any of the immediate members of his family; and Other causes analogous to any of the foregoing.
Labor Code, Article 285 — Resignation By The Employee. Read the full provision →
The default rule is one month's notice
Article 285 starts from the ordinary case: an employee who resigns without just cause must serve a written notice at least one month in advance, and an employer who gets no such notice may hold the employee liable for damages. The no-notice option only opens up where one of the article's specific just causes is present — it is the exception, not the general rule, and an employee who simply walks out over ordinary friction or dissatisfaction is still bound by the one-month requirement.
The three named causes
The article lists three specific situations that justify leaving without notice: serious insult by the employer or a representative on the employee's honor and person, inhuman and unbearable treatment, and the commission of a crime or offense by the employer or a representative against the employee or an immediate family member. Each of these describes conduct well beyond an unpleasant workplace — an insult has to be serious, and treatment has to be both inhuman and unbearable, not merely strict or unfair.
The catch-all for comparable causes
The article closes with "other causes analogous to any of the foregoing," which allows conduct not spelled out by name to still qualify — but only if it is genuinely comparable in gravity to serious insult, inhuman treatment, or the commission of a crime. This is not an open invitation to treat any grievance as sufficient; the word analogous ties any additional cause back to the seriousness of the three the article actually names.
Who the mistreatment has to come from
Each cause requires the conduct to come from the employer or his representative — the article is about the employment relationship itself, not about a coworker acting on their own. Mistreatment from someone with no authority to act for the employer does not, by the article's own terms, fall within these grounds, since it is not conduct by the employer or a person representing the employer against the employee.