install
source · Clone the upstream repo
git clone https://github.com/wrtnlabs/autobe
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/wrtnlabs/autobe "$T" && mkdir -p ~/.claude/skills && cp -r "$T/internals/template/realize/.claude/skills/fix-test" ~/.claude/skills/wrtnlabs-autobe-fix-test && rm -rf "$T"
manifest:
internals/template/realize/.claude/skills/fix-test/SKILL.mdsource content
Fix Test Errors
Fix test file compilation errors according to code conventions.
FORBIDDEN
NEVER use:
keyword (type assertion)as
typeany
- generates invalid datatypia.random<EmptyType>()
Purpose
Fix compilation errors in test files to ensure
npm run build:test passes.
Workflow
┌─────────────────────────────────────┐ │ Step 1: Run Build │ │ npm run build:test │ └───────────────┬─────────────────────┘ │ ▼ ┌─────────────────────────────────────┐ │ Step 2: Parse Test Errors │ │ - Empty prepare functions │ │ - Type mismatches │ │ - Missing imports │ └───────────────┬─────────────────────┘ │ ▼ ┌─────────────────────────────────────┐ │ Step 3: Fix by Convention │ │ - Fill prepare functions │ │ - Create generate functions │ │ - Fix import paths │ └───────────────┬─────────────────────┘ │ ▼ ┌─────────────────────────────────────┐ │ Step 4: Re-run Build │ │ Loop until 0 errors │ └─────────────────────────────────────┘
Step 1: Run Build
npm run build:test 2>&1 | head -100
Capture test-related errors.
Step 2: Find Issues
# Find empty returns grep -rn "return {}" test/prepare/ --include="*.ts" # Find typia.random with potentially empty types grep -rn "typia.random<" test/ --include="*.ts"
Step 3: Fix by Convention
Fix Empty prepare_random Function
// Before export function prepare_random_{prefix}_{entity}( input?: DeepPartial<I{Prefix}{Entity}.ICreate> | undefined, ): I{Prefix}{Entity}.ICreate { return {}; // WRONG } // After import { I{Prefix}{Entity} } from "@ORGANIZATION/PROJECT-api/lib/structures/I{Prefix}{Entity}"; import { DeepPartial } from "@ORGANIZATION/PROJECT-api/lib/typings/DeepPartial"; import { RandomGenerator } from "@nestia/e2e"; import { randint } from "tstl"; import { v4 } from "uuid"; export function prepare_random_{prefix}_{entity}( input?: DeepPartial<I{Prefix}{Entity}.ICreate> | undefined, ): I{Prefix}{Entity}.ICreate { return { parent_id: input?.parent_id ?? v4(), name: input?.name ?? RandomGenerator.name(2), title: input?.title ?? RandomGenerator.paragraph(1), content: input?.content ?? RandomGenerator.paragraph(3), is_public: input?.is_public ?? true, status: input?.status ?? "active", }; }
Create Missing generate_random Function
import { I{Prefix}{Entity} } from "@ORGANIZATION/PROJECT-api/lib/structures/I{Prefix}{Entity}"; import { DeepPartial } from "@ORGANIZATION/PROJECT-api/lib/typings/DeepPartial"; import api from "@ORGANIZATION/PROJECT-api"; import { prepare_random_{prefix}_{entity} } from "../prepare/prepare_random_{prefix}_{entity}"; export async function generate_random_{prefix}_{entity}( connection: api.IConnection, input?: DeepPartial<I{Prefix}{Entity}.ICreate> | undefined, ): Promise<I{Prefix}{Entity}> { const body = prepare_random_{prefix}_{entity}(input); return api.functional.{prefix}.{path}.create(connection, body); }
Field Generation Patterns
| Field Type | Generation Pattern |
|---|---|
| UUID | |
| Name/Title | |
| Paragraph | |
| |
| URL | |
| Integer | |
| Boolean | |
| Date (ISO) | |
| Union Type | |
Replace typia.random with prepare function
// Before const data = typia.random<I{Prefix}{Entity}.ICreate>(); // After import { prepare_random_{prefix}_{entity} } from "../prepare/prepare_random_{prefix}_{entity}"; const data = prepare_random_{prefix}_{entity}({ status: "active", // Can override specific values });
Step 4: Verify
npm run build:test
Repeat Steps 2-4 until no test build errors.
Common Fixes
| Error Pattern | Fix |
|---|---|
Empty | Fill with proper random generators |
| Use prepare_random function |
| Missing generate function | Create matching generate_random |
| Import error | Fix import path |
Exit Condition
completes with no errorsnpm run build:test- All prepare functions return complete objects
- All generate functions exist for prepare functions
- No
with empty typestypia.random