一键导入
sl-deps
Manage specification dependencies with sl deps commands. Use when adding, listing, removing, or resolving spec dependencies in a SpecLedger project.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Manage specification dependencies with sl deps commands. Use when adding, listing, removing, or resolving spec dependencies in a SpecLedger project.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | sl-deps |
| description | Manage specification dependencies with sl deps commands. Use when adding, listing, removing, or resolving spec dependencies in a SpecLedger project. |
sl deps commands manage external specification dependencies stored in specledger/specledger.yaml. Dependencies are Git repositories containing specification documents that this project references or depends on.
The artifact_path is a fundamental concept in SpecLedger dependencies. It specifies where specification artifacts are stored within a repository.
Two types of artifact_path:
Project artifact_path: Where YOUR project stores its artifacts (configured in your project's specledger.yaml)
artifact_path: specledger/specledger/Dependency artifact_path: Where a DEPENDENCY stores its artifacts (auto-discovered or manually specified)
artifact_path: specs/--artifact-path flag for non-SpecLedger reposWhen you reference an artifact from a dependency, the path is resolved as:
<project.artifact_path> + "deps/" + <dependency.alias> + "/" + <artifact_name>
Example:
Project artifact_path: specledger/
Dependency alias: platform
Artifact name: api.md
Resolved path: specledger/deps/platform/api.md
Dependencies are automatically downloaded when you add them:
~/.specledger/cache/<alias>/sl deps resolve command needed (resolve is for manual refresh only)To make dependency artifacts accessible for Claude Code, use the --link flag:
sl deps add git@github.com:org/platform-specs --alias platform --link
sl deps resolve --link
This creates symlinks at specledger/deps/<alias>/ pointing to the cached artifacts. You can then reference artifacts using the alias:artifact format (e.g., platform:api.md).
Use sl deps when you need to:
sl deps commands must be run from within a SpecLedger project directory (one containing specledger/specledger.yaml).
The sl deps commands automatically find the project root by searching for specledger/specledger.yaml in parent directories. This means you can run commands from any subdirectory within your project.
Example:
cd src/components # Deep in project tree
sl deps list # Still works - finds project root automatically
List all dependencies in the current project.
sl deps list
Output includes:
When to use:
Add a new specification dependency.
# Full syntax (alias is required)
sl deps add <git-url> [<branch>] --alias <name> [--artifact-path <path>]
# Examples
sl deps add git@github.com:org/platform-specs --alias platform
sl deps add https://github.com:org/api-docs --alias api --artifact-path docs/openapi/
sl deps add git@github.com:user/repo develop --alias user-repo
Parameters:
<git-url>: Git repository URL (required)
git@github.com:org/repo.githttps://github.com/org/repo.git<branch>: Branch name (default: main)--alias <name>: Short reference name (required)--artifact-path <path>: Path to artifacts within dependency repo (optional, auto-detected for SpecLedger repos)Behavior:
When to use:
Remove a dependency by URL or alias.
sl deps remove <url-or-alias>
sl deps remove git@github.com:org/specs.git
sl deps remove api-specs # Using alias
When to use:
Manually refresh all dependencies (like go mod download).
sl deps resolve
What it does:
~/.specledger/cache/Note: This is typically only needed after cloning a project or for manual refresh. The sl deps add command automatically downloads dependencies.
When to use:
Check for and apply updates to dependencies.
sl deps update # Check all dependencies
sl deps update <alias> # Update specific dependency
When to use:
Display dependency relationships as a graph.
sl deps graph
Output:
Dependencies are stored in specledger/specledger.yaml:
artifact_path: specledger/ # Where this project stores its artifacts
dependencies:
- url: git@github.com:org/platform-specs
branch: main
alias: platform
artifact_path: specs/ # Where the dependency stores its artifacts (auto-detected)
resolved_commit: abc123...
framework: both
import_path: @platform/spec
When adding a SpecLedger repository, artifact_path is auto-detected:
sl deps add git@github.com:org/platform-specs --alias platform
The system will:
For non-SpecLedger repos, manually specify artifact_path:
sl deps add https://github.com/org/api-docs --alias api --artifact-path docs/openapi/
When multiple projects reference shared specs:
# In project-a
sl deps add git@github.com:org/shared-specs --alias shared
# In project-b
sl deps add git@github.com:org/shared-specs --alias shared
Both projects now reference the same source of truth.
When building on top of platform specs:
# Platform team creates core spec
# Service teams add dependency on platform spec
sl deps add git@github.com:org/platform-specs --alias platform
When starting a session in a SpecLedger project:
Deps Check:
- [ ] Run sl deps list to see current dependencies
- [ ] Check if dependencies are resolved (committed SHAs present)
- [ ] Ask user if they want to add any new dependencies
- [ ] Report dependency context: "This project has X dependencies: [summary]"
Not in a SpecLedger project:
Error: failed to find project root: not in a SpecLedger project (no specledger/specledger.yaml found)
Solution: Navigate to your SpecLedger project directory first.
Missing --alias flag:
Error: required flag(s) "alias" not set
Solution: Add the --alias flag when adding dependencies.
Invalid artifact-path:
Error: invalid artifact-path: must be a relative path
Solution: Use a relative path without ../ or leading /.
Dependency already exists:
Error: dependency already exists: git@github.com:org/specs
Solution: Use sl deps remove first if replacing, or check if you meant a different dependency.
Failed to clone repository:
Warning: Failed to clone git@github.com:org/private-specs: authentication failed
Solution:
sl deps add git@github.com:org/platform-auth --alias auth (not --alias specs)sl deps add git@github.com:org/specs v1.0 --alias prod-specssl deps resolve, commit the updated specledger.yamlsl deps resolve ensures all dependencies are cached locallyalias:artifact format in documentationThe sl deps commands integrate with Claude Code to help AI assistants understand your project's dependency structure. When you add dependencies:
Dependencies are cached globally at:
~/.specledger/cache/<alias>/
This cache is shared across all SpecLedger projects on your machine, making dependency management efficient.