From kraftwork
Onboard a new repository as a workspace submodule with automatic codebase scanning.
How this skill is triggered — by the user, by Claude, or both
Slash command
/kraftwork:kraft-importThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Add a new repository to the workspace as a git submodule, scan its codebase for documentation, and configure the workspace accordingly.
Add a new repository to the workspace as a git submodule, scan its codebase for documentation, and configure the workspace accordingly.
| Script | Purpose |
|---|---|
find-workspace.sh | Locate workspace root |
| Category | Skill | Purpose |
|---|---|---|
| git-hosting | find | Search for branches and PRs matching a ticket ID |
| git-hosting | import | Clone a repository into the workspace |
To invoke a provider skill:
workspace.json at the workspace rootjq -r '.providers["<category>"]' workspace.json{provider}:{category}-{skill}IMPORTANT: Derive the scripts directory from this skill file's location:
kraftwork/skills/kraft-import/SKILL.md<workspace-root>/scripts/When you load this skill, note its file path and compute the scripts directory. For example, if this skill is at /path/to/kraftwork/skills/kraft-import/SKILL.md, then scripts are at /path/to/kraftwork/scripts/.
WORKSPACE=$(<scripts-dir>/find-workspace.sh)
if [ $? -ne 0 ]; then
echo "Workspace not found. Run /kraft-config first."
exit 1
fi
echo "Workspace: $WORKSPACE"
WORKSPACE_JSON="$WORKSPACE/workspace.json"
GIT_PROVIDER=$(jq -r '.providers["git-hosting"] // empty' "$WORKSPACE_JSON")
If empty, inform the user that branch/PR search and cloning will not be available — they can provide a repo path or URL manually.
If not provided, ask user:
What ticket or repository identifier do you want to import? (e.g., PROJ-1234 or a repo URL/name)
EXISTING=$(find "$WORKSPACE/modules" -maxdepth 1 -type d -name "${TICKET_ID}-*" 2>/dev/null | head -1)
if [ -n "$EXISTING" ]; then
echo "Module already exists: $EXISTING"
fi
If exists, ask user: use existing, or remove and reimport?
If git-hosting is configured, invoke {git-hosting}:git-hosting-find with the ticket ID to search for matching branches.
If git-hosting is not configured, skip to Step 7 (ask user for repo).
If no branches found and git-hosting is configured, invoke {git-hosting}:git-hosting-find again, requesting a PR search for the ticket ID.
If no results from either search, inform the user and exit.
If multiple branches found, use AskUserQuestion:
Found branches for $TICKET_ID:
1. messaging → PROJ-1234-add-feature
2. frontend → PROJ-1234-ui-updates
Which would you like to import?
Options: list branches, or "All" for multi-repo tickets.
If the repo is not already present at $WORKSPACE/modules/$REPO_NAME, invoke {git-hosting}:git-hosting-import with the repo name and target path.
If git-hosting is not configured, ask the user for a clone URL and run:
git -C "$WORKSPACE" submodule add "<clone-url>" "modules/$REPO_NAME"
Then fetch and checkout the branch:
git -C "$MODULE_DIR" fetch origin "$BRANCH_NAME"
git -C "$MODULE_DIR" checkout --track "origin/$BRANCH_NAME"
echo "Checked out: $BRANCH_NAME"
TREE_DIR="$WORKSPACE/trees/$BRANCH_NAME"
git -C "$MODULE_DIR" worktree add --track -b "$BRANCH_NAME" "$TREE_DIR" "origin/$BRANCH_NAME"
echo "Created worktree: $TREE_DIR"
echo "Tracking: origin/$BRANCH_NAME"
Scan the newly added module for documentation and project context:
DOCS_FOUND=""
for doc in README.md docs/ CLAUDE.md AGENTS.md; do
if [ -e "$MODULE_DIR/$doc" ]; then
DOCS_FOUND="$DOCS_FOUND $doc"
echo "Found: $doc"
fi
done
Read any found documentation files and summarise their content. Then suggest additions to $WORKSPACE/CLAUDE.md based on what was found — for example: repo-specific conventions, tech stack notes, local dev setup commands, or key architectural patterns.
Ask the user whether to apply the suggested additions before writing anything.
SPEC_DIR="$WORKSPACE/docs/specs/$TICKET_ID"
if [ ! -d "$SPEC_DIR" ]; then
mkdir -p "$SPEC_DIR"
cat > "$SPEC_DIR/idea.md" << EOF
# $TICKET_ID
**Imported from:** $BRANCH_NAME
## Context
This worktree was imported from an existing remote branch.
## Notes
_Add notes about the work in progress._
EOF
echo "Created spec directory: $SPEC_DIR"
else
echo "Spec directory already exists: $SPEC_DIR"
fi
Imported $REPO_NAME for $TICKET_ID
Submodule: modules/$REPO_NAME
Worktree: $TREE_DIR
Branch: $BRANCH_NAME (tracking origin/$BRANCH_NAME)
Specs: $SPEC_DIR
Branch status:
$(git -C "$TREE_DIR" log --oneline -5)
Next steps:
1. cd "$TREE_DIR"
2. Review current state: git log --oneline -10
3. Continue development or run /kraft-work if starting fresh
modules/trees/ tracking the remote branchgit pushgit pull --rebasenpx claudepluginhub filipeestacio/kraftwork --plugin kraftworkManages Git worktrees for isolated parallel development. Creates feature/bug branches from 'development', links ticket IDs, copies local .env files, and pushes to remote.
Creates and manages multi-repo workspaces for AI coding assistants (Claude Code, Codex) by unifying configs from sibling git repos and supporting worktree-based feature branches.
Creates isolated git worktrees with smart directory selection and safety verification. Use when starting feature work needing branch isolation.