PostHog / PostHog/context-mill

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

Open
#284 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
60
Forks
17
Avg merge
1d 7h
Merged PRs (30d)
36

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at scripts/lib/skill-generator.js:644 and compare its single-example and multi-example lookup keys with context/skip-patterns.yaml. Verify the chosen keying convention against the Laravel, Swift, and Android example paths; done means per-example overrides apply consistently to single-example skills and the convention is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
56/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.