regression-io/claude-config-plugins/patterns

Claude Code and agent skill by regression-io/claude-config-plugins

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

TypeScript Patterns & Best Practices guidance

Install

npx vskill@latest install regression-io/claude-config-plugins/patterns

SKILL.md

TypeScript Patterns & Best Practices

Error Handling

typescript
// Custom error classes
class AppError extends Error {
constructor(
message: string,
public code: string,
public statusCode: number = 500
) {
super(message);
this.name = 'AppError';
}
}
class NotFoundError extends AppError {
constructor(resource: string) {
super(`${resource} not found`, 'NOT_FOUND', 404);
}
}
// Result type pattern
type Result<T, E = Error> =
| { success: true; data: T }
| { success: false; error: E };
function parseConfig(text: string): Result<Config> {
try {
return { success: true, data: JSON.parse(text) };
} catch (e) {
return { success: false, error: e as Error };
}
}

Async Patterns

typescript
// Async/await with proper error handling
async function fetchUser(id: string): Promise<User> {
const response = await fetch(`/api/users/${id}`);
if (!response.ok) {
throw new AppError('Failed to fetch user', 'FETCH_ERROR', response.status);
}
return response.json();
}
// Parallel execution
const [users, posts] = await Promise.all([
fetchUsers(),
fetchPosts()
]);
// With timeout
async function withTimeout<T>(
promise: Promise<T>,
ms: number
): Promise<T> {
const timeout = new Promise<never>((_, reject) =>
setTimeout(() => reject(new Error('Timeout')), ms)
);
return Promise.race([promise, timeout]);
}

Dependency Injection

typescript
interface Logger {
info(message: string): void;
error(message: string, error?: Error): void;
}
class UserService {
constructor(
private readonly db: Database,
private readonly logger: Logger
) {}
async getUser(id: string): Promise<User | null> {
this.logger.info(`Fetching user ${id}`);
return this.db.users.findById(id);
}
}

Utility Types

typescript
// Partial - all props optional
function updateUser(id: string, updates: Partial<User>): Promise<User>
// Pick/Omit - subset of props
type UserPreview = Pick<User, 'id' | 'name'>;
type UserCreate = Omit<User, 'id' | 'createdAt'>;
// Record - typed objects
type UserMap = Record<string, User>;
// Required - remove optional
type RequiredUser = Required<User>;

Testing

typescript
import { describe, it, expect, vi } from 'vitest';
describe('UserService', () => {
it('should fetch user by id', async () => {
const mockDb = {
users: { findById: vi.fn().mockResolvedValue({ id: '1', name: 'Test' }) }
};
const service = new UserService(mockDb as any, console);
const user = await service.getUser('1');
expect(user).toEqual({ id: '1', name: 'Test' });
expect(mockDb.users.findById).toHaveBeenCalledWith('1');
});
});

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/regression-io/claude-config-plugins/patterns/badge)](https://verified-skill.com/skills/regression-io/claude-config-plugins/patterns)

Something wrong with this skill or its page? Tell us.