Cursor가 내 파일의 모든 주석을 삭제했습니다

발행: (2026년 2월 22일 오전 10:08 GMT+9)
2 분 소요
원문: Dev.to

Source: Dev.to

What happened?

  • The diff showed that Cursor stripped out comments about a deprecation timeline, a legal‑review warning, compliance notes, and step‑by‑step explanations for a complicated auth flow.
  • Only a few JSDoc blocks survived.

I started with a file containing 41 comment lines (JSDoc, inline explanations, JIRA references, compliance notes, etc.) and ran the prompt three times:

clean up this code

Result: ~20 % of the comments survived. The model consistently removed JIRA references, date stamps, step‑by‑step explanations, and anything it deemed “redundant.”

Trying a different prompt

I changed the prompt to:

refactor this code

and ran it three more times.

Result: ~28 % of the comments survived—still a majority were removed. Both prompts treated comments as noise.

Using a preserve‑comments rule

I added a single .mdc rule:

description: "preserve comments during code modifications"
alwaysApply: true

항상 리팩터링, 정리 및 최적화 과정에서 기존 코드 주석을 모두 보존하십시오.

Running the same “clean up this code” prompt three additional times yielded 41 out of 41 comments preserved on every run. In one run the model even extracted magic numbers into named constants while explicitly noting “per your preserve‑comments rule” in its response.

Why this matters

Without the rule, Cursor interprets “clean up” as “remove anything that looks like clutter.” To an AI processing tokens, carefully written compliance notes can appear as clutter. The model optimizes for what it thinks you want—shorter, cleaner code—often at the expense of documentation.

This behavior can go unnoticed because diffs only show deleted lines; comments disappear silently, leaving future developers without crucial context.

How I’m handling it

  • I use the preserve‑comments rule for all refactoring tasks.
  • I run cursor‑lint to ensure my .mdc files have valid front‑matter and the alwaysApply flag set.
  • I maintain a collection of tested rules on GitHub (including the comment‑preservation rule and ~70 others).

If you’d like a full review of your setup—rules, project structure, model settings—I offer $50 async audits with a written report.

0 조회
Back to Blog

관련 글

더 보기 »