Skip to content

Per-example skip patterns are ignored for skills with a single example #284

Description

@Ref34t

Problem

context/skip-patterns.yaml has an examples: section for rules that apply to one example app. For most skills those rules never run.

The Laravel entry says to skip bootstrap/cache. The built skill still contains it:

references/EXAMPLE.md
  ## bootstrap/cache/services.php     20,352 bytes

That is Laravel's generated package-discovery cache. It is a machine-written list of class names, and it is 17% of the whole Laravel skill. For comparison, references/COMMANDMENTS.md in the same bundle is 1,618 bytes.

Cause

scripts/lib/skill-generator.js:644

skipPatterns: mergeSkipPatterns(
  skipPatterns.global,
  skipPatterns.examples[isSingle ? skill.id : dirName]
)

When a skill has one example path, the lookup key is skill.id. Laravel's id is integration-laravel, but the key in skip-patterns.yaml is laravel, which is the directory name. No match, so the override is dropped and no error is raised.

When a skill has two or more example paths, the key is dirName and the override works.

Two skills behave differently for this reason

  • Laravel — one example path. Override ignored. bootstrap/cache/services.php ships.
  • Swift — two example paths (swift, swift-xcodegen). Override applied. The allow for project.yml works and the file is correctly kept.

Same feature, opposite result, decided by how many examples the skill happens to have.

Also affected

android has one example path, so its overrides are dropped too. Impact is smaller: app/proguard-rules.pro and local.properties.example, both small.

Suggested fix

Key the lookup on the directory name in both branches, or look up dirName and fall back to skill.id.

Worth deciding deliberately rather than just patching, for two reasons. It changes what ships in existing bundles. And the two keying styles currently in the file (laravel and swift-xcodegen are directories, but a reader could reasonably assume skill ids) suggest the intended convention should be written down.

Separately, bootstrap/cache/*.php is generated output that Laravel's own .gitignore excludes, and it is committed to example-apps/laravel. Removing it would fix the Laravel symptom whatever is decided here.

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