| name | detect-repo-changes |
| description | Detect file changes in a repository using multiple strategies. Use when you need to identify what files have been modified, added, or deleted for tasks like version bumping, change logging, or selective testing. Also applies when the user asks "what changed", "which files were modified", or describes needing to know the current state of the workspace — even without explicit git references.
|
| license | MIT |
| compatibility | Works with or without git repositories |
| metadata | {"author":"agentskills","version":"1.0.0","category":"repository-tools"} |
Detect Repository Changes
Detect what files have changed in a repository using a cascade of detection methods:
- Git commits since branch point (if git available with history)
- Uncommitted changes (if git available, working tree dirty)
- Agent's knowledge of recent modifications (fallback)
Quick Start
To detect changes:
- Check if git is available and has history
- Try git-based detection (commits since branch, uncommitted changes)
- Fall back to agent knowledge if git unavailable
- Present changes to user for confirmation
Detection Methods
Method 1: Git Commits Since Branch
Detect changes by comparing current branch to its parent:
git merge-base HEAD main
git log --oneline <merge-base>..HEAD
git diff --name-only <merge-base>..HEAD
Use when: Repository has git history with meaningful branch structure.
Method 2: Uncommitted Changes
Detect changes in working directory not yet committed:
git status --porcelain
git status --porcelain | grep -E '^[ MADRC]'
Use when: Git is available but changes haven't been committed yet.
Method 3: Agent Knowledge
Use the agent's internal tracking of file modifications:
- Files created during this session
- Files edited using write/edit tools
- Directories created
Use when: Git is not available or doesn't reflect the changes.
Output Format
Return a simple list of changed files:
/workspaces/project/src/feature-a/install.sh (modified)
/workspaces/project/src/feature-a/devcontainer-feature.json (modified)
/workspaces/project/src/feature-b/test.sh (added)
Or workspace-relative:
src/feature-a/install.sh (modified)
src/feature-b/test.sh (added)
Workflow
Step 1: Check Git Availability
git rev-parse --git-dir 2>/dev/null && echo "Git available" || echo "No git"
Step 2: Try Git Detection
If git is available:
- Check for uncommitted changes:
git status --porcelain
- Check for commits since branch:
git log --oneline main..HEAD 2>/dev/null
- Combine both sources
Step 3: Fall Back to Agent Knowledge
If git is not available or returns no changes:
- Query agent's file operation history
- List files created/modified in current session
- Note: This is best-effort and may not capture all changes
Step 4: Present and Confirm
Present detected changes to user:
Detected changes:
- src/feature-a/install.sh (modified)
- src/feature-a/devcontainer-feature.json (modified)
Is this correct? (yes/no/manual)
If user says "no" or "manual", ask them to specify which files changed.
Gotchas
- Git not initialized: Repository may exist but not be a git repo
- No commits yet: New repo has no history to compare against
- Detached HEAD: Can't determine branch point
- Agent knowledge gaps: Agent may not track all external modifications
- Path formats: Be consistent - use absolute or relative, not mixed
Examples
Example 1: Detect for Version Bump
User: "Bump the version for my feature"
- Run detection cascade
- Find:
src/my-feature/install.sh and src/my-feature/devcontainer-feature.json
- Present: "Detected changes in src/my-feature/"
- Confirm: "Minor bump (install mechanism unchanged)?"
- Proceed with version bump
Example 2: No Git Available
User: "What changed in my feature?"
- Try git - not available
- Fall back to agent knowledge
- Find: "src/feature/install.sh was modified in this session"
- Note: "Limited to agent-tracked changes; external edits not captured"
Example 3: Manual Override
User: "Actually, I also manually edited the README"
- Show detected changes
- User selects "manual"
- Ask: "Which additional files changed?"
- User provides:
README.md
- Add to list and proceed
Resources
references/git-detection-patterns.md - Detailed git command reference
references/agent-tracking-notes.md - Limitations of agent knowledge