Upload artifact

From closedloop-ai/claude-plugins · View interactive version

Upload artifact is an AI agent skill from the GitHub repository closedloop-ai/claude-plugins. Upload a file as a ClosedLoop document (PRD, implementation plan, feature, or template). Reads file content and uploads via MCP without consuming conversation context. Also supports creating new versions of existing documents. Triggers on: "upload artifact", "upload PRD", "upload implementation plan

How to use this skill

Skill file

Upload Artifact

Upload file content as a ClosedLoop MCP artifact. Two modes:

  1. Script mode (preferred) — uses a standalone Python script that reads the

file and calls MCP directly over Streamable HTTP. No conversation context

consumed for file content. Requires CLOSEDLOOP_API_KEY and

NEXT_PUBLIC_MCP_SERVER_URL to already be present in the current shell

environment.

  1. MCP fallback — reads the file into context and calls mcp__closedloop__create-document

directly. Uses Claude Code's existing MCP auth. Used when the required

script-mode environment variables are not available.

Workflow

Follow these steps in order:

Step 1: Resolve Credentials and Choose Mode

Read these values from the current shell environment. Do not read, source, or

otherwise rely on a .env.local file in the current working directory:

If both exist → use script mode (Steps 2a–5a).

If either variable is missing → use MCP fallback (Steps 2b–5b).


Script Mode (required env vars available)

Step 2a: List Projects

Run the script with --list-projects:

uv run --with 'mcp[cli]>=2,<3' ${CLAUDE_SKILL_DIR}/scripts/upload_artifact.py \
  --url "$NEXT_PUBLIC_MCP_SERVER_URL" \
  --api-key "$CLOSEDLOOP_API_KEY" \
  --list-projects

Parse the JSON output. Extract the items array. Each item has id and name.

Use AskUserQuestion to present the projects to the user:

If only one project exists, skip the question and use it automatically.

Step 3a: Collect Remaining Parameters

Use AskUserQuestion to collect any parameters the user hasn't already specified:

Only ask for parameters the user hasn't already specified. For example, if they

said "upload /tmp/my-prd.txt as a PRD", you already have the file path and

type — only ask for the title.

Step 4a: Upload via Script

uv run --with 'mcp[cli]>=2,<3' ${CLAUDE_SKILL_DIR}/scripts/upload_artifact.py \
  --url "$NEXT_PUBLIC_MCP_SERVER_URL" \
  --api-key "$CLOSEDLOOP_API_KEY" \
  --file <FILE_PATH> \
  --title "<TITLE>" \
  --type <TYPE> \
  --project-id <PROJECT_ID>

Add --verify if the user requested verification or if testing limits.

Add --artifact-id <ID_OR_SLUG> instead of --title/--type/--project-id

when creating a new version of an existing document. The flag accepts a UUID

or a user-facing slug (PRD-*, PLN-*, FEA-*); the server resolves it.

Step 5a: Report Result

Parse the JSON output and report to the user:

output has an operationReceipt; the server omits it when receipts are off


MCP Fallback (required env vars missing)

Step 2b: List Projects

Call mcp__closedloop__list-projects to get available projects.

Use AskUserQuestion to let the user pick a project (skip if only one).

Step 3b: Collect Remaining Parameters

Same as Step 3a — use AskUserQuestion for any missing file_path, title, or type.

Step 4b: Upload via MCP Tool

Read the file content with the Read tool, then call:

content, and projectId). type is one of PRD, IMPLEMENTATION_PLAN,

FEATURE, or TEMPLATE.

documentId and content). documentId accepts a UUID or a user-facing

slug (PRD-*, PLN-*, FEA-*).

Note: the file content will be loaded into conversation context in this mode.

Step 5b: Report Result

Report the document slug (PRD-*, PLN-*, FEA-*) and ID from the MCP tool response.

Script Parameters

| Flag | Required | Description |

|------|----------|-------------|

| --url | No | MCP server URL (default: http://localhost:3010/mcp) |

| --api-key | Yes | ClosedLoop API key (sk_live_...) |

| --list-projects | No | List projects and exit |

| --file | Upload | Path to content file |

| --title | Create | Document title |

| --type | Create | PRD, IMPLEMENTATION_PLAN, FEATURE, or TEMPLATE |

| --project-id | No | Project ID or slug (PRO-*) |

| --workstream-id | No | Workstream ID or slug (WRK-*) |

| --artifact-id | Version | Existing document ID or slug (PRD-*/PLN-*/FEA-*) for new version |

| --verify | No | Fetch back after upload and compare lengths |

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.