Tag: code-quality

  • Stop Enforcing Style Manually: Auto-Generate ESLint Rules

    Stop Enforcing Style Manually: Auto-Generate ESLint Rules

    Every dev team has unwritten style rules.

    One person always destructures props first, another hoists types to the top of files, someone else hates nested ternaries, the lead wants meaningful variable names instead of single letters.

    Right now you catch these in code review: send it back, wait for the fix, review again.

    Here is how to turn those rules into custom ESLint plugins Claude generates and your CI/CD enforces automatically.

    1. Collect your team’s actual patterns. Pick 5-10 recent PRs. Ask Claude: what patterns do you see across these files? Look for variable naming, import order, early returns, error handling shapes, prop organization, spacing, comment style.
    2. Define the rule in plain English. Not just the pattern but WHY. Example: custom rule to always wrap async operations in try-catch, because uncaught promise rejections are silent failures. Another: destructure component props at the top, never use props.x inline, because it makes dependencies visible.
    3. Generate the ESLint plugin. Prompt Claude to write a custom ESLint rule (node type visitors, detect violations, suggest fixes). It generates a working plugin you drop into .eslintrc or publish as an npm package.
    4. Test it on your codebase. Run the new rule against your entire repo. Claude can generate fixes for all violations in one batch pass.
    5. Integrate into CI. Add the rule to your lint step. New PRs fail lint if they break your pattern. No more review ping-pong on style.
    6. Expand over time. Caught a new anti-pattern in review? Feed Claude more examples and regenerate the rule to catch it next time.

    The payoff: style decisions stick, PRs review 10x faster because lint handles it, and new team members follow the rules from day one without asking.

    ——

    Book your free AI clarity call, NOW!
    https://buff.ly/TpWy277

    ——

    Repost this. Thanks.

  • Your Code Deserves Comments: Automate Them at Scale

    Your Code Deserves Comments: Automate Them at Scale

    You inherit a 50,000-line codebase with zero comments.

    Nobody remembers why half of it was written. The business logic is implicit. New hires spend weeks reverse-engineering functions that should have taken hours to understand.

    Manual commenting takes forever. AI can help.

    Claude Code can read your functions semantically, understand what they actually do, and add comments that explain the “why,” not the obvious “what.” Then you batch the whole codebase in parallel.

    The workflow:

    1. Point Claude Code at your functions using the batch tool to process multiple files at once.
    2. Ask it to add one meaningful comment per 5-10 lines of code.
    3. Skip trivial single-line functions and getters.
    4. Focus on business logic, non-obvious decisions, and edge cases.
    5. Review the output, refine, and commit.

    The payoff: onboarding drops from weeks to days. Code audits take hours instead of days. Refactoring becomes less risky because the intent is documented.

    Claude doesn’t just comment. It understands the code’s purpose and documents why someone chose this approach over the obvious one.

    ——

    Book your free AI clarity call, NOW!

    https://buff.ly/TpWy277

    ——

    Repost this. Thanks.