Zero-config Biome preset enforcing strict TypeScript/React code quality standards with automated formatting and linting
This skill has safety concerns that you should review before use. Some patterns were detected that may pose a risk.Safety score: 75/100.
KillerSkills scans all public content for safety. Use caution before installing or executing flagged content.
This skill configures GitHub Copilot to follow **Ultracite** code standards, a zero-config Biome preset that enforces strict code quality through automated formatting and linting.
Ultracite provides extremely fast Rust-based linting and formatting via Biome. Most issues are automatically fixable. This skill ensures AI-generated code adheres to modern TypeScript/React best practices.
When generating code, prioritize **accessibility, performance, type safety, and maintainability**. Focus on clarity and explicit intent over brevity.
**Example:**
```typescript
// Good
const MAX_RETRIES = 3;
function processData(input: unknown): Result {
if (typeof input === 'string') {
return { success: true, data: input };
}
return { success: false };
}
// Avoid
function processData(input: any) {
return input;
}
```
**Example:**
```typescript
// Good
const user = { name: 'Alice', email: null };
const displayEmail = user.email ?? 'No email';
for (const item of items) {
console.log(item);
}
// Avoid
var displayEmail = user.email || 'No email';
items.forEach(function(item, index) {
console.log(items[index]);
});
```
**Example:**
```typescript
// Good
async function fetchUser(id: string): Promise<User> {
try {
const response = await fetch(`/api/users/${id}`);
return await response.json();
} catch (error) {
throw new Error(`Failed to fetch user: ${error}`);
}
}
// Avoid
function fetchUser(id: string): Promise<User> {
return fetch(`/api/users/${id}`)
.then(r => r.json())
.catch(e => { throw e; });
}
```
**Example:**
```typescript
// Good
function UserList({ users }: { users: User[] }) {
const [selected, setSelected] = useState<string | null>(null);
useEffect(() => {
console.log('Selected user changed:', selected);
}, [selected]);
return (
<ul>
{users.map(user => (
<li key={user.id} onClick={() => setSelected(user.id)}>
{user.name}
</li>
))}
</ul>
);
}
// Avoid
function UserList({ users }) {
if (users.length > 0) {
const [selected, setSelected] = useState(null); // Conditional hook
}
return users.map((user, index) => <li key={index}>{user.name}</li>);
}
```
Use semantic HTML and ARIA attributes for accessibility:
**Example:**
```tsx
// Good
<button onClick={handleClick} onKeyDown={handleKeyDown} aria-label="Close dialog">
<CloseIcon alt="Close" />
</button>
<img src="/avatar.png" alt="User profile picture" />
// Avoid
<div onClick={handleClick} role="button">
<img src="/icon.png" /> {/* Missing alt text */}
</div>
```
**Example:**
```typescript
// Good
function processPayment(amount: number): void {
if (amount <= 0) {
throw new Error('Payment amount must be positive');
}
// Process payment
}
// Avoid
function processPayment(amount: number): void {
try {
if (amount <= 0) throw 'Invalid amount'; // String instead of Error
console.log('Processing:', amount); // Debug statement
} catch (e) {
throw e; // Useless catch
}
}
```
**Example:**
```typescript
// Good
function canPurchase(user: User, product: Product): boolean {
const hasEnoughFunds = user.balance >= product.price;
const isProductAvailable = product.stock > 0;
const isVerifiedUser = user.verified;
return hasEnoughFunds && isProductAvailable && isVerifiedUser;
}
// Avoid
function canPurchase(user: User, product: Product): boolean {
return user.balance >= product.price ? product.stock > 0 ? user.verified ? true : false : false : false;
}
```
**Example:**
```tsx
// Good
<a href={externalUrl} target="_blank" rel="noopener noreferrer">
External Link
</a>
// Avoid
<a href={userInput} target="_blank">Link</a>
<div dangerouslySetInnerHTML={{ __html: userInput }} />
```
**Example:**
```typescript
// Good
import { useState, useEffect } from 'react';
const EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
// Avoid
import * as React from 'react';
function validate(emails: string[]) {
for (const email of emails) {
const regex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; // Created in loop
}
}
```
**Example:**
```typescript
// Good
test('fetches user data', async () => {
const user = await fetchUser('123');
expect(user.name).toBe('Alice');
});
// Avoid
test.only('fetches user data', (done) => {
fetchUser('123').then(user => {
expect(user.name).toBe('Alice');
done();
});
});
```
Biome's linter will catch most issues automatically. Focus your attention on:
1. **Business logic correctness** - Biome can't validate your algorithms
2. **Meaningful naming** - Use descriptive names for functions, variables, and types
3. **Architecture decisions** - Component structure, data flow, and API design
4. **Edge cases** - Handle boundary conditions and error states
5. **User experience** - Accessibility, performance, and usability considerations
6. **Documentation** - Add comments for complex logic, but prefer self-documenting code
Before committing code:
1. Run `npx ultracite fix` to automatically fix formatting and common issues
2. Run `npx ultracite check` to verify no linting errors remain
3. Review any remaining warnings and address them manually
Most formatting and common issues are automatically fixed by Biome. The skill ensures all generated code complies with these standards by default.
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/ultracite-code-standards-for-copilot/raw