RUNLOCALAIv38
->Will it run?Best GPUCompareTroubleshootStartLearnPulseModelsHardwareToolsBench
Run check
RUNLOCALAI

Independently operated catalog for local-AI hardware and software. Hand-written verdicts. Source-cited claims. Reproducible commands when we have them.

OP·Fredoline Eruo
DIR
  • Models
  • Hardware
  • Tools
  • Benchmarks
TOOLS
  • Will it run?
  • Compare hardware
  • Cost vs cloud
  • Choose my GPU
  • Prompting kits
  • Quick answers
REF
  • All buyer guides
  • Learn local AI
  • Methodology
  • Glossary
  • Errors KB
  • Trust
EDITOR
  • About
  • Author
  • How we make money
  • Editorial policy
  • Contact
LEGAL
  • Privacy
  • Terms
  • Sitemap
MAIL · MONTHLY DIGEST
Get monthly local AI changes
Monthly recap. No spam.
DISCLOSURE

Some links on this site are affiliate links (Amazon Associates and other first-class retailers). When you buy through them, we earn a small commission at no extra cost to you. Affiliate links do not influence our verdicts — there are cards we rate highly that we don't have affiliate relationships with, and cards that sell well that we refuse to recommend. Read more →

© 2026 runlocalai.coIndependently operated
RUNLOCALAI · v38
  1. >
  2. Home
  3. /Learn
  4. /Courses
  5. /Local AI for Code Generation
  6. /Ch. 7
Local AI for Code Generation

07. Custom Commands

Chapter 7 of 18 · 25 min
KEY INSIGHT

Custom commands extend Continue's capabilities by automating repetitive tasks, defining specialized prompts, and integrating external tools into your coding workflow. Commands in Continue are reusable prompt templates with optional file targeting and code transformation logic. They appear in the command palette (`Ctrl+Shift+P` > "Continue: Custom Commands") and can be assigned keyboard shortcuts. Define commands in `config.json` under the `commands` array: ```json { "commands": [ { "name": "Explain Code", "description": "Explain selected code with technical depth", "prompt": "{{{ clipboard }}}\n\nExplain this code in technical detail, focusing on:\n1. Algorithm complexity\n2. Edge cases handled\n3. Potential bugs or security issues\n4. Improvement suggestions" } ] } ``` Commands receive variables through template syntax: - `{{{ selected }}}` - currently selected text - `{{{ clipboard }}}` - system clipboard contents - `{{{ file }}}` - current file path - `{{{ directory }}}` - current directory path The `prompt` field contains the template that gets sent to the model. The selected code or clipboard content gets substituted where you place the variable. More complex commands use the `run` field for file operations: ```json { "commands": [ { "name": "Add Type Hints", "description": "Add type hints to Python functions", "prompt": "Add thorough type hints to the following Python code:\n\n{{{ selected }}}", "run": "replace" } ] } ``` The `run` field accepts `"replace"` (replace selection with model output), `"insert"` (insert at cursor), `"apply"` (patch files with diff output), or `"query"` (display in chat without modification). Parameterized commands accept user input before execution: ```json { "commands": [ { "name": "Generate Tests", "prompt": "{{{ selected }}}\n\nGenerate pytest tests for the above code. Test coverage should include:\n1. Happy path cases\n2. Edge cases\n3. Error conditions\n4. Edge case: {{ input:edge_case_description }}", "run": "insert" } ] } ``` The `{{ input:field_name }}` syntax prompts for user input before the command runs. Multiple inputs are supported. Real-world command examples: ```json { "commands": [ { "name": "Code Review", "description": "Perform a security-focused code review", "prompt": "Review the following code for security vulnerabilities, focusing on OWASP Top 10 categories:\n\n{{{ selected }}}", "run": "replace" }, { "name": "Write Docstring", "description": "Generate Google-style docstring", "prompt": "Write a Google-style docstring for:\n```\n{{{ selected }}}\n```", "run": "replace" }, { "name": "Commit Message", "description": "Generate conventional commit message", "prompt": "Based on these changes:\n```\n{{{ clipboard }}}\n```\nGenerate a conventional commit message with:\n- Type (feat, fix, docs, refactor, test)\n- Short summary (50 chars max)\n- Detailed description\n\nFormat as:\n<type>: <short summary>\n\n<detailed description>", "run": "clipboard" } ] } ``` The `run: "clipboard"` value copies output to clipboard instead of inserting into the editorΓÇöuseful for commit messages, PR descriptions, and documentation. Assign keyboard shortcuts for frequently used commands: 1. Open VS Code keyboard shortcuts (`Ctrl+K Ctrl+S`) 2. Search for "Continue: Custom Commands" 3. Assign your preferred shortcut (e.g., `Ctrl+Shift+G` for commit message generation)

EXERCISE

Create three custom commands relevant to your current project: one for generating docstrings, one for writing tests, and one for explaining error messages from your logs. Assign keyboard shortcuts and use each command at least once.

← Chapter 6
Chat in Editor
Chapter 8 →
Context Providers