Add a 'desloppify setup' CLI command that installs the desloppify skill globally into ~/.claude/skills/, ~/.codex/skills/, and ~/.cursor/rules/ — mirroring megaplan's universal setup pattern. Bundle skill definitions via importlib.resources in desloppify/data/global/. Also support 'desloppify setup --local' to drop an AGENTS.md in the current project directory. This makes desloppify's Claude Code skill available in any project on any machine after pip install, not just when opened in the desloppify repo itself.
Currently, the desloppify skill is only available as a Claude Code skill when working inside the desloppify repo itself, or after running update-skill (which downloads from GitHub per-project). The setup command makes it globally available on any machine right after pip install desloppify, using bundled files — no network required.
Key distinction from update-skill:
update-skill = per-project, downloads latest from GitHub, installs relative to project root
setup = machine-wide global install from bundled package data, installs to ~/ paths. Works offline.
Who reads global skill files? The AI tools themselves (Claude Code, Cursor, etc.) discover and load skills from home-directory paths. Desloppify's own find_installed_skill() currently only checks project-relative paths — the plan extends discovery to also check global paths so the scan workflow doesn't emit false "no skill document found" warnings.
Step 1: Bundle skill data in the package
Create desloppify/data/global/ with __init__.py and all overlay files.
Files to create:
desloppify/data/__init__.py (empty, makes it a package for importlib.resources)
desloppify/data/global/__init__.py (empty)
desloppify/data/global/SKILL.md — copy of docs/SKILL.md (the base skill)
desloppify/data/global/CLAUDE.md — copy of
Assistant
docs/CLAUDE.md
desloppify/data/global/CURSOR.md — copy of docs/CURSOR.md
desloppify/data/global/CODEX.md — copy of docs/CODEX.md
desloppify/data/global/WINDSURF.md — copy of docs/WINDSURF.md
desloppify/data/global/GEMINI.md — copy of docs/GEMINI.md
desloppify/data/global/HERMES.md — copy of docs/HERMES.md
Bundle all overlays so --local can assemble the correct interface-specific AGENTS.md.
Update pyproject.toml to include the new package data:
Create a GLOBAL_TARGETS dict in desloppify/app/commands/setup/cmd.py with explicit documentation of where each path comes from:
python
# Global install paths — where each AI tool discovers user-level skills.
#
# These paths are NOT validated by the desloppify repo itself; they depend
# on external tool behavior. Sources:
#
# claude: Claude Code reads ~/.claude/skills/<name>/SKILL.md
# (same relative structure as the project-level .claude/skills/
# path already in SKILL_TARGETS, but rooted at $HOME)
# cursor: Cursor reads ~/.cursor/rules/<name>.md for global rules
# (project-level equivalent: .cursor/rules/ in SKILL_TARGETS)
#
# The setup command validates that the parent tool directory exists (~/.claude/,
# ~/.cursor/) before writing, so it won't create orphan files for tools the
# user hasn't installed.
GLOBAL_TARGETS: dict[str, tuple[str, str, str]] = {
# interface → (path relative to ~/, overlay name, tool config dir to check)
"claude": (".claude/skills/desloppify/SKILL.md", "CLAUDE", ".claude"),
"cursor": (".cursor/rules/desloppify.md", "CURSOR", ".cursor"),
}
Pre-flight validation
Before writing each target, check that the tool's config directory exists at Path.home() / tool_config_dir. If it doesn't:
Single interface mode (--interface claude): raise CommandError with "~/.claude/ not found — Claude Code doesn't appear to be installed."
All-targets mode (no --interface): skip that target with a yellow warning: "Skipping claude (~/.claude/ not found)" and continue with other targets. If all targets are skipped, error with: "No supported AI tools detected. Install Claude Code or Cursor first, or use --interface to force."
This ensures we never silently write files into directories that no tool will ever read.
Codex is excluded from global targets for now. The existing SKILL_TARGETS maps codex to .agents/skills/ (project-relative), while runner_failures.py references ~/.codex/skills — these are inconsistent. The --interface codex flag will emit a clear message: "Codex global skill path is not yet confirmed. Use desloppify update-skill codex for per-project install."
Step 3: Create the setup command module
Create desloppify/app/commands/setup/__init__.py and desloppify/app/commands/setup/cmd.py.
Global mode (default: desloppify setup)
Logic:
Read bundled files via importlib.resources.files('desloppify.data.global')
For each target in GLOBAL_TARGETS:
a. Check Path.home() / tool_config_dir exists (pre-flight, see Step 2)
b. Assemble base SKILL.md + interface overlay (reuse _build_section from update_skill)
c. Resolve Path.home() / rel_path, create parent directories
d. Write file via safe_write_text
Print summary: which targets installed, which skipped, full paths written
Support --interface flag to install only one target (e.g. desloppify setup --interface claude).
Local mode (desloppify setup --local)
Uses project root, not cwd. Consistent with the rest of the codebase: get_project_root() resolves the install target, so running from a subdirectory still writes to the correct location.
Requires --interface to pick the overlay. Because AGENTS.md is a shared target for windsurf, gemini, and hermes — each with distinct overlay content (e.g., Hermes has delegate_task instructions, Windsurf/Gemini have different workflows) — the command must know which overlay to apply.
Logic:
Require --interface when --local is set. Error with clear message if omitted: "AGENTS.md is shared by multiple interfaces. Specify one: --interface windsurf|gemini|hermes"
Read bundled SKILL.md + the specified overlay
Assemble with _build_section
Resolve get_project_root() / "AGENTS.md"
If AGENTS.md already exists, use _replace_section (begin/end markers) to replace only the desloppify section, preserving other content
If new file, write the assembled content directly
Print what was written and where
Shared logic reuse
Import directly from update_skill.cmd:
_build_section() — assembles base + overlay
_replace_section() — section replacement for shared files
_ensure_frontmatter_first() — for targets that need it
Step 4: Wire up CLI parser and registry
parser_groups_admin.py — add:
python
def _add_setup_parser(sub) -> None:
p = sub.add_parser(
"setup",
help="Install desloppify skill globally for AI coding assistants",
)
p.add_argument(
"--local",
action="store_true",
help="Install AGENTS.md in project root instead of global paths",
)
p.add_argument(
"--interface",
default=None,
help="Install for a specific interface only (global: claude, cursor; local: windsurf, gemini, hermes)",
)
parser.py — import and call _add_setup_parser(sub).
registry.py — add "setup": cmd_setup to the handlers dict.
Step 5: Extend skill discovery to cover global installs
Addresses the scan workflow gap. Currently find_installed_skill() only searches project-relative paths, and auto_update_skill() in agent_context.py:420-426 calls it to decide whether to print "No skill document found." After desloppify setup, a user with a global install but no per-project install would still see that false warning during every scan.
Changes to desloppify/app/skill_docs.py:
Add GLOBAL_SKILL_SEARCH_PATHS (paths relative to Path.home()):
Add find_global_skill() -> SkillInstall | None — same logic as find_installed_skill() but searches Path.home() / path instead of get_project_root() / path. Returns a SkillInstall with rel_path prefixed by ~/ for display purposes.
Update check_skill_version() to also check global installs. If no project-local install is found but a stale global install exists, warn: "Your global desloppify skill is outdated (vN, current vM). Run: desloppify setup"
Changes to desloppify/app/commands/scan/reporting/agent_context.py:
Modify the post-check in auto_update_skill() (lines 419-432):
python
install = skill_docs_mod.find_installed_skill()
if not install:
# Check global install before warning.
global_install = skill_docs_mod.find_global_skill()
if global_install and not global_install.stale:
return # Global install is current — no warning needed.
elif global_install and global_install.stale:
print(
f"Global skill document is outdated "
f"(v{global_install.version}, current v{skill_docs_mod.SKILL_VERSION}). "
f"Run: desloppify setup"
)
else:
names = ", ".join(sorted(skill_docs_mod.SKILL_TARGETS))
print(
f"No skill document found. Install one for better workflow guidance: "
f"desloppify update-skill <{names}>"
)
elif install.stale:
print(
f"Skill document is outdated "
f"(v{install.version}, current v{skill_docs_mod.SKILL_VERSION}). "
f"Run: desloppify update-skill"
)
Do NOT change _try_auto_update_skill()'s auto-download behavior. Auto-update remains project-scoped. Global installs are updated explicitly via desloppify setup.
Step 6: Tests
Create desloppify/tests/commands/test_setup.py:
Global install: mock Path.home() to a temp dir (with .claude/ and .cursor/ subdirs pre-created), run cmd_setup, verify files created at expected paths with correct content and version markers
Global single interface: --interface claude creates only the Claude target
Global pre-flight skip: mock Path.home() to a temp dir with only .claude/ (no .cursor/), run without --interface, verify Claude target written and Cursor target skipped with warning
Global pre-flight error: --interface cursor with no ~/.cursor/ raises CommandError
Local install: mock get_project_root() to a temp dir, run with --local --interface hermes, verify AGENTS.md created with Hermes overlay content
Local section replacement: pre-create an AGENTS.md with other content + desloppify markers, run --local --interface windsurf, verify only desloppify section replaced
Local requires interface: --local without --interface raises CommandError
Codex global blocked: --interface codex prints informative skip message
Bundled resources readable: importlib.resources.files('desloppify.data.global') returns valid content for each expected file
Global discovery in scan: mock Path.home() with a valid global skill file, verify find_global_skill() returns correct SkillInstall, verify scan post-check suppresses "no skill document found" when global install is current
Step 7: Sync guard
Add a test in desloppify/tests/test_bundled_sync.py that compares docs/SKILL.md with desloppify/data/global/SKILL.md (and each overlay) to catch drift between source-of-truth docs and bundled copies. Fail with a clear message: "Bundled skill data is out of sync with docs/. Run: cp docs/*.md desloppify/data/global/"
Edit (update post-check to call find_global_skill() before warning)
desloppify/app/commands/registry.py
Edit (add setup)
desloppify/app/cli_support/parser_groups_admin.py
Edit (add parser)
desloppify/app/cli_support/parser.py
Edit (wire parser)
pyproject.toml
Edit (package-data)
desloppify/tests/commands/test_setup.py
Create
desloppify/tests/test_bundled_sync.py
Create
code
Plan metadata:
{
"version": 3,
"timestamp": "2026-03-20T17:33:16Z",
"hash": "sha256:099610c51c90b89a689070cc1319a8507d35d069f55aa6107797addf4503a67b",
"changes_summary": "Addressed both remaining significant flags:\n\n(1) setup_global_install_not_discoverable: Extended the fix beyond just check_skill_version() to also cover the scan workflow. Specifically, auto_update_skill() in agent_context.py:419-432 now calls find_global_skill() as a fallback before printing "No skill document found". If a current global install exists, no warning is shown. If a stale global install exists, the warning points to desloppify setup (not update-skill). This closes the full discovery loop \u2014 find_installed_skill() for project-local, find_global_skill() for home-directory installs.\n\n(2) setup_global_paths_not_repo_validated: Added a new Step 2 that (a) documents the provenance of each global path with explicit comments in the code explaining they depend on external tool behavior, and (b) adds pre-flight validation \u2014 the command checks that the tool's config directory exists (~/.claude/, ~/.cursor/) before writing. In all-targets mode, missing tool dirs are skipped with a warning; in single-interface mode, it's an error. This prevents writing orphan files for tools the user hasn't installed and makes the external dependency explicit rather than assumed.",
"flags_addressed": [
"setup_global_install_not_discoverable",
"setup_global_paths_not_repo_validated"
],
"questions": [
"Should we also bundle AMP, OpenCode, and Droid overlays for potential future global targets, or keep the bundled set minimal (claude + cursor + windsurf/gemini/hermes)?",
"Sync strategy: the plan uses a test guard that compares docs/ vs data/global/. Alternative: read docs/ at build time via a setuptools hook. Test guard is simpler \u2014 confirm this is preferred.",
"Once the Codex global path is confirmed, should it be added to GLOBAL_TARGETS or should Codex remain project-only? The .agents/skills/ convention suggests it may be project-scoped by design."
],
"success_criteria": [
"pip install desloppify && desloppify setup installs skill files to ~/.claude/skills/desloppify/SKILL.md and ~/.cursor/rules/desloppify.md \u2014 all readable and containing the correct skill version marker.",
"desloppify setup --interface claude installs only the Claude target.",
"desloppify setup --interface codex prints a clear message explaining codex global is not yet supported and suggests update-skill.",
"desloppify setup skips targets whose tool config dir doesn't exist (e.g., no ~/.cursor/) with a yellow warning, and errors if ALL targets are skipped.",
"desloppify setup --interface cursor with no /.cursor/ directory raises CommandError.",
"desloppify setup --local --interface hermes creates or updates AGENTS.md at the project root (not cwd) with Hermes overlay content wrapped in begin/end markers.",
"desloppify setup --local --interface windsurf on an existing AGENTS.md with other content preserves that content and only replaces the desloppify section.",
"desloppify setup --local without --interface raises CommandError with guidance on which interfaces are valid.",
"All operations work offline \u2014 files come from importlib.resources bundled data, no network calls.",
"After desloppify setup, running desloppify scan in a project without a per-project skill install does NOT print 'No skill document found' \u2014 the scan post-check detects the global install via find_global_skill().",
"check_skill_version() detects stale global installs and warns with 'Run: desloppify setup'.",
"python -m pytest desloppify/tests/commands/test_setup.py desloppify/tests/test_bundled_sync.py -q passes.",
"desloppify setup prints a clear summary of what was installed and where, including any skipped targets."
],
"assumptions": [
"Global skill paths (/.claude/skills/, ~/.cursor/rules/) depend on external tool behavior, not on desloppify's own code. The setup command validates tool presence by checking the parent config dir exists before writing.",
"importlib.resources.files() works for bundled .md files when installed via pip (including editable installs). Standard Python 3.11+ behavior.",
"Bundled skill files are a snapshot matching the shipped version. Users wanting the latest use update-skill (downloads from GitHub).",
"No network access needed for setup \u2014 this is the key differentiator from update-skill.",
"docs/ is the source of truth. Bundled copies kept in sync via test guard.",
"Section markers (desloppify-begin/end) are the established pattern for shared-file installs.",
"Codex global skill path is unresolved \u2014 excluded until confirmed. Per-project install via update-skill still works.",
"get_project_root() is the correct base for --local, matching all other install paths in the codebase.",
"The existence of ~/.claude/ is a reliable indicator that Claude Code is installed; likewise ~/.cursor/ for Cursor. If these dirs don't exist, the tool won't read skills from them."
],
"delta_from_previous_percent": 25.44
}
code
Execution summary:
{
"output": "Implemented the desloppify setup feature end-to-end: bundled offline skill assets, added the new CLI command, extended global skill discovery, and covered the scan workflow so a valid global install suppresses the old \u201cNo skill document found\u201d warning.\n\nFiles Changed\n- pyproject.toml\n- desloppify/data/init.py\n- desloppify/data/global/init.py\n- desloppify/data/global/SKILL.md\n- desloppify/data/global/CLAUDE.md\n- desloppify/data/global/CURSOR.md\n- desloppify/data/global/CODEX.md\n- desloppify/data/global/WINDSURF.md\n- desloppify/data/global/GEMINI.md\n- desloppify/data/global/HERMES.md\n- desloppify/app/commands/setup/init.py\n- desloppify/app/commands/setup/cmd.py\n- desloppify/app/skill_docs.py\n- desloppify/app/commands/scan/reporting/agent_context.py\n- desloppify/app/commands/registry.py\n- desloppify/app/cli_support/parser_groups_admin.py\n- desloppify/app/cli_support/parser_groups.py\n- desloppify/app/cli_support/parser.py\n- desloppify/tests/commands/test_setup.py\n- desloppify/tests/test_bundled_sync.py\n\nCommands Run\n- mkdir -p desloppify/data/global && touch desloppify/data/__init__.py desloppify/data/global/__init__.py && cp docs/SKILL.md docs/CLAUDE.md docs/CURSOR.md docs/CODEX.md docs/WINDSURF.md docs/GEMINI.md docs/HERMES.md desloppify/data/global/\n- python -c \"from importlib.resources import files; print(files('desloppify.data.global').joinpath('SKILL.md').read_text()[:50])\"\n- python -m pytest desloppify/tests/commands/test_setup.py desloppify/tests/test_bundled_sync.py -q\n- python -m pytest desloppify/tests/commands/test_update_skill_cmd_direct.py desloppify/tests/commands/test_transitive_modules_update_skill.py desloppify/tests/commands/test_transitive_engine.py -q\n\nVerification\n- Bundled resource read succeeded.\n- 16 passed in the new setup/sync test set.\n- 88 passed in the targeted existing update-skill/parser regression tests.\n\nDeviation\n- I changed _try_auto_update_skill() slightly beyond the written plan: if a global skill install exists at all, scan now avoids auto-downloading a project-local skill. Without that, desloppify setup still got undercut by scan\u2019s project-local auto-install path. This matches the feature intent better and makes stale global installs warn with Run: desloppify setup instead of silently creating a local install.\n\nUnrelated existing worktree changes in desloppify/cli.py and .megaplan/ were left untouched.",
"files_changed": [
[REDACTED],
[REDACTED],
[REDACTED],
[REDACTED],
[REDACTED],
[REDACTED],
[REDACTED],
[REDACTED],
[REDACTED],
[REDACTED],
[REDACTED],
[REDACTED],
[REDACTED],
[REDACTED],
[REDACTED],
[REDACTED],
[REDACTED],
[REDACTED],
[REDACTED],
[REDACTED]
],
"commands_run": [
"mkdir -p desloppify/data/global && touch desloppify/data/init.py desloppify/data/global/init.py && cp docs/SKILL.md docs/CLAUDE.md docs/CURSOR.md docs/CODEX.md docs/WINDSURF.md docs/GEMINI.md docs/HERMES.md desloppify/data/global/",
"python -c "from importlib.resources import files; print(files('desloppify.data.global').joinpath('SKILL.md').read_text()[:50])"",
"python -m pytest desloppify/tests/commands/test_setup.py desloppify/tests/test_bundled_sync.py -q",
"python -m pytest desloppify/tests/commands/test_update_skill_cmd_direct.py desloppify/tests/commands/test_transitive_modules_update_skill.py desloppify/tests/commands/test_transitive_engine.py -q"
],
"deviations": [
"Adjusted scan auto-install behavior so any existing global skill install blocks project-local auto-download; this was necessary to make desloppify setup behave consistently with the intended offline/global workflow."
]
}
code
Git diff summary:
M desloppify/app/cli_support/parser.py
M desloppify/app/cli_support/parser_groups.py
M desloppify/app/cli_support/parser_groups_admin.py
M desloppify/app/commands/registry.py
M desloppify/app/commands/scan/reporting/agent_context.py
M desloppify/app/skill_docs.py
M desloppify/cli.py
M pyproject.toml
?? .megaplan/
?? desloppify/app/commands/setup/
?? desloppify/data/
?? desloppify/tests/commands/test_setup.py
?? desloppify/tests/test_bundled_sync.py
code
Requirements:
- Be critical.
- Verify each success criterion explicitly.
- Call out any concrete gaps or regressions in issues.
{"criteria":[{"name":"pip install desloppify && desloppify setup installs Claude and Cursor global files with correct version markers","pass":false,"evidence":"Mixed result. Running HOME=<tmp> python -m desloppify.cli setup from the checkout created both targets and the written files contained the expected version/overlay markers, matching the implementation in cmd.py and bundled data in SKILL.md. But the actual packaged-install path is blocked in this repo: local python -m pip install . failed during metadata generation because pyproject.toml declares project.license = \"MIT\", which current setuptools rejected."},{"name":"desloppify setup --interface claude installs only the Claude target","pass":true,"evidence":"Covered by test_setup.py, which asserts the Claude file is created and the Cursor file is not."},{"name":"desloppify setup --interface codex prints a clear unsupported message","pass":true,"evidence":"Implemented in cmd.py and covered by test_setup.py. I also ran the CLI and it printed Codex global skill path is not yet confirmed. Use desloppify update-skill codex for per-project install."},{"name":"desloppify setup skips missing tool dirs with warning and errors if all targets are skipped","pass":true,"evidence":"The skip/error branches are in cmd.py and are exercised by test_setup.py and test_setup.py."},{"name":"desloppify setup --interface cursor errors when ~/.cursor/ is missing","pass":true,"evidence":"Implemented by the preflight check in cmd.py and covered by test_setup.py."},{"name":"desloppify setup --local --interface hermes writes AGENTS.md at project root with Hermes markers","pass":true,"evidence":"Local install uses get_project_root() in cmd.py, and test_setup.py verifies the file is created with the begin marker and Hermes overlay marker."},{"name":"desloppify setup --local --interface windsurf preserves other AGENTS.md content and replaces only the desloppify section","pass":true,"evidence":"The shared-file replacement path is in cmd.py via _replace_section, and test_setup.py verifies surrounding content is preserved."},{"name":"desloppify setup --local without --interface raises CommandError with guidance","pass":true,"evidence":"Implemented in cmd.py and covered by test_setup.py."},{"name":"Setup operations work offline from bundled package data","pass":true,"evidence":"The setup command reads bundled files exclusively through importlib.resources in cmd.py and never calls the networked update path. Resource readability is covered by test_setup.py and sync is guarded by test_bundled_sync.py."},{"name":"After global setup, scan does not print No skill document found when a current global install exists","pass":true,"evidence":"The scan fallback checks find_global_skill() in agent_context.py, and test_setup.py verifies a current global install suppresses both download and warning output."},{"name":"check_skill_version() warns on stale global installs with Run: desloppify setup","pass":true,"evidence":"Implemented in skill_docs.py and covered by test_setup.py."},{"name":"python -m pytest desloppify/tests/commands/test_setup.py desloppify/tests/test_bundled_sync.py -q passes","pass":true,"evidence":"Verified locally: 16 passed in 0.29s. I also ran the targeted regression suite for update-skill/parser interactions and got 88 passed in 0.96s."},{"name":"desloppify setup prints a clear summary of installed and skipped targets","pass":false,"evidence":"The command itself prints the expected install/skip summary from cmd.py, but the real CLI output is polluted by unrelated persisted-exclusion messages because setup still goes through shared runtime bootstrap in cli.py and exclusion printing in cli.py. That makes the summary less clear than the criterion asks for."}],"issues":["High: the primary packaged-install success path is not reproducible from this repo. Local python -m pip install . failed before setup could run because pyproject.toml uses project.license = \"MIT\", which current setuptools rejected under PEP 621. That leaves the main pip install ... && desloppify setup criterion failing/unverified.","Medium: desloppify setup does not produce a clean setup-focused CLI transcript. main() still loads shared runtime and prints persisted exclusions for this command, so users see unrelated Excluding ... output ahead of the install summary; see cli.py and cli.py.","Low: the all-targets error text is inaccurate. When every tool dir is missing, setup says users can use --interface to force, but single-interface mode still hard-fails on the same missing-dir preflight; see cmd.py and cmd.py.","Low: there is still no installed-package integration test for the exact shipped behavior. The new tests exercise module code from the source tree, not a built wheel/sdist, so package-data or entry-point regressions would escape until release; see test_setup.py and test_bundled_sync.py."],"summary":"Core feature work is in place: bundled resources, the setup command, local AGENTS.md support, global skill discovery, and the scan/status warning behavior are all implemented and covered by targeted tests. The main gaps against the stated success criteria are that the repo does not currently support the advertised packaged-install path end to end, and the CLI output for setup is noisier than the requested clear summary."}
“Review the implementation against the success criteria. Project directory:….” Conversation with gpt-5.4, from the Peter O’Mallet DataClaw Conversations dataset. The Chat Archive, 2026. https://thechatarchive.com/c/01m80epvpzt3xf41ye8c0mmsx9