Applies strict TypeScript patterns for type-safe build scripts and CI/CD tools.
Install
mkdir -p .claude/skills/typescript-strict-patterns && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/10424" && unzip -o skill.zip -d .claude/skills/typescript-strict-patterns && rm skill.zipInstalls to .claude/skills/typescript-strict-patterns
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
TypeScript strict mode, type safety, readonly patterns, type guards for frontend tooling used in CI/CDKey capabilities
- →Configure strict compiler options
- →Implement type guards
- →Apply readonly patterns
- →Validate external data
- →Integrate type checking in CI
How it works
It enforces strict compiler flags, immutable data structures, and runtime type validation for frontend tooling.
Inputs & outputs
When to use typescript-strict-patterns
- →Writing type-safe CI/CD scripts
- →Building MCP servers
- →Creating type-safe config parsers
About this skill
TypeScript Strict Patterns Skill
Purpose
Ensure type-safe TypeScript development for CI/CD tooling, MCP servers, and build scripts used in the CIA platform. This skill covers strict compiler options, type guard patterns, and defensive coding practices for TypeScript components within a primarily Java/Maven project.
When to Use
- ✅ Writing MCP server tools in TypeScript
- ✅ Creating GitHub Actions custom actions
- ✅ Building CI/CD pipeline scripts and utilities
- ✅ Developing static site generators for political data
- ✅ Writing type-safe configuration parsers
Do NOT use for:
- ❌ Vaadin UI components (Java-based, use vaadin-component-design skill)
- ❌ Backend service logic (use Java/Spring patterns)
Strict Mode Configuration
Recommended tsconfig.json
{
"compilerOptions": {
"strict": true,
"noUncheckedIndexedAccess": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"exactOptionalPropertyTypes": true,
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
"esModuleInterop": true,
"moduleResolution": "node16",
"module": "node16",
"target": "ES2022",
"declaration": true,
"declarationMap": true,
"sourceMap": true,
"outDir": "./dist"
}
}
What Strict Mode Enables
| Flag | Purpose |
|---|---|
strictNullChecks | Prevents null/undefined assignment errors |
strictFunctionTypes | Enforces contravariant function parameter types |
strictPropertyInitialization | Requires class properties to be initialized |
noImplicitAny | Disallows implicit any types |
noImplicitThis | Errors on this with implicit any type |
Type Safety Patterns
Discriminated Unions for Political Data
interface Politician {
readonly type: "politician";
readonly personId: string;
readonly firstName: string;
readonly lastName: string;
readonly party: SwedishParty;
}
interface Committee {
readonly type: "committee";
readonly committeeId: string;
readonly name: string;
readonly members: readonly string[];
}
type PoliticalEntity = Politician | Committee;
// Type guard
function isPolitician(entity: PoliticalEntity): entity is Politician {
return entity.type === "politician";
}
Readonly Patterns
// Immutable data structures for political records
interface VotingRecord {
readonly personId: string;
readonly votes: ReadonlyArray<Vote>;
readonly summary: Readonly<VotingSummary>;
}
// Readonly mapped type for API responses
type Immutable<T> = {
readonly [K in keyof T]: T[K] extends object ? Immutable<T[K]> : T[K];
};
type ImmutableApiResponse = Immutable<RiksdagApiResponse>;
Type Guards for Runtime Validation
function isValidParty(value: unknown): value is SwedishParty {
const validParties = ["S", "M", "SD", "C", "V", "KD", "L", "MP"] as const;
return typeof value === "string" && validParties.includes(value as SwedishParty);
}
function assertNonNull<T>(value: T | null | undefined, name: string): asserts value is T {
if (value === null || value === undefined) {
throw new Error(`Expected non-null value for ${name}`);
}
}
Branded Types for Domain Safety
type PersonId = string & { readonly __brand: "PersonId" };
type CommitteeId = string & { readonly __brand: "CommitteeId" };
function createPersonId(raw: string): PersonId {
if (!/^[0-9a-f-]{36}$/.test(raw)) {
throw new Error(`Invalid person ID format: ${raw}`);
}
return raw as PersonId;
}
Error Handling Patterns
// Result type for safe error handling
type Result<T, E = Error> =
| { readonly success: true; readonly value: T }
| { readonly success: false; readonly error: E };
async function fetchPoliticianData(id: PersonId): Promise<Result<Politician>> {
try {
const response = await fetch(`https://data.riksdagen.se/person/${id}`);
if (!response.ok) {
return { success: false, error: new Error(`HTTP ${response.status}`) };
}
const data: unknown = await response.json();
const validated = validatePoliticianData(data);
return { success: true, value: validated };
} catch (error) {
return { success: false, error: error instanceof Error ? error : new Error(String(error)) };
}
}
CI/CD Integration
Package.json Scripts
{
"scripts": {
"build": "tsc --project tsconfig.json",
"typecheck": "tsc --noEmit",
"lint": "eslint src/ --ext .ts",
"test": "vitest run"
}
}
GitHub Actions Type Checking
- name: TypeScript Type Check
run: npx tsc --noEmit --strict
Security Considerations
- Validate all external data at runtime — types are erased at runtime
- Use
unknownoveranyfor untyped data from APIs - Sanitize string inputs before interpolation into commands or queries
- Never trust type assertions (
as) without validation - Audit dependencies with
npm auditbefore adding packages
When not to use it
- →Vaadin UI components
- →Backend service logic
Limitations
- →Types are erased at runtime
- →Requires manual validation of external data
How it compares
This provides a hardened, strict-mode environment specifically for tooling scripts compared to standard TypeScript configurations.
Compared to similar skills
typescript-strict-patterns side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| typescript-strict-patterns (this skill) | 0 | 5mo | No flags | Advanced |
| verification-loop | 0 | 4mo | Review | Intermediate |
| turborepo | 61 | 2mo | Review | Intermediate |
| reviewing-nextjs-16-patterns | 11 | 8mo | Review | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by Hack23
View all by Hack23 →You might also like
verification-loop
tom237ttkk
A comprehensive verification system for Codex work sessions.
turborepo
vercel
Turborepo monorepo build system guidance. Triggers on: turbo.json, task pipelines, dependsOn, caching, remote cache, the "turbo" CLI, --filter, --affected, CI optimization, environment variables, internal packages, monorepo structure/best practices, and boundaries. Use when user: configures tasks/workflows/pipelines, creates packages, sets up monorepo, shares code between apps, runs changed/affected packages, debugs cache, or has apps/packages directories.
reviewing-nextjs-16-patterns
djankies
Review code for Next.js 16 compliance - security patterns, caching, breaking changes. Use when reviewing Next.js code, preparing for migration, or auditing for violations.
testing-workflow
amo-tech-ai
Comprehensive testing workflow for E2E, integration, and unit tests. Use when testing applications layer-by-layer, validating user journeys, or running test suites.
nx-workspace-patterns
wshobson
Configure and optimize Nx monorepo workspaces. Use when setting up Nx, configuring project boundaries, optimizing build caching, or implementing affected commands.
zod-4
prowler-cloud
Zod 4 schema validation patterns. Trigger: When creating or updating Zod v4 schemas for validation/parsing (forms, request payloads, adapters), including v3 -> v4 migration patterns.