Refactoring 033 - Strip Annotations
Clean up your code by removing unnecessary annotations

I’m a senior software engineer loving clean code, and declarative designs. S.O.L.I.D. and agile methodologies fan.
Search for a command to run...
Clean up your code by removing unnecessary annotations

I’m a senior software engineer loving clean code, and declarative designs. S.O.L.I.D. and agile methodologies fan.
No comments yet. Be the first to comment.
Different stages need different brains.

One Second Brain doesn't scale past one skull.

Style errors double when nobody enforces them.

Know who speaks before the skill runs TL;DR: Always define a clear role at the top of every skill file so you know whose perspective drives the execution. Common Mistake ❌ You write a skill full of

Everyone is talking about Loop Engineering. Apparently, you don't need to program anymore. TL;DR: Loop Engineering is the hottest AI workflow pattern of 2026. But it hides a dirty secret. The Tweet

TL;DR: Make your code simpler and more maintainable by removing redundant or unused annotations.
<?php
// @author John Wick
// @version 3.14
// @description Service for user operations
class UserService {
/**
* @deprecated
* @param int $id
* @return string
*/
public function userName($id) {
// @todo Sanitize input
return $this->database->query(
"SELECT name FROM users WHERE id = $id");
}
}
<?php
class UserService {
// Step 1: Identified annotations
// (@author, @version, @description,
// Step 2: Evaluated their purpose
// (metadata, deprecated, todo notes)
// Step 3: Removed unnecessary annotations (no value added)
// Step 4: Replaced critical annotations
// with explicit code (none needed)
// Type hintings are explicit
public function userName(int $id): string {
$statement = $this->database->prepare(
"SELECT name FROM users WHERE id = ?");
// No tech debt
$statement->execute([$id]);
return $statement->fetchColumn();
// You can add a test to ensure there are
// no new calls to this deprecated method
}
}
[X] Semi-Automatic
You can rewrite them with expressions or with an AI assistant.
You can safely remove annotations if they’re purely metadata or documentation, but ensure any functional annotations (like @Deprecated) are replaced with explicit code or logic to maintain behavior.
You get cleaner, easier-to-read, and less cluttered code.
Removing unnecessary annotations reduces maintenance overhead and focuses on the core logic.
Explicit code over annotations improves clarity and reduces reliance on metadata that may become outdated.
You simplify the mapping between the real-world problem and the code by removing annotations that don’t model the domain.
This creates a clearer, one-to-one correspondence with the problem space, reducing noise and improving maintainability.
Some annotations (e.g., @Override, @Transactional) are critical for functionality in certain frameworks.
You must carefully evaluate each annotation’s role before removal to avoid breaking behavior.
You can use AI tools like ChatGPT or GitHub Copilot to analyze your codebase. Ask the AI to identify annotations, explain their purpose, and suggest replacements with explicit code. Then, manually review and test the changes to ensure correctness.
Suggested Prompt: 1. Identify annotations bloating your code.2. Evaluate their purpose and necessity. 3. Remove annotations with no clear value. 4. Replace critical annotations with explicit code.
| Without Proper Instructions | With Specific Instructions |
| ChatGPT | ChatGPT |
| Claude | Claude |
| Perplexity | Perplexity |
| Copilot | Copilot |
| You | You |
| Gemini | Gemini |
| DeepSeek | DeepSeek |
| Meta AI | Meta AI |
| Grok | Grok |
| Qwen | Qwen |
[X] Intermediate
Image by congerdesign on Pixabay
This article is part of the Refactoring Series.