Skill: Type Fix
Objective
Fix TypeScript compilation errors related to types in 1-3 files: add explicit type annotations, fix return types and argument types. Adapted for this repo: Astro, Svelte, TypeScript; follow AGENTS.md and existing type patterns in src/lib/types.ts.
Non-Goals
- •Does NOT refactor logic or add features
- •Does NOT change runtime behavior
- •Does NOT modify more than 3 files
- •Does NOT introduce new type files without agreement
Tier Classification
Tier: 1 - Light/Cheap
Reasoning: Mechanical type fixes in small scope; low risk; pattern-following (existing types in lib/).
Inputs
Required Parameters
- •
$FILES: File(s) with type errors (or "current file" / leave empty to use compiler output) - •
$ERRORS: Optional — specific error messages orastro checkoutput
Optional Parameters
- •
$CONTEXT: Related type definitions to reuse (e.g., fromsrc/lib/types.ts)
Prerequisites
Before running this skill, ensure:
- • Type errors are from TypeScript compiler or IDE (not runtime)
- • No uncommitted changes or working on a dedicated branch
Steps
Step 1: Identify Errors
- •Run
npm run astro:checkor read IDE errors for the target files - •List missing types, incompatible signatures
Step 2: Apply Type Fixes
- •Add explicit parameter and return types
- •Use types from
src/lib/types.tsor Astro's built-in types - •Use
import typefor type-only imports - •Fix generic parameters if needed
- •Do not change logic
Step 3: Validate
bash
npm run astro:check npm run biome:check
Output Format
Success Output
code
## ✅ Type Fix Complete
### Files
- `{file1}`: {what was fixed}
- `{file2}`: {what was fixed}
### Validation
- TypeScript: ✅ No errors
- npm run astro:check: ✅
- npm run biome:check: ✅
### Commit Message
fix: resolve TypeScript types in {files}
Escalation
code
## ❌ Type Fix Not Enough
### Reason
{Errors require new type definitions / many files / architectural types}
### Recommendation
Escalate to Tier 2 or architect for type design.
Guardrails
Scope Limits
- •Maximum files: 3
- •Maximum LOC changed: 100
- •Allowed: Annotations, using existing types from lib/types.ts
Stop Conditions
Stop and escalate if:
- •New shared types needed
- •More than 3 files affected
- •Changes affect component API surface
Definition of Done
- • No TypeScript errors in target files
- •
npm run astro:checkpasses - •
npm run biome:checkpasses
Common Astro Types
typescript
// Built-in Astro types
import type { APIRoute } from 'astro';
import type { CollectionEntry } from 'astro:content';
// Content Collection types
type BlogPost = CollectionEntry<'blog'>;
type TagEntry = CollectionEntry<'tags'>;
// Component props
interface Props {
title: string;
description?: string;
}