Skip to content

code-tidying: new self-document skill — comments → self-documenting code (audit + apply modes) #1245

Description

@kyle-sexton

Intent

Add a new skill to the code-tidying plugin that removes comments and rewrites the code so it becomes self-documenting (rename, extract, restructure). Removal is always paired with code that carries the information — otherwise the comment stays.

Motivations:

  • Self-documenting code as org posture.
  • Fewer tokens for AI agents reading code.
  • Code as single source of truth — no comment-drift maintenance burden.

Name (locked — do not re-litigate)

code-tidying:self-document — fits the plugin's verb-shaped siblings.

Skill shape (locked — do not re-litigate)

  • Actions: audit / find-candidates (read-only) + apply modes.
  • Scope: configurable via arguments or natural-language prompt, with safe defaults; the skill confirms user intent before mutating anything.
  • Scope grammar:
    • Default: uncommitted changes (working tree + staged).
    • Modes: last commit; feature-branch commits vs default branch; whole-repo hunt.
    • Whole-repo mode routes through the existing tidy-lane infrastructure — no second repo-walking mechanism.

Boundaries vs existing skills (locked — do not re-litigate; reuse-or-replace, no silent second way)

  • code-tidying:audit-comment-residue stays the read-only residue detector and becomes a consumable input to this skill.
  • code-tidying:tidy keeps its in-passing comment deletes (Beck tidyings) with a pointer to this deep skill.
  • /simplify (harness builtin) remains the current-diff general quality pass.
  • Evaluate consolidation during design; each skill's skip-when states the boundaries.

Research work item

Derive the org's comment criteria from the literature and reconcile into one org posture:

  • Clean Code (Robert C. Martin)
  • The Pragmatic Programmer
  • Counterweights: Ousterhout's A Philosophy of Software Design (comments carry design intent code cannot), Fowler (extract function instead of comment), Beck

Criteria home (locked — do not re-litigate)

  • New comment-conventions doc in melodic-software/standards (policy home). Verified gap: no comment-philosophy doc exists there today; criteria currently live only in the user's global CLAUDE.md, which will then defer to the standards doc.
  • The skill points at the doc — pointer-not-copy.
  • User-reserved escalation: if execution research argues a different home, surface to the user before placing.

Keep-list guardrails (locked — bake into skill design)

Exempt from removal:

  • Non-obvious "why" comments
  • Constraints
  • Interface/design-intent contracts
  • TODO(#issue)
  • Legally required headers
  • Public-API doc comments (XML docs/JSDoc — separate axis; feeds generated docs)

Never bulk-strip.

Integration sub-item (locked scope)

Evaluate seams for making the discipline a default — standards doc via managed sync, planning/implementation skill defaults, repo CLAUDE.md rule, hook — pick during design.

Explicitly out of scope: the broader "are our plugins modular vs repo-influenced" question (separate future issue).

Priority

priority: medium — daily-driver quality tooling, no gates, tidy-family tier.

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-humanHuman-in-the-loop required; autonomous sessions must not resolve items carrying this.priority: mediumReal value, no hard deadline; normal backlog flow.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions