dependency-sync
Detect new imports in modified files and auto-install missing dependencies. Works with npm, uv, pip, cargo, go mod, and other package managers. Triggers after code implementation to keep manifests in sync.
Best use case
dependency-sync is best used when you need a repeatable AI agent workflow instead of a one-off prompt. It is especially useful for teams working in multi. Detect new imports in modified files and auto-install missing dependencies. Works with npm, uv, pip, cargo, go mod, and other package managers. Triggers after code implementation to keep manifests in sync.
Detect new imports in modified files and auto-install missing dependencies. Works with npm, uv, pip, cargo, go mod, and other package managers. Triggers after code implementation to keep manifests in sync.
Users should expect a more consistent workflow output, faster repeated execution, and less time spent rewriting prompts from scratch.
Practical example
Example input
Use the "dependency-sync" skill to help with this workflow task. Context: Detect new imports in modified files and auto-install missing dependencies. Works with npm, uv, pip, cargo, go mod, and other package managers. Triggers after code implementation to keep manifests in sync.
Example output
A structured workflow result with clearer steps, more consistent formatting, and an output that is easier to reuse in the next run.
When to use this skill
- Use this skill when you want a reusable workflow rather than writing the same prompt again and again.
When not to use this skill
- Do not use this when you only need a one-off answer and do not need a reusable workflow.
- Do not use it if you cannot install or maintain the related files, repository context, or supporting tools.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/dependency-sync/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How dependency-sync Compares
| Feature / Agent | dependency-sync | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Detect new imports in modified files and auto-install missing dependencies. Works with npm, uv, pip, cargo, go mod, and other package managers. Triggers after code implementation to keep manifests in sync.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Dependency Sync Skill
Automatically detect new imports in modified code files and update package manifests. This skill ensures that when code is written that uses new dependencies, the appropriate manifest files (package.json, pyproject.toml, requirements.txt, etc.) are updated automatically.
## Variables
| Variable | Default | Description |
|----------|---------|-------------|
| AUTO_INSTALL | true | Automatically install detected dependencies |
| PROMPT_BEFORE_INSTALL | false | Ask user before installing (overrides AUTO_INSTALL) |
| INCLUDE_DEV_DEPS | true | Detect dev dependencies (test frameworks, linters) |
| COMMIT_CHANGES | true | Commit manifest changes as part of the task |
| TRIGGER_DOCS_AUDIT | true | Run docs-audit --new-only after adding deps |
## Instructions
**MANDATORY** - Follow the Workflow steps below in order. Do not skip steps.
1. Detect modified files from git diff or implementation context
2. Parse imports/requires from modified files
3. Compare against current manifest dependencies
4. Identify package manager for the project
5. Install missing dependencies
6. Optionally trigger docs-audit for new libraries
## Red Flags - STOP and Reconsider
If you're about to:
- Install a package without verifying the import is actually used
- Skip manifest detection (assuming package manager)
- Install to wrong manifest (e.g., devDependencies vs dependencies)
- Install without checking if package exists in registry
**STOP** -> Verify the import is real -> Check manifest -> Then install
## Workflow
### 1. Gather Modified Files
Identify files that were modified in the current implementation:
```bash
# If in git context
git diff --name-only HEAD~1 HEAD -- "*.py" "*.ts" "*.js" "*.tsx" "*.jsx" "*.go" "*.rs"
# Or from task context - files that were written/edited
```
### 2. Extract Imports
Parse imports from each modified file based on language:
| Language | Import Pattern |
|----------|----------------|
| Python | `import X`, `from X import Y` |
| TypeScript/JavaScript | `import X from 'Y'`, `require('Y')` |
| Go | `import "X"` |
| Rust | `use X::Y`, `extern crate X` |
### 3. Detect Package Manager
Check for manifest files to determine the package manager:
| Manifest | Package Manager | Install Command |
|----------|-----------------|-----------------|
| `pyproject.toml` (with uv) | uv | `uv add <package>` |
| `pyproject.toml` (poetry) | poetry | `poetry add <package>` |
| `requirements.txt` | pip | `pip install <package>` |
| `package.json` | npm/yarn/pnpm | `npm install <package>` |
| `Cargo.toml` | cargo | `cargo add <package>` |
| `go.mod` | go | `go get <package>` |
| `pubspec.yaml` | pub | `flutter pub add <package>` |
### 4. Compare Dependencies
For each extracted import:
1. Normalize import name to package name (e.g., `from PIL import Image` -> `pillow`)
2. Check if package exists in manifest
3. If missing, add to installation list
### 5. Install Dependencies
Execute installation commands for missing dependencies:
```bash
# Python with uv
uv add <package1> <package2>
# Node.js
npm install <package1> <package2>
# Rust
cargo add <package1> <package2>
# Go
go get <package1> <package2>
```
### 6. Post-Install Actions
If TRIGGER_DOCS_AUDIT is true and new dependencies were added:
1. Run `/ai-dev-kit:docs-audit --new-only`
2. Suggest `/ai-dev-kit:docs-add-stack` if documentation is missing
## Cookbook
### Python Import Mapping
- IF: Parsing Python imports
- THEN: Read `cookbook/python-imports.md`
- RESULT: Normalized package names
### Node Import Mapping
- IF: Parsing JavaScript/TypeScript imports
- THEN: Read `cookbook/node-imports.md`
- RESULT: Normalized package names
### Classification Rules
- IF: Determining if dependency is dev or prod
- THEN: Read `cookbook/dependency-classification.md`
- RESULT: Correct target in manifest
## Quick Reference
### Import-to-Package Mappings
| Import | Package Name | Notes |
|--------|--------------|-------|
| `PIL` | `pillow` | Python imaging |
| `cv2` | `opencv-python` | OpenCV |
| `yaml` | `pyyaml` | YAML parser |
| `sklearn` | `scikit-learn` | ML library |
| `bs4` | `beautifulsoup4` | HTML parsing |
| `pg` | `pg` (npm) / `asyncpg` (py) | PostgreSQL |
| `@tanstack/react-query` | `@tanstack/react-query` | Direct match |
### Dev Dependency Indicators
| Pattern | Classification |
|---------|----------------|
| `pytest`, `vitest`, `jest` | Test framework (dev) |
| `eslint`, `ruff`, `black` | Linter (dev) |
| `@types/*` | Type definitions (dev) |
| `*-dev`, `*-debug` | Development tools (dev) |
## Integration Points
This skill is invoked:
1. **By lane-executor**: After implementing code in a task
2. **By test-engineer**: After writing tests that need new test dependencies
3. **Manually**: Via `/ai-dev-kit:dependency-sync` command
### Example Integration in Lane Executor
```markdown
## Post-Implementation Steps
After completing implementation:
1. Run `dependency-sync` skill to update manifests
2. Run `post-impl-docs` skill to update documentation
3. Verify build/tests still pass
```
## Output
### Success Report
```json
{
"status": "success",
"dependencies_added": [
{"name": "asyncpg", "version": "^0.29.0", "manifest": "pyproject.toml", "type": "production"},
{"name": "pytest-asyncio", "version": "^0.23.0", "manifest": "pyproject.toml", "type": "development"}
],
"manifest_updated": "pyproject.toml",
"commit_sha": "abc123",
"docs_audit_triggered": true
}
```
### No Changes Report
```json
{
"status": "no_changes",
"message": "All imports already present in manifest",
"files_scanned": 5,
"imports_found": 12,
"imports_matched": 12
}
```Related Skills
doc-sync-tool
自动同步项目中的 Agents.md、claude.md 和 gemini.md 文件,保持内容一致性。支持自动监听和手动触发。
rust-async-patterns
Master Rust async programming with Tokio, async traits, error handling, and concurrent patterns. Use when building async Rust applications, implementing concurrent systems, or debugging async code.
dependency-upgrade
Manage major dependency version upgrades with compatibility analysis, staged rollout, and comprehensive testing. Use when upgrading framework versions, updating major dependencies, or managing breaking changes in libraries.
dependency-management-deps-audit
You are a dependency security expert specializing in vulnerability scanning, license compliance, and supply chain security. Analyze project dependencies for known vulnerabilities, licensing issues, outdated packages, and provide actionable remediation strategies.
doc-sync
Keeps IdeaVim documentation in sync with code changes. Use this skill when you need to verify documentation accuracy after code changes, or when checking if documentation (in doc/, README.md, CONTRIBUTING.md) matches the current codebase. The skill can work bidirectionally - from docs to code verification, or from code changes to documentation updates.
async-sync-advisor
Guides users on choosing between async and sync patterns for Lambda functions, including when to use tokio, rayon, and spawn_blocking. Activates when users write Lambda handlers with mixed workloads.
async-patterns-guide
Guides users on modern async patterns including native async fn in traits, async closures, and avoiding async-trait when possible. Activates when users work with async code.
triforce-sync-check
Verify 3-Mirror skill sync consistency across .public/skills, .codex/skills, and .claude/skills. Use after skill changes, before commits, or for CI validation.
dependency-security
Enforce dependency security scanning and SBOM generation. Use when adding dependencies, reviewing package.json, or during security audits. Covers OWASP dependency check, npm audit, and supply chain security.
when-mapping-dependencies-use-dependency-mapper
Comprehensive dependency mapping, analysis, and visualization tool for software projects
dependency-updater
Smart dependency update checker with changelog summaries and breaking change detection.
dependency-auditor
Automated security auditing of project dependencies to identify known vulnerabilities.