git-submodule▌
supercent-io/skills-template · updated Apr 8, 2026
MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.
Version-control external repositories within a main project using Git submodules.
- ›Add, update, and remove submodules with commands for locking specific commits, branches, or tags
- ›Clone repositories with submodules using --recursive or manual initialization and update steps
- ›Batch operations across all submodules via git submodule foreach for pulling, checking status, and branch management
- ›Nested submodule support with recursive initialization and updates for complex dependency hier
Git Submodule
When to use this skill
- Including external Git repositories within your main project
- Managing shared libraries or modules across multiple projects
- Locking external dependencies to specific versions
- Working with monorepo-style architectures with independent components
- Cloning repositories that contain submodules
- Updating submodules to newer versions
- Removing submodules from a project
Instructions
Step 1: Understanding submodules
Git submodule is a feature for including other Git repositories within a main Git repository.
Key concepts:
- Submodules lock version by referencing a specific commit
- Submodule paths and URLs are recorded in the
.gitmodulesfile - Changes within a submodule are managed as separate commits
Step 2: Adding submodules
Basic addition:
# Add submodule
git submodule add <repository-url> <path>
# Example: Add library to libs/lib path
git submodule add https://github.com/example/lib.git libs/lib
Track a specific branch:
# Add to track a specific branch
git submodule add -b main https://github.com/example/lib.git libs/lib
Commit after adding:
git add .gitmodules libs/lib
git commit -m "feat: add lib as submodule"
Step 3: Cloning with submodules
When cloning fresh:
# Method 1: --recursive option when cloning
git clone --recursive <repository-url>
# Method 2: Initialize after cloning
git clone <repository-url>
cd <repository>
git submodule init
git submodule update
Initialize and update in one line:
git submodule update --init --recursive
Step 4: Updating submodules
Update to latest remote version:
# Update all submodules to latest remote
git submodule update --remote
# Update a specific submodule only
git submodule update --remote libs/lib
# Update + merge
git submodule update --remote --merge
# Update + rebase
git submodule update --remote --rebase
Checkout to the referenced commit:
# Checkout submodule to the commit referenced by the main repository
git submodule update
Step 5: Working inside submodules
Working inside a submodule:
# Navigate to submodule directory
cd libs/lib
# Checkout branch (exit detached HEAD)
git checkout main
# Work on changes
# ... make changes ...
# Commit and push within submodule
git add .
git commit -m "feat: update library"
git push origin main
Reflect submodule changes in main repository:
# Move to main repository
cd ..
# Update submodule reference
git add libs/lib
git commit -m "chore: update lib submodule reference"
git push
Step 6: Batch operations
Run commands on all submodules:
# Pull in all submodules
git submodule foreach 'git pull origin main'
# Check status in all submodules
git submodule foreach 'git status'
# Checkout branch in all submodules
git submodule foreach 'git checkout main'
# Also run command on nested submodules
git submodule foreach --recursive 'git fetch origin'
Step 7: Removing submodules
Completely remove a submodule:
# 1. Deinitialize submodule
git submodule deinit <path>
# 2. Remove from Git
git rm <path>
# 3. Remove cache from .git/modules
rm -rf .git/modules/<path>
# 4. Commit changes
git commit -m "chore: remove submodule"
Example: Remove libs/lib:
git submodule deinit libs/lib
git rm libs/lib
rm -rf .git/modules/libs/lib
git commit -m "chore: remove lib submodule"
git push
Step 8: Checking submodule status
Check status:
# Check submodule status
git submodule status
# Detailed status (recursive)
git submodule status --recursive
# Summary information
git submodule summary
Interpreting output:
44d7d1... libs/lib (v1.0.0) # Normal (matches referenced commit)
+44d7d1... libs/lib (v1.0.0-1-g...) # Local changes present
-44d7d1... libs/lib # Not initialized
Examples
Example 1: Adding an External Library to a Project
# 1. Add submodule
git submodule add https://github.com/lodash/lodash.git vendor/lodash
# 2. Lock to a specific version (tag)
cd vendor/lodash
git checkout v4.17.21
cd ../..
# 3. Commit changes
git add .
git commit -m "feat: add lodash v4.17.21 as submodule"
# 4. Push
git push origin main
Example 2: Setup After Cloning a Repository with Submodules
# 1. Clone the repository
git clone https://github.com/myorg/myproject.git
cd myproject
# 2. Initialize and update submodules
git submodule update --init --recursive
# 3. Check submodule status
git submodule status
# 4. Checkout submodule branch (for development)
git submodule foreach 'git checkout main || git checkout master'
Example 3: Updating Submodules to the Latest Version
# 1. Update all submodules to latest remote
git submodule update --remote --merge
# 2. Review changes
git diff --submodule
# 3. Commit changes
git add .
git commit -m "chore: update all submodules to latest"
# 4. Push
git push origin main
Example 4: Using Shared Components Across Multiple Projects
# In Project A
git submodule add https://github.com/myorg/shared-components.git src/shared
# In Project B
git submodule add https://github.com/myorg/shared-components.git src/shared
# When updating shared components (in each project)
git submodule update --remote src/shared
git add src/shared
git commit -m "chore: update shared-components"
Example 5: Handling Submodules in CI/CD
# GitHub Actions
jobs:
build:
steps:
- uses: actions/checkout@v4
with:
submodules: recursive # or 'true'
# GitLab CI
variables:
GIT_SUBMODULE_STRATEGY: recursive
# Jenkins
checkout scm: [
$class: 'SubmoduleOption',
recursiveSubmodules: true
]
Advanced workflows
Nested Submodules
# Initialize all nested submodules
git submodule update --init --recursive
# Update all nested submodules
git submodule update --remote --recursive
Changing Submodule URL
# Edit the .gitmodules file
git config -f .gitmodules submodule.libs/lib.url https://new-url.git
# Sync local configuration
git submodule sync
# Update submodule
git submodule update --init --recursive
Converting a Submodule to a Regular Directory
# 1. Back up submodule contents
cp -r libs/lib libs/lib-backup
# 2. Remove submodule
git submodule deinit libs/lib
git rm libs/lib
rm -rf .git/modules/libs/lib
# 3. Restore backup (excluding .git)
rm -rf libs/lib-backup/.git
mv libs/lib-backup libs/lib
# 4. Add as regular files
git add libs/lib
git commit -m "chore: convert submodule to regular directory"How to use git-submodule on Cursor
AI-first code editor with Composer
Prerequisites
Before installing skills in Cursor, ensure your development environment meets these requirements:
- ›Cursor installed and configured on your development machine
- ›Node.js version 16.0+ with npm package manager (verify with
node --version) - ›Active project directory or workspace where you want to add git-submodule
Execute installation command
Execute the skills CLI command in your project's root directory to begin installation:
The skills CLI fetches git-submodule from GitHub repository supercent-io/skills-template and configures it for Cursor.
Select Cursor when prompted
The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:
Verify installation
Confirm successful installation by checking the skill directory location:
Reload or restart Cursor to activate git-submodule. Access the skill through slash commands (e.g., /git-submodule) or your agent's skill management interface.
Security & Verification Notice
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.
List & Monetize Your Skill
Submit your Claude Code skill and start earning
Use Cases▌
User Story & Requirements Generation
Create detailed user stories, acceptance criteria, and feature specs
Example
Generate user stories for 'password reset feature' with acceptance criteria, edge cases, and test scenarios
Reduce spec writing time by 50%, ensure comprehensive coverage
Competitive Analysis
Research competitors, compare features, identify gaps
Example
Analyze 5 competitor products, create feature comparison matrix, suggest differentiation opportunities
Complete competitive research in 2 hours instead of 2 days
Roadmap Prioritization
Evaluate features using frameworks (RICE, ICE, Kano) and create prioritized backlogs
Example
Score 20 feature ideas using RICE framework, generate prioritized roadmap with rationale
Make data-driven prioritization decisions faster
Stakeholder Communication
Draft PRDs, status updates, and stakeholder presentations
Example
Create executive summary of Q3 roadmap, monthly progress report, feature launch announcement
Save 3-5 hours/week on communication overhead
Implementation Guide▌
Prerequisites
- ›Claude Desktop or compatible AI client
- ›Access to product documentation and roadmap tools (Jira, Notion, etc.)
- ›Understanding of product management frameworks (RICE, Jobs-to-be-Done, etc.)
- ›Stakeholder contact information and communication channels
Time Estimate
30-60 minutes to see productivity improvements
Installation Steps
- 1.Install product management skill
- 2.Start with user story generation for known feature
- 3.Progress to competitive analysis: research 2-3 competitors
- 4.Use for roadmap prioritization: apply RICE/ICE scoring
- 5.Draft stakeholder communications and refine based on feedback
- 6.Build template library for recurring PM tasks
- 7.Share effective prompts with product team
Common Pitfalls
- ⚠Not validating competitive research—verify facts before sharing
- ⚠Accepting user stories without involving engineering team
- ⚠Over-relying on frameworks without qualitative judgment
- ⚠Not customizing outputs to company culture and communication style
- ⚠Skipping stakeholder validation of generated requirements
Best Practices▌
✓ Do
- +Validate research and competitive analysis with real data
- +Collaborate with engineering when generating technical requirements
- +Customize frameworks and templates to your company context
- +Use skill for first drafts, refine with stakeholder input
- +Document successful prompt patterns for PM tasks
- +Combine AI efficiency with human judgment and intuition
✗ Don't
- −Don't publish competitive analysis without fact-checking
- −Don't finalize user stories without engineering review
- −Don't make prioritization decisions solely on AI scoring
- −Don't skip customer validation of generated requirements
- −Don't ignore company-specific context and culture
💡 Pro Tips
- ★Provide context: company goals, constraints, customer feedback
- ★Ask for alternatives: 'Show 3 ways to prioritize this roadmap'
- ★Request stakeholder-specific formatting: 'Executive summary vs. engineering spec'
- ★Use skill for 70% generation + 30% customization to company needs
When to Use This▌
✓ Use When
Use for user story writing, competitive research, roadmap prioritization, stakeholder communication, and PRD drafting. Best for reducing repetitive documentation and research work.
✗ Avoid When
Avoid for strategic product vision (requires deep customer empathy), pricing decisions (needs market and financial expertise), or when face-to-face customer discovery is more valuable than speed.
Learning Path▌
- 1Basic: user stories, feature specs, status updates
- 2Intermediate: competitive analysis, prioritization frameworks, PRDs
- 3Advanced: product strategy, go-to-market planning, OKR setting
- 4Expert: product vision, market positioning, business model innovation
Discussion
Product Hunt–style comments (not star reviews)- No comments yet — start the thread.
Ratings
4.7★★★★★43 reviews- ★★★★★Anaya Shah· Dec 24, 2024
I recommend git-submodule for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
- ★★★★★Sofia Desai· Dec 16, 2024
We added git-submodule from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
- ★★★★★Sakshi Patil· Nov 7, 2024
I recommend git-submodule for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
- ★★★★★Naina Wang· Nov 7, 2024
Solid pick for teams standardizing on skills: git-submodule is focused, and the summary matches what you get after install.
- ★★★★★Chaitanya Patil· Oct 26, 2024
Useful defaults in git-submodule — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
- ★★★★★Mateo Agarwal· Oct 26, 2024
git-submodule has been reliable in day-to-day use. Documentation quality is above average for community skills.
- ★★★★★Piyush G· Sep 25, 2024
git-submodule has been reliable in day-to-day use. Documentation quality is above average for community skills.
- ★★★★★Nia Park· Sep 17, 2024
git-submodule reduced setup friction for our internal harness; good balance of opinion and flexibility.
- ★★★★★Neel Liu· Sep 9, 2024
Keeps context tight: git-submodule is the kind of skill you can hand to a new teammate without a long onboarding doc.
- ★★★★★Min Gill· Sep 9, 2024
git-submodule has been reliable in day-to-day use. Documentation quality is above average for community skills.
showing 1-10 of 43