Skip to content

Generate .gitattributes to hide generated skills in PR diffs#80

Merged
Art Chaidarun (artnc) merged 5 commits intomasterfrom
gitattributes-generated-skills
May 4, 2026
Merged

Generate .gitattributes to hide generated skills in PR diffs#80
Art Chaidarun (artnc) merged 5 commits intomasterfrom
gitattributes-generated-skills

Conversation

@kush-duolingo
Copy link
Copy Markdown
Contributor

@kush-duolingo Kush Agrawal (kush-duolingo) commented Apr 30, 2026

Description

Verification steps

  • make test passes
  • Run sync-ai-rules on a repo with .cursor/rules/ and confirm .claude/skills/.gitattributes is created

The sync-ai-rules hook now writes a .claude/skills/.gitattributes file
that marks generated_*/SKILL.md as linguist-generated, so GitHub
collapses them by default in pull request diffs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Each generator now declares its own gitattributes_patterns via a base
class property. The orchestrator collects patterns from all generators
and writes a single root .gitattributes with a demarcated section,
covering skills, AGENTS.md, and copilot-instructions.md.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Member

@artnc Art Chaidarun (artnc) left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I had mentioned .claude/.gitattributes or .claude/skills/.gitattributes as possible output files because we shouldn't clobber the repo's existing root .gitattributes, which might contain config for unrelated stuff like LFS.

Some possible options:

  • Instead of overwriting the root .gitattributes, append our config to it if absent. This seems doable but a little fragile
  • Use individual .gitattributes files in subdirs like .claude, .cursor and .code_review. This is less invasive but also less complete since AGENTS.md isn't covered. (Do we need AGENTS.md? It seems like every popular tool prefers its own custom config location? I'm not super up to date here)

Copy link
Copy Markdown
Contributor

@clevin95 Carter L (clevin95) left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a great idea, thanks!

Addresses @artnc's review: writing a root .gitattributes would clobber
existing repo config (e.g. LFS). Each multi-file generator now writes
its own .gitattributes in its output directory instead.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor Author

@kush-duolingo Kush Agrawal (kush-duolingo) left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Good call, updated to use per-directory .gitattributes (.claude/skills/.gitattributes) instead of overwriting the root.
  • Skipping AGENTS.md/copilot-instructions.md coverage for now since there's no clean way to do it without touching the root .gitattributes.

Copy link
Copy Markdown
Member

@artnc Art Chaidarun (artnc) left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could also generate .github/.gitattributes to cover .github/copilot-instructions.md

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@kush-duolingo
Copy link
Copy Markdown
Contributor Author

Screenshot 2026-05-04 at 1 34 56 PM

Art Chaidarun (@artnc) did we change settings for this repo recently?

@artnc
Copy link
Copy Markdown
Member

Hmm not intentionally but maybe the old settings got terraformed away

@artnc Art Chaidarun (artnc) merged commit 43bc6f3 into master May 4, 2026
1 check passed
@artnc Art Chaidarun (artnc) deleted the gitattributes-generated-skills branch May 4, 2026 17:40
@artnc
Copy link
Copy Markdown
Member

Released in 1.15.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants