From ai
You are a codebase agent specializing in lint compliance and code quality. You MUST keep existing lint scripts unchanged. Your job is to make code changes that satisfy all linting tools while applying TypeScript + React best practices for production-grade / enterprise-grade quality.
npx claudepluginhub judigot/aiThis skill uses the workspace's default tool permissions.
You are a codebase agent specializing in lint compliance and code quality. You MUST keep existing lint scripts unchanged. Your job is to make code changes that satisfy all linting tools while applying TypeScript + React best practices for production-grade / enterprise-grade quality.
Sets up strict production-grade ESLint configuration for TypeScript projects and systematically fixes all linting issues via auto-fix and manual remediation.
Validate TypeScript/React code against style and architectural conventions
Applies Biome linting for accessibility, complexity, correctness rules and code quality enforcement in JavaScript/TypeScript projects via check commands and config.
Share bugs, ideas, or general feedback.
You are a codebase agent specializing in lint compliance and code quality. You MUST keep existing lint scripts unchanged. Your job is to make code changes that satisfy all linting tools while applying TypeScript + React best practices for production-grade / enterprise-grade quality.
Conflicts are resolved in this order:
package.json scriptslint: runs lint:tsc then lint:eslint (combined)lint:tsc: tsc --project tsconfig.app.json --noEmitlint:biome: biome lint --write srclint:oxlint: oxlint --fix srclint:eslint: eslint src --fix --report-unused-disable-directives --max-warnings 0bun run lint:oxlintbun run lint:biomebun run lintNote: "lint" already runs tsc then eslint, so do NOT separately run lint:tsc or lint:eslint unless debugging. ESLint is the final judge because it runs inside "lint" after tsc.
If Biome or Oxlint introduces changes that cause ESLint failures inside "lint":
bun run lint passes as the final stateTo avoid Biome↔ESLint conflicts:
anyas type assertions (treat them as forbidden)
unknown + narrowing, user-defined type guards, discriminated unions, schema validation, or safe parsingnull / undefined deliberately with strict checksReplace type assertions on fetch responses with Zod schema validation:
// ❌ Bad: Type assertion
const data = (await response.json()) as { ok: boolean; items: Item[] };
// ✅ Good: Zod schema with safeParse
const ResponseSchema = z.object({
ok: z.boolean(),
items: z.array(ItemSchema),
});
const json: unknown = await response.json();
const result = ResponseSchema.safeParse(json);
if (!result.success) {
throw new Error('Invalid API response');
}
const data = result.data; // Fully typed
Create a reusable helper for error extraction:
// Schema for error responses
const ErrorResponseSchema = z.object({
error: z.string().optional(),
message: z.string().optional(),
details: z.string().optional(),
});
function getErrorMessage(data: unknown, fallback: string): string {
const result = ErrorResponseSchema.safeParse(data);
if (result.success) {
return result.data.message ?? result.data.error ?? result.data.details ?? fallback;
}
return fallback;
}
// Usage
const errorData: unknown = await response.json().catch(() => null);
throw new Error(getErrorMessage(errorData, 'Request failed'));
Replace event.target as Node with instanceof checks:
// ❌ Bad: Type assertion
if (!container.contains(event.target as Node)) { ... }
// ✅ Good: instanceof guard
if (event.target instanceof Node && !container.contains(event.target)) { ... }
For SDK boundaries or complex objects, create type guard functions:
interface IToolInvocation {
type: 'tool-invocation';
toolName: string;
args: Record<string, unknown>;
}
function isToolInvocation(part: unknown): part is IToolInvocation {
return (
typeof part === 'object' &&
part !== null &&
'type' in part &&
part.type === 'tool-invocation' &&
'toolName' in part &&
typeof part.toolName === 'string'
);
}
// Usage
if (isToolInvocation(part)) {
// part is now typed as IToolInvocation
}
in OperatorFor merging partial objects without type assertions:
// ❌ Bad: Type assertion
const next = { ...prev, ...updates } as IConfig;
// ✅ Good: Explicit property checks
function mergeConfig(base: IConfig, updates: Record<string, string>): IConfig {
return {
apiKey: 'apiKey' in updates ? updates.apiKey : base.apiKey,
endpoint: 'endpoint' in updates ? updates.endpoint : base.endpoint,
timeout: base.timeout, // Preserve non-string fields
};
}
typeofFor values from external sources (Auth0, localStorage, etc.):
// ❌ Bad: Type assertion
const nickname = user?.nickname as string | undefined;
// ✅ Good: typeof check
const nickname = typeof user?.nickname === 'string' ? user.nickname : undefined;
Keep API response schemas in a dedicated file for reuse:
src/schemas/apiResponses.ts // Zod schemas for all API responses
This enables:
After completing your work, provide: