Guide for creating reusable commands via the Packmind CLI. This skill should be used when users want to create a new command that captures multi-step workflows, recipes, or task automation for distribution to Cursor.
This skill provides a complete walkthrough for creating reusable commands via the Packmind CLI.
Commands are structured, multi-step workflows that capture repeatable tasks, recipes, and automation patterns. They help teams standardize common development workflows and enable Cursor to execute complex tasks consistently.
Every command is drafted as a markdown file with this structure:
# Command Name
## Summary
What the command does, why it's useful, and when it's relevant.
## When to Use
- Scenario 1 when this command applies
- Scenario 2 when this command applies
## Context Validation Checkpoints
- Question 1 to validate before proceeding?
- Question 2 to ensure context is clear?
## Steps
### Step Name
What this step does and how to implement it.
\`\`\`typescript
// Optional code example
\`\`\`
### Another Step
Description without code.
The # Title heading is the display name shown in indexes and dashboards. The slug is auto-generated from it — never write the slug yourself.
Format: Use Title Case with spaces — natural language, not a slug.
Examples:
"Create API Endpoint", "Setup Database Migration", "Configure CI Pipeline""api-endpoint" (slug format — use Title Case with spaces)"setup migration" (not Title Case)"create-api-endpoint" (slug format)The CLI validates the command after conversion. Ensure the markdown file meets these requirements:
# Title: Non-empty Title Case string starting with an action verb, descriptive and specific (2–5 words, e.g., "Create API Endpoint")## Summary: Non-empty string describing intent, value, and relevance## When to Use: At least one bullet item (non-empty strings)## Context Validation Checkpoints: At least one bullet item (non-empty strings)## Steps: At least one step subsection### Step Name: Non-empty string (step title)Before creating a command, verify that packmind-cli is available:
Check if packmind-cli is installed:
packmind-cli --version
If not available, install it:
npm install -g @packmind/cli
Then login to Packmind:
packmind-cli login
Skip this step only when the command's workflow and steps are already clearly defined.
To create an effective command, clearly understand:
What workflow does this command automate?
When should this command be triggered?
Example clarifying questions:
Transform the understanding from Step 1 into a complete markdown draft with steps and validation checkpoints.
.packmind/commands/_drafts/ (create the folder if missing) using filename <slug>.md (lowercase with hyphens)# <Command Title> (Title Case, action-verb prefix, 2–5 words)## Summary — what the command does, why it's useful, and when it's relevant## When to Use — bullet list of specific scenarios## Context Validation Checkpoints — bullet list of validation questions## Steps — each step as a ### <step title> subsection following the Step Writing Guidelines belowThis draft file is the only file created during drafting — no separate files are needed.
Good descriptions:
Bad descriptions:
Questions that verify requirements before execution:
Good checkpoints:
Bad checkpoints:
Define specific, actionable scenarios:
Good scenarios:
Bad scenarios:
Before running the CLI command, you MUST get explicit user approval:
Show the user the complete command content in a formatted preview:
Provide the file path to the markdown file (.packmind/commands/_drafts/<slug>.md) so users can open and edit it directly if needed.
Ask: "Here is the command that will be created on Packmind. The draft file is at `<path>` if you want to review or edit it. Do you approve?"
Wait for explicit user confirmation before proceeding to Step 4.
If the user requests changes, go back to earlier steps to make adjustments.
Re-read the markdown file from disk to capture any user edits.
Compare with the original content you created in Step 2.
If changes were detected:
If no changes: Proceed directly to submission.
Convert the markdown to JSON using these conversion rules:
# heading → name## Summary content → summary## When to Use bullet items → whenToUse[]## Context Validation Checkpoints bullet items → contextValidationCheckpoints[]### ... under ## Steps → step name, paragraph text → description, code block → codeSnippet (wrapped in markdown code fences with language identifier)Pipe the JSON directly to the CLI via stdin using a heredoc (no intermediate file needed):
packmind-cli commands create --origin-skill packmind-create-command <<'EOF'
{"name":"...","summary":"...","whenToUse":[...],"contextValidationCheckpoints":[...],"steps":[...]}
EOF
Expected output on success:
packmind-cli Command "Your Command Name" created successfully (ID: <uuid>)
View it in the webapp: <url>
"Not logged in" error:
packmind-cli login
"Failed to resolve global space" error:
Validation errors:
## Steps section has at least one ### step subsectionAfter the command is successfully created, delete the draft markdown file in .packmind/commands/_drafts/.
Only clean up on success - if the CLI command fails, keep the files so the user can retry.
After successful creation, check if the command fits an existing package:
packmind-cli install --list to get available packages<package-slug> package."<package-slug>packmind-cli packages add --to <package-slug> --command <command-slug>packmind-cli install to sync the changes?"packmind-cli installHere's a complete example creating a command for setting up a new API endpoint:
File: .packmind/commands/_drafts/create-api-endpoint.md
# Create API Endpoint
## Summary
Set up a new REST API endpoint with controller, service, and tests following the hexagonal architecture pattern.
## When to Use
- When adding a new REST endpoint to the API
- When implementing a new backend feature that exposes HTTP endpoints
## Context Validation Checkpoints
- Is the HTTP method and path defined (e.g., POST /users)?
- Is the request/response payload structure specified?
- Is the associated use case or business logic identified?
## Steps
### Create Controller
Create the controller file in the \`infra/http/controllers/\` directory with the endpoint handler and input validation.
\`\`\`typescript
@Controller('users')
export class UsersController {
@Post()
async create(@Body() dto: CreateUserDTO) {
return this.useCase.execute(dto);
}
}
\`\`\`
### Create Use Case
Create the use case in the \`application/useCases/\` directory implementing the business logic.
### Create Tests
Create unit tests for the controller and use case in their respective \`.spec.ts\` files following the Arrange-Act-Assert pattern.
### Register in Module
Add the controller and use case to the appropriate NestJS module's \`controllers\` and \`providers\` arrays.
Creating the command (piped via stdin):
packmind-cli commands create --origin-skill packmind-create-command <<'EOF'
{"name":"Create API Endpoint","summary":"Set up a new REST API endpoint...","whenToUse":[...],"contextValidationCheckpoints":[...],"steps":[...]}
EOF
| Section | Required | Description |
|---|---|---|
# Title | Yes | Title Case, action-verb prefix, 2–5 words |
## Summary | Yes | What, why, and when (one sentence) |
## When to Use | Yes | Bullet list, at least one scenario |
## Context Validation Checkpoints | Yes | Bullet list, at least one checkpoint |
## Steps | Yes | Contains step subsections |
### Step Name | Yes (≥1) | Step title |
| Step body (paragraph) | Yes | Implementation details |
| Step body (code block) | No | Markdown code block with language |