/unicorn-team:javascriptfrom unicorn-team
Guides JavaScript and TypeScript development with modern tooling and patterns including TypeScript configuration, ESLint, Prettier, testing with Vitest, and React component testing.
Ships in unicorn-team. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Utility types (use these instead of manual definitions):
| Type | Effect |
|---|---|
Pick<T, K> | Subset of properties |
Omit<T, K> | Exclude properties |
Partial<T> | All optional |
Required<T> | All required |
Record<K, V> | Key-value map |
ReturnType<typeof fn> | Extract return type |
Awaited<Promise<T>> | Unwrap promise type |
Extract<T, U> / Exclude<T, U> | Filter union members |
Generics:
interface ApiResponse<T> {
data: T;
status: number;
}
function fetchData<T>(url: string): Promise<ApiResponse<T>> {
return fetch(url).then(res => res.json());
}
Advanced TypeScript: See references/typescript-advanced.md for conditional types, mapped types, branded types, infer.
{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"lib": ["ES2022", "DOM"],
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"esModuleInterop": true,
"skipLibCheck": true
}
}
module.exports = {
parser: '@typescript-eslint/parser',
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
],
rules: {
'@typescript-eslint/no-explicit-any': 'error',
},
};
module.exports = {
semi: true,
singleQuote: true,
trailingComma: 'all',
printWidth: 100,
};
{
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"test": "vitest",
"lint": "eslint . --ext .ts,.tsx --fix",
"format": "prettier --write \"src/**/*.{ts,tsx}\""
}
}
import { describe, it, expect, vi } from 'vitest';
describe('UserService', () => {
it('fetches user data', async () => {
const user = await service.fetchUser('123');
expect(user).toBeDefined();
expect(user.id).toBe('123');
});
it('throws on invalid ID', async () => {
await expect(service.fetchUser('invalid'))
.rejects.toThrow('User not found');
});
});
// Mocking
vi.mock('./api', () => ({ fetchUser: vi.fn() }));
vi.mocked(fetchUser).mockResolvedValue({ id: '1', name: 'Alice' });
React component testing:
import { render, screen, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
it('submits form', async () => {
render(<LoginForm onSubmit={vi.fn()} />);
await userEvent.type(screen.getByLabelText(/email/i), '[email protected]');
await userEvent.click(screen.getByRole('button', { name: /submit/i }));
await waitFor(() => {
expect(screen.getByText(/success/i)).toBeInTheDocument();
});
});
See references/testing-examples.md for mocking patterns, integration tests, test factories.
Custom hook with cleanup:
function useUser(userId: string) {
const [user, setUser] = useState<User | null>(null);
const [loading, setLoading] = useState(true);
useEffect(() => {
let cancelled = false;
fetchUser(userId).then(data => {
if (!cancelled) setUser(data);
setLoading(false);
});
return () => { cancelled = true; };
}, [userId]);
return { user, loading };
}
Performance:
const sorted = useMemo(() => [...items].sort(), [items]);
const handleClick = useCallback(() => doSomething(), []);
const MemoComponent = memo(({ data }: Props) => <div>{data}</div>);
See references/react-patterns.md for compound components, context, forms, code splitting.
Async handler wrapper (Express):
function asyncHandler(fn: (req: Request, res: Response) => Promise<void>) {
return (req: Request, res: Response, next: NextFunction) => {
Promise.resolve(fn(req, res)).catch(next);
};
}
app.get('/users/:id', asyncHandler(async (req, res) => {
const user = await userService.findById(req.params.id);
if (!user) { res.status(404).json({ error: 'User not found' }); return; }
res.json(user);
}));
See references/node-patterns.md for middleware, streams, database patterns, error handling.
Result type:
type Result<T, E = string> =
| { success: true; data: T }
| { success: false; error: E };
Type guard:
function isUser(obj: unknown): obj is User {
return typeof obj === 'object' && obj !== null && 'id' in obj;
}
Discriminated union:
type Response =
| { status: 'success'; data: User }
| { status: 'error'; error: string }
| { status: 'loading' };
function handle(response: Response) {
switch (response.status) {
case 'success': return response.data; // type-narrowed
case 'error': throw new Error(response.error);
}
}
| Anti-pattern | Fix |
|---|---|
any type | Proper types or unknown with validation |
| Mutating arrays/objects in place | Spread: [...arr, item], { ...obj, key: val } |
Nested .then() chains | async/await |
| Missing error handling on async | try/catch or .catch() |
React state mutation arr.push() | setArr(prev => [...prev, item]) |
Missing useEffect deps | Include all referenced values |
| Unstable object refs in render | Hoist constants or useMemo |
| Circular imports | Extract shared code to shared.ts |
console.log in production | Structured logger |
| Non-exhaustive switch on union | Add default: assertNever(x) |
Naming: camelCase (variables, functions), PascalCase (classes, types, components), SCREAMING_SNAKE_CASE (constants).
references/typescript-advanced.md - Generics, conditional types, mapped types, branded typesreferences/react-patterns.md - Hooks, component patterns, performance, state management, formsreferences/node-patterns.md - Express, async patterns, streams, database patternsreferences/testing-examples.md - Jest/Vitest config, mocking, component testing, integration testsWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
typescript, javascript, vitest, eslint, prettier, react-testing
15 skills in this plugin
/code-readingStrategic code comprehension protocol for navigating existing codebases. ALWAYS trigger on "understand this code", "how does this work", "refactor", "before changing", "legacy code", "code review", "what does this do", "explain this codebase", "walk me through", "unfamiliar code", "read through". Use when exploring unfamiliar code, preparing to modify legacy systems, debugging complex issues, or conducting code reviews. Different from pattern-transfer which maps known solutions across domains -- this skill builds accurate mental models of existing code./domain-devopsGuides the user through containerization, CI/CD pipelines, Kubernetes deployments, observability, and infrastructure management. ALWAYS trigger on "dockerize", "CI/CD", "kubernetes", "deploy", "monitoring", "logging", "metrics", "helm", "infrastructure", "observability", "rollback", "scaling", "pipeline", "container", "k8s", "GitOps", "Dockerfile", "health check", "troubleshoot deployment". Use when containerizing applications, building pipelines, deploying services, setting up monitoring, or debugging infrastructure issues. Different from the DevOps agent (agents/devops.md) which handles orchestration and runbook execution rather than pattern guidance./estimationGuides the user through risk-based task estimation using decomposition, three-point estimates, and PERT formula. ALWAYS trigger on "estimate", "how long will this take", "time to complete", "sizing", "scope this", "effort estimate", "how many hours", "story points", "project timeline", "when will this be done", "cost estimate", "level of effort". Use when sizing any work item, feature, or project./goGuides Go development with idiomatic patterns, tooling, and project structure. ALWAYS trigger on "go project", "go module", "go mod", "goroutine", "channel", "go test", "go build", "golangci-lint", "go interface", "go error handling", "go concurrency", "go struct", "go anti-pattern", "go best practices", "go tooling", "go lint". Use when setting up Go projects, writing idiomatic Go, choosing concurrency patterns, or configuring tooling. Different from testing skill which covers general test strategy; this covers Go-specific testing patterns and tooling configs./hvs-skill-buddyHVS Skill Buddy is the meta-skill for the entire HVS skill ecosystem. It keeps skills current with the latest Anthropic patterns, audits the skill library for drift and inconsistency, and creates new skills that fit the HVS system standard. ALWAYS trigger when the user mentions "skill buddy", "audit my skills", "skill drift", "create a new skill", "build a skill", "update my skills", "skill system", "are my skills consistent", "hvs skill", "skill conflicts", "skill overlap", "new skill for", or any request to inspect, improve, create, or manage skills in the HVS library. Also trigger when someone asks Claude to "make a skill like my other ones" or "keep this consistent with my existing skills."/language-learningGuides rapid acquisition of new programming languages, frameworks, and paradigms through a structured 5-phase protocol. ALWAYS trigger on "learn Rust", "learn Go", "new language", "pick up a language", "never used X before", "getting started with", "how does X work", "teach me Y", "unfamiliar technology", "language comparison", "evaluate language", "switch to X", "polyglot", "first time using". Use when encountering unfamiliar technology, evaluating language choices, or onboarding to a new stack. Delegates to Polyglot agent for execution.npx claudepluginhub aj-geddes/unicorn-team --plugin unicorn-teamOther plugins' skills for the same job