git-reference-manager
Safely introduce external Git repositories as reference materials. Responsible for managing the `_reference` directory, ensuring external code is read-only and does not pollute the project's version control.
When & Why to Use This Skill
The Git Reference Manager is a specialized Claude skill designed to safely integrate external Git repositories into your project as read-only reference materials. It automates the creation of an isolated '_reference' directory and ensures project integrity by automatically updating .gitignore, preventing external code from polluting your version control history while enabling deep architectural learning and pattern discovery.
Use Cases
- Case 1: Analyzing third-party library internals to understand complex implementation details, such as React's Hook system or database ORM logic, without affecting your local environment.
- Case 2: Benchmarking your project's architecture against industry-standard open-source repositories to identify best practices and implement proven design patterns.
- Case 3: Safely exploring multiple boilerplate templates or example projects side-by-side within your current workspace without merging their Git histories or metadata.
- Case 4: Using search tools like grep or ripgrep to find specific code patterns across external repositories to solve local debugging or implementation challenges efficiently.
| name | git-reference-manager |
|---|---|
| description | "Safely introduce external Git repositories as reference materials. Responsible for managing the `_reference` directory, ensuring external code is read-only and does not pollute the project's version control." |
Git Reference Manager
This skill provides guidance on how to formally introduce external repositories into a project for reading and learning. This is crucial for understanding third-party library architectures or finding best practices.
Core Rules
Isolation Principle: Reference code must be strictly isolated within the
_reference/directory. It is strictly forbidden to commit it to the main project's Git history.
Standard Workflow
When you need to reference an external repository (e.g., anthropics/skills or pandas), you must strictly follow these three steps in order:
1. Prepare Sandbox
First, ensure the dedicated directory for storing reference materials exists.
Check: Does the
_referencedirectory exist in the project root?Action: If not, create it.
mkdir -p _reference
2. Secure Boundary
Before pulling any code, you must ensure that Git ignores this directory.
Check: Does the
.gitignorefile contain_reference/?Action: If not, append it to the end of the file.
# Check grep "_reference/" .gitignore # Append (if missing) echo -e "\n# External References\n_reference/" >> .gitignore
3. Fetch References
Clone the target repository into a subdirectory within the sandbox.
Naming: Use the repository name as the subdirectory name.
Action: Use
git clone.git clone <REPO_URL> _reference/<REPO_NAME>Note: Deep history is not required; it is recommended to use
--depth 1to save time and space.git clone --depth 1 https://github.com/anthropics/skills.git _reference/anthropics_skills
Best Practices
- Read-Only Mode: Treat all files under
_reference/as read-only. Do not modify them unless it is for testing certain changes (but be aware that changes will be lost). - Search via grep: Use
greporripgrepto search for code patterns within the reference directory. - Discard Anytime: Since these files are ignored by git and can be re-cloned, you can delete them at any time to free up space after finishing your task.
Example
User Request: "I want to see how React's source code handles Hooks."
Agent Execution:
mkdir -p _referencegrep "_reference" .gitignore || echo "_reference/" >> .gitignoregit clone --depth 1 https://github.com/facebook/react.git _reference/react- Start reading
_reference/react/packages/react-reconciler/...