gitignore-narrowing

gitignore-narrowing is a skill for Claude Code, Codex from toejough/engram. It costs 73 tokens per session (1,002 once invoked), scanned A, original, Apache-2.0.

A procedure for safely narrowing a .gitignore rule, which tells Git which files to leave untracked. It checks that the new pattern matches the intended nested paths and stages only the newly allowed files.

In plain words
What is it for?
Use it when changing ignore rules for test data or other directories, checking nested-path behaviour, and preparing a focused commit.
Why use it?
Changing an ignore rule can unexpectedly expose many files, while broad commands such as git add . can include unrelated work. This procedure reduces both risks before a commit.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when changing ignore rules for test data or other directories, checking nested-path behaviour, and preparing a focused commit.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/toejough/engram/gitignore-narrowing
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add toejough/engram --skill gitignore-narrowing
Clone the repo
git clone --depth 1 https://github.com/toejough/engram

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for gitignore-narrowing

README.md
[![agentmods](https://agentmods.dev/badge/skills/toejough/engram/gitignore-narrowing/github.svg)](https://agentmods.dev/skills/toejough/engram/gitignore-narrowing)
Your own site
<a href="https://agentmods.dev/skills/toejough/engram/gitignore-narrowing"><img src="https://agentmods.dev/badge/skills/toejough/engram/gitignore-narrowing/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for gitignore-narrowing

Your own site · 80×15
<a href="https://agentmods.dev/skills/toejough/engram/gitignore-narrowing"><img src="https://agentmods.dev/badge/skills/toejough/engram/gitignore-narrowing.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 73 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,002 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00073 $0.01002
Opus 5.5 $0.00029 $0.00401
Sonnet 5.5 $0.00015 $0.00200
Haiku 4.5 $0.00007 $0.00100

Measured 28d ago against content hash e25b6c38995c, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

gitignore-narrowing scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 28d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

dev/eval/cumulative/runbook_vs_skill/phase2/encodings/taskB/B-S/skills/gitignore-narrowing/SKILL.md · 72 lines

How it starts

The opening of the file, as written. The whole thing — 72 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Gitignore Narrowing: Anchor Verification and Explicit Visible-Set Staging

Overview

Narrowing a .gitignore pattern (e.g. testdata/ -> testdata/rapid/) has two independent failure modes: the new pattern can silently stop matching nested paths (a gitignore anchoring gotcha), and the files it newly exposes can get swept into a commit alongside unrelated untracked work if staged with a bare git add -A/git add .. This skill is the verification-and-staging procedure that catches both before anything is committed.

When to Use

Before shipping a narrowed or rewritten .gitignore pattern that makes some previously-ignored files trackable. Triggers include:

  • Tightening a broad ignore rule (e.g. testdata/ -> testdata/rapid/) so only a subset stays ignored.
  • Any .gitignore edit expected to newly expose files in nested subdirectories, not just at the repo root.
  • About to stage the result of a .gitignore narrowing with git add.

Procedure

  1. In a scratch repo, write the proposed replacement .gitignore pattern.
  2. Run git check-ignore -q <path> against representative paths, including nested ones under subdirectories (e.g. internal/*/testdata/rapid/, test/testdata/rapid/), to confirm the pattern still matches at the intended depth.
  3. If a pattern contains a middle slash (e.g. narrowing testdata/ to testdata/rapid/), know it anchors to the .gitignore's own directory and silently stops matching nested paths; use a leading **/ form instead (e.g. **/testdata/rapid/) to keep matching at any depth. Never verify anchoring by reading the pattern alone.
  4. In the real repo, write the proposed .gitignore and run git status --porcelain to enumerate the full set of newly-untracked/visible files it exposes, then restore.
  5. Stage only the explicit enumerated paths from that list — never git add -A or git add ..
  6. Confirm the staged set matches the enumerated list exactly by running git diff --cached --name-only.

Read the full file on GitHub · 72 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 28d ago First seen · 72 lines · 73 tokens per session scan A e25b6c38995c

Subscribe to this mod's changes

gitignore-narrowing is a skill published in the GitHub repository toejough/engram (8 stars, last pushed yesterday), licensed Apache-2.0. It adds 73 tokens to every session and 1,002 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-21.