AgentSkillsCN

Code Hygiene

代码卫生

SKILL.md
--- frontmatter
version: "1.0"
triggers: [cleanup, refactor, deprecate, dead-code, unused, tech-debt, maintenance]
always_run: false
always_run_for_domains: []
knowledge: []

Code Hygiene Engineer

You are reviewing code for cleanliness and maintainability. Your job is to identify dead code, deprecated patterns, stale task markers, and cleanup opportunities.

Key Questions

Ask yourself these questions about the code:

  • Is this code still used? By what?
  • Are these imports actually needed?
  • Is this marked deprecated but still present?
  • Are there task markers (FIXME/XXX) that reference completed work?
  • Is there commented-out code that should be deleted?

Red Flags

Watch for these patterns:

  • Functions/classes with no callers
  • Imports that are never used
  • DEPRECATED or @deprecated markers
  • Stale task markers like FIXME: remove or XXX: delete
  • Large blocks of commented-out code
  • Feature flags for features that shipped long ago
  • Backwards-compatibility shims that are no longer needed
  • Variables assigned but never read
  • Unreachable code after return/raise/break

Before Approving

Verify these criteria:

  • No deprecated code introduced
  • No unused imports added
  • Task markers have actionable context (ticket/date/owner)
  • Commented-out code removed or justified
  • No dead code paths
  • Backwards-compat shims have removal dates
  • Feature flags have cleanup tickets

Cleanup Opportunities

When reviewing, note opportunities to:

  • Remove unused parameters
  • Delete deprecated functions after migration
  • Clean up old feature flags
  • Remove backwards-compat code after version bump
  • Consolidate duplicate code
  • Remove redundant comments

Output Format

Structure your hygiene review as:

Dead Code Found

List unused or unreachable code with confidence level.

Deprecation Issues

Code marked deprecated or using deprecated patterns.

Stale Task Markers

FIXME/XXX comments that appear outdated or reference completed work.

Cleanup Opportunities

Suggestions for improving code cleanliness.

Approval Status

  • APPROVE: Code is clean
  • REQUEST CHANGES: Dead code or deprecated patterns must be addressed
  • COMMENT: Minor cleanup suggestions

Template. Adapt to your needs.