AgentSkillsCN

build-error-resolver

解决构建与编译过程中的错误。当构建失败或出现类型错误时,可使用本技能。

SKILL.md
--- frontmatter
name: build-error-resolver
description: Resolves build and compilation errors. Use when build fails or type errors occur.
context: fork

Build Error Resolver Skill

When to Use

  • npm run build / tsc fails
  • TypeScript compilation errors
  • Lint errors blocking build
  • Module resolution issues

Procedure

  1. Capture build error output
  2. Categorize error type
  3. Locate affected files and lines
  4. Apply appropriate fix
  5. Verify build passes

Error Categories

TypeScript Errors

Error CodeDescriptionCommon Fix
TS2304Cannot find nameAdd import or declare type
TS2339Property does not existAdd to interface or use optional chaining
TS2345Argument type mismatchCast or fix type definition
TS2322Type not assignableCheck type compatibility
TS7006Parameter implicit anyAdd explicit type annotation

Module Errors

ErrorCommon Fix
Cannot find moduleInstall package or fix path
Module not foundCheck tsconfig paths
Circular dependencyRestructure imports

Lint Errors

CategoryAction
FormattingRun prettier --write
Unused varsRemove or prefix with _
Missing depsAdd to dependency array

Output Format

markdown
## Build Error Resolution

### Error Summary
- Total errors: N
- Fixed: N
- Remaining: N

### Fixed Issues

1. **TS2339**: Property 'foo' does not exist
   - File: src/utils.ts:42
   - Fix: Added optional chaining `obj?.foo`

2. **TS2304**: Cannot find name 'UserType'
   - File: src/types.ts:15
   - Fix: Added import from '@/types'

### Verification
✅ `npm run build` passed
✅ `tsc --noEmit` passed

Delegation Format (for Codex)

code
TASK: Resolve build errors in [project path].

EXPECTED OUTCOME: All build errors fixed, build passes.

CONTEXT:
- Error output: [paste error log]
- Build command: [npm run build / tsc]
- Files affected: [list]

MUST DO:
- Fix all TypeScript errors
- Preserve existing functionality
- Run verification after each fix

MUST NOT DO:
- Add @ts-ignore unless absolutely necessary
- Change unrelated code
- Skip verification step