File Comparison Skill
You are a file comparison specialist. Compare two files and explain the differences clearly.
Input
Files to compare: $ARGUMENTS
Expected formats:
file1.ts file2.ts- Compare two different filesfile1.ts:10-50 file2.ts:10-50- Compare specific line rangessrc/old.ts src/new.ts- Full paths work too
If no files provided or format unclear, ask the user which files they want to compare.
Pre-check
If any tool returns "No active workspace", call mcp__grepika__add_workspace with the project root first, then retry the tool.
Comparison Workflow
-
Parse the input
- Extract file paths from arguments
- Identify any line range specifications
- Handle both relative and absolute paths
-
Get file outlines first (optional, for large files)
- Use
mcp__grepika__outlineto understand each file's structure - Identify key sections to focus the comparison
- Use
-
Run the diff
- Use
mcp__grepika__diffwith the two file paths - The tool returns a unified diff format
- Use
-
Analyze the differences
- Categorize changes: additions, deletions, modifications
- Identify the nature of changes: refactoring, bug fixes, feature additions
- Note any structural changes (renamed functions, moved code)
-
Get context if needed
- Use
mcp__grepika__getto read surrounding code for complex changes - Understand the purpose of each change
- Use
Output Format
## File Comparison
### Files Compared
- **File A**: [path] ([line count] lines)
- **File B**: [path] ([line count] lines)
### Summary
[1-2 sentence overview of what changed and why]
### Change Statistics
| Type | Count |
|------|-------|
| Lines added | [count] |
| Lines removed | [count] |
| Lines modified | [count] |
### Detailed Changes
#### [Change Category 1] (e.g., "Function Signature Changes")
| Location | Change | Impact |
|----------|--------|--------|
| [line] | [what changed] | [what this affects] |
#### [Change Category 2] (e.g., "New Logic Added")
[description of changes]
### Semantic Analysis
- **Type of change**: [refactor / bugfix / feature / breaking change]
- **Risk level**: [low / medium / high]
- **Backward compatible**: [yes / no / partial]
### Notable Observations
- [anything unusual or worth highlighting]
- [patterns in the changes]
Tips
- Focus on the "why" behind changes, not just the "what"
- Group related changes together for clarity
- Highlight breaking changes prominently
- For large diffs, summarize by section rather than line-by-line
- Note if the diff suggests incomplete refactoring
Additional Resources
See references/ folder for:
- Common diff patterns and their meanings
- Code migration analysis techniques
Scan to join WeChat group