agentleFS
ConfabulousDevConfabulousDev/confab-web/.claude/skills/frontend-maintenance/skill.md

frontend-maintenance

Skill15 starsChanged 3 months agoMITView on GitHub

Frontend codebase maintenance - dead code detection, linting, dependency updates, and cleanup for TypeScript/React code.

The file

Show its rules and text

We split this skill into the rules it gives an agent

15 rules. About 0 are common, 15 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈15

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use TodoWrite to create a checklist and track progress

    line 12
  2. Distinctive:

    Run commands from project root using full paths

    line 13
  3. Distinctive:

    Use the Grep tool instead of bash grep for searching

    line 14
  4. Distinctive:

    Unused files: Delete immediately (truly dead code)

    line 39
  5. Distinctive:

    Unused exports: Remove export keyword or delete if truly unused

    line 40
  6. Distinctive:

    Unused dependencies: Verify before removing (@types/* packages may be implicit)

    line 41
  7. Distinctive:

    If knip reports issues, fix them before continuing with other maintenance tasks

    line 42
  8. Distinctive:

    Do NOT ask for permission - just fix and report what was cleaned up.

    line 44
  9. Distinctive:

    Use Grep to find these patterns:

    line 84
  10. Distinctive:

    Look at the largest files first - they often contain logic that could be extracted

    line 112
  11. Distinctive:

    Use Grep to find repeated patterns: similar function signatures, identical JSX structures, duplicated state management

    line 113
  12. Distinctive:

    Check for inline logic that already exists as a utility function elsewhere

    line 115
  13. Distinctive:

    After fixing issues in Phases 1-2, run the code-simplifier agent to simplify and refine any modified frontend code:

    line 143
  14. Distinctive:

    Create a summary with:

    line 155
  15. Distinctive:

    Remove dead code flagged by knip

    line 183

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
skill.md

Frontend Maintenance

Periodic evaluation and cleanup for the frontend codebase.

Instructions for Claude

  1. Use TodoWrite to create a checklist and track progress
  2. Run commands from project root using full paths
  3. Use the Grep tool instead of bash grep for searching
  4. Collect all findings, then triage and summarize at the end

Phase 1: Automated Checks

Track with TodoWrite:

  • Dead code detection (knip)
  • Linting warnings (ESLint)
  • Outdated dependencies
  • Security audit
  • TODO/FIXME audit
  • Test coverage

Dead Code Detection

# Knip: finds unused files, exports, and dependencies
cd frontend && npm run knip

# ESLint for general linting
cd frontend && npm run lint

IMPORTANT: The knip report should be clean (no output = no issues).

  • Unused files: Delete immediately (truly dead code)
  • Unused exports: Remove export keyword or delete if truly unused
  • Unused dependencies: Verify before removing (@types/* packages may be implicit)
  • If knip reports issues, fix them before continuing with other maintenance tasks

Do NOT ask for permission - just fix and report what was cleaned up.

Dependency Audit

cd frontend && npm outdated
cd frontend && npm audit

Update strategy:

  • Patch versions: Update immediately
  • Minor versions: Update if low-risk
  • Major versions: Note for review, don't auto-update

Test Coverage

# Use --run to avoid watch mode
cd frontend && npm test -- --coverage --run

Phase 2: Manual Code Review

Track with TodoWrite:

  • Security review
  • Code smell detection
  • DRY / code deduplication review
  • Logic simplification review
  • Bundle size check

Security Review Checklist

  • XSS prevention: dangerouslySetInnerHTML uses DOMPurify
  • User input sanitized before display
  • No secrets in client-side code
  • API errors handled gracefully

Code Smell Patterns to Search

Use Grep to find these patterns:

# Empty catch blocks
Pattern: "catch.*\{\s*\}"

# Console.log left in code
Pattern: "console\.log"

# Any type usage
Pattern: ": any"

# Disabled ESLint rules
Pattern: "eslint-disable"

DRY / Code Deduplication Review

Actively search for opportunities to reduce duplication and simplify logic:

Duplicated patterns to look for:

  • Similar UI components that could share a common base (e.g., pages with tables, modal dialogs, form patterns)
  • Repeated fetch/state/error handling logic across hooks or components
  • Identical or near-identical CSS patterns across module files
  • Copy-pasted utility logic (formatting, validation, data transforms)
  • Similar conditional rendering blocks across components

How to search:

  1. Look at the largest files first - they often contain logic that could be extracted
  2. Use Grep to find repeated patterns: similar function signatures, identical JSX structures, duplicated state management
  3. Compare hooks that do similar things (e.g., multiple hooks that fetch + poll + handle errors)
  4. Check for inline logic that already exists as a utility function elsewhere

Logic simplification to look for:

  • Overly nested conditionals that could be flattened (early returns, guard clauses)
  • Complex expressions that could be extracted into well-named variables or functions
  • State that could be derived from other state instead of tracked independently
  • Effects that could be replaced with event handlers or useMemo
  • Verbose patterns that have simpler idiomatic equivalents

Action: Report findings with specific file locations and a brief description of the simplification. For low-risk improvements (extracting a shared component, simplifying a conditional), fix directly. For larger refactors, note in the findings table.

Bundle Size Check

cd frontend && npm run build

Watch for chunks exceeding 500 KB - consider code-splitting.

Files to Prioritize for Review

Largest/most complex:

  1. schemas/claudeTranscript.ts (~545 lines) - Validation
  2. pages/ShareLinksPage.tsx (~347 lines) - Complex UI
  3. pages/APIKeysPage.tsx (~316 lines) - Complex UI

Phase 3: Code Simplification

After fixing issues in Phases 1-2, run the code-simplifier agent to simplify and refine any modified frontend code:

Use the Task tool with subagent_type="code-simplifier" and prompt:
"Simplify and refine recently modified TypeScript/React code in the frontend/src/ directory.
Focus on clarity, consistency, and maintainability while preserving all functionality."

This catches additional simplification opportunities (verbose patterns, unnecessary complexity, inconsistent style) that automated tools miss.

Phase 4: Triage and Report

Create a summary with:

Findings Table

CategorySeverityIssueLocationAction
SecurityHigh/Med/LowDescriptionfile:lineFix/Ticket/Ignore
Dead Code............
Duplication............
Simplification............
Code Smell............
Bundle............

Severity Guidelines

  • High: Security vulnerabilities, crashes
  • Medium: Bugs that affect functionality, significant code smells
  • Low: Minor issues, style inconsistencies, small improvements

Action Guidelines

  • Fix now: Low-risk, high-value improvements (dead code, patch updates)
  • Create ticket: Larger refactors needing planning
  • Ignore: Acceptable tradeoffs, false positives

Risk Categories

Low-Risk (Do Immediately)

  • Remove dead code flagged by knip
  • Fix linting warnings
  • Update patch-level dependencies

Higher-Risk (Plan Carefully)

  • Major dependency updates
  • Restructuring components
  • Shared type modifications

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.