Skip to content

tech-debt: refactor loader.ts to remove biome-ignore complexity suppressions #94

@hqhq1025

Description

@hqhq1025

Background

On 2026-04-19, two // biome-ignore lint/complexity/noExcessiveCognitiveComplexity suppressions were added to packages/core/src/skills/loader.ts to unblock the PR pipeline:

  • loadSkillsFromDir (line ~192, complexity score 19, max 15)
  • parseMapping (line ~118, complexity score 23, max 15)

The suppressions were a stopgap to unblock husky pre-push (which runs pnpm lint). Multiple agents had to bypass hooks or push from temp worktrees on the same day because of these warnings.

Why this matters

The suppressions hide growing complexity. New conditionals added to either function will silently push complexity even higher while lint stays green.

Suggested refactors

loadSkillsFromDir: split into loadSingleSkill(dir, file, source) plus a top-level that does readdir + Promise.all.

parseMapping: rewrite as token + state machine, or swap in a tiny YAML subset parser (must respect ≤80MB install budget — js-yaml is too large; consider yaml-mini or hand-rolled).

Acceptance

  • Both biome-ignore lines removed
  • pnpm lint passes with no complexity warnings on loader.ts
  • All existing skill-loader tests pass; add tests for any new helpers
  • No new deps >50KB without justification

Trigger

Pick up when next touching skills loader (e.g., when PR #86 starter library is unblocked, or when adding a new skill source).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions