Skip to content

npx skills add: --agent targets silently no-op in non-interactive mode (reports success, writes nothing) #4

Description

@mishaal-cloud

Summary

npx skills add <pkg> --skill <name> --agent <a> <b> -g -y reports a successful install with status: "installed" and lists the target agents under "agents": [...], but when run non-interactively (auto-detected claude-code_2-1-275_agent) it never actually creates the per-agent skill file/symlink for any agent except the one it auto-detected as invoking it. Exit code is 0 and there is no warning/error in stdout or stderr.

Repro

npx --yes skills add typesafe-ai/skills --skill typesafe-ai --agent codex cursor -g -y --json

Output (trimmed):

●   claude-code_2-1-275_agent  Agent detected — installing non-interactively
◇  Installation Summary
│  ~/.agents/skills/typesafe-ai
│    copy → Codex, Cursor
◇  Installation complete
◇  Installed 1 skill
│  ✓ typesafe-ai (copied)
│    → ~/.agents/skills/typesafe-ai
└  Done!
[
  {
    "name": "typesafe-ai",
    "status": "installed",
    "path": "/Users/mishaalmurawala/.agents/skills/typesafe-ai",
    "scope": "global",
    "agents": ["Codex", "Cursor"],
    "mode": "copy"
  }
]

Exit code: 0. No stderr output. Ran it twice — same result both times.

Expected

Per the documented per-agent shapes (confirmed by inspecting other already-working skills on the same machine, e.g. origami):

  • Codex gets a real copied directory at ~/.codex/skills/typesafe-ai/
  • Cursor gets a symlink at ~/.cursor/skills/typesafe-ai → ../../.agents/skills/typesafe-ai

Actual

Only the shared source directory ~/.agents/skills/typesafe-ai (containing SKILL.md + LICENSE) is created. Neither ~/.codex/skills/typesafe-ai nor ~/.cursor/skills/typesafe-ai exists on disk:

$ ls ~/.codex/skills/typesafe-ai
ls: /Users/mishaalmurawala/.codex/skills/typesafe-ai: No such file or directory

$ ls ~/.cursor/skills/typesafe-ai
ls: /Users/mishaalmurawala/.cursor/skills/typesafe-ai: No such file or directory

npx skills ls -g -a codex and npx skills ls -g -a cursor both list typesafe-ai as installed for that agent (Agents: Codex, Cursor) even though the on-disk artifact the agent would actually read is missing — so list is reporting from the same source-of-truth the add command already trusted, not verifying the per-agent copy actually landed.

I confirmed this isn't a one-off race: reproduced identically on two separate runs, both with -y and --json.

Workaround

Manually replicating the install shape used for other working skills closes the gap:

cp -R ~/.agents/skills/typesafe-ai ~/.codex/skills/typesafe-ai
ln -s ../../.agents/skills/typesafe-ai ~/.cursor/skills/typesafe-ai

Environment

  • skills CLI: 1.7.0 (via npx --yes skills)
  • Invoking agent: Claude Code 2.1.275 (auto-detected by the CLI as claude-code_2-1-275_agent, which is likely why only its own non-interactive path ran and the explicit --agent codex cursor targets were skipped)
  • OS: macOS (Darwin 27.0.0)
  • Node: run via npx, no local pin

Suspected root cause

The "Agent detected — installing non-interactively" branch appears to special-case the auto-detected invoking agent and skip the explicit --agent <list> targets entirely when running non-interactively — i.e. --agent codex cursor is silently ignored once the tool decides it's running inside an agent session, rather than being honored in addition to (or instead of) the auto-detected one. The success report/exit code should not be 0/"installed" for agents whose files were never written.

Happy to provide the full raw terminal capture if useful.

Activity

  1. aoright commented on Sep 24, 2026

    @aoright

    Analysis & Context on skills CLI Agent Auto-Detection

    This behavior stems from how the upstream skills CLI (from skills.sh) handles runtime agent auto-detection during non-interactive execution:

    1. Auto-Detection Priority:
      When skills add is executed within an active agent process (e.g. Claude Code sets identifying process environment variables), the CLI's detector triggers:

      Agent detected — installing non-interactively
      

      In this branch, the CLI prioritizes the detected caller agent, writes the canonical assets to ~/.agents/skills/typesafe-ai, and registers the targets in its metadata table, but bypasses the physical per-agent symlink/copy dispatch (~/.codex/skills/, ~/.cursor/skills/) for other agents.

    2. Clean Resolution Paths:

      • Execution Outside Agent Shell:
        Running npx --yes skills add typesafe-ai/skills --skill typesafe-ai --agent codex cursor -g -y from a standard user terminal (outside an active Claude Code or Cursor environment) properly parses --agent arguments and provisions the per-agent symlinks and copies.
      • Sanitizing Process Environment:
        When orchestrating installs from inside an agent prompt, stripping agent detection environment markers ensures all explicit target agents are created:
        env -u CLAUDE_CODE -u CLAUDECODE npx --yes skills add typesafe-ai/skills --skill typesafe-ai --agent codex cursor -g -y
      • Manual Link Strategy:
        As documented in your workaround, creating the symlink in ~/.cursor/skills/ and copying to ~/.codex/skills/ from ~/.agents/skills/typesafe-ai restores complete functionality.
    3. Documentation Consideration:
      A short operational note in the repository README.md clarifying that multi-agent batch installs should be invoked from a native terminal will prevent developers from encountering this silent drop when configuring environments across agents.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions