Ask Claude to Write a Custom ESLint Rule
The ESLint plugin ecosystem is huge but it never has the exact rule your team needs. Claude knows the AST visitor API and can write a working custom rule from a plain-English description.
Write a custom ESLint rule called no-hardcoded-urls that reports an error
when a string literal starts with "https://" or "http://" and isn't
assigned to a constant named with ALL_CAPS.
Claude generates the rule file, the correct visitor structure (Literal node visitor), and a full test file using RuleTester with passing and failing cases. You don't need to know anything about AST node types.
Write an ESLint rule called require-error-boundary-in-async-components that
warns when a React component uses useQuery or useSWR but doesn't have an
ErrorBoundary wrapper in its nearest parent component tree.
For enforcement in your codebase, Claude will also show you how to wire the rule into your eslint.config.js:
// Claude will generate this setup
import noHardcodedUrls from './eslint-rules/no-hardcoded-urls.js'
export default [
{
plugins: { local: { rules: { 'no-hardcoded-urls': noHardcodedUrls } } },
rules: { 'local/no-hardcoded-urls': 'error' }
}
]
If you can describe the bad pattern, Claude can write the rule that catches it.
Log in to leave a comment.
The /security-review command scans your uncommitted changes for injection vectors, auth gaps, hardcoded secrets, and other common vulnerabilities.
The SessionStart hook fires when any session begins or resumes, making it ideal for loading environment variables and running one-time setup scripts.
Ask Claude to write property-based tests for your functions using fast-check — it identifies the mathematical invariants in your code and generates tests that cover inputs you'd never enumerate by hand.