spacehub

surshar / claude-code

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

Built by Anthropic · github.com/anthropics

claude-code / plugins / plugin-dev / skills / plugin-settings / examples / create-settings-command.md
98 lines · 2.1 KBPreviewCodeRaw
1---
2description: "Create plugin settings file with user preferences"
3allowed-tools: ["Write", "AskUserQuestion"]
4---
5
6# Create Plugin Settings
7
8This command helps users create a `.claude/my-plugin.local.md` settings file.
9
10## Steps
11
12### Step 1: Ask User for Preferences
13
14Use AskUserQuestion to gather configuration:
15
16```json
17{
18 "questions": [
19 {
20 "question": "Enable plugin for this project?",
21 "header": "Enable Plugin",
22 "multiSelect": false,
23 "options": [
24 {
25 "label": "Yes",
26 "description": "Plugin will be active"
27 },
28 {
29 "label": "No",
30 "description": "Plugin will be disabled"
31 }
32 ]
33 },
34 {
35 "question": "Validation mode?",
36 "header": "Mode",
37 "multiSelect": false,
38 "options": [
39 {
40 "label": "Strict",
41 "description": "Maximum validation and security checks"
42 },
43 {
44 "label": "Standard",
45 "description": "Balanced validation (recommended)"
46 },
47 {
48 "label": "Lenient",
49 "description": "Minimal validation only"
50 }
51 ]
52 }
53 ]
54}
55```
56
57### Step 2: Parse Answers
58
59Extract answers from AskUserQuestion result:
60
61- answers["0"]: enabled (Yes/No)
62- answers["1"]: mode (Strict/Standard/Lenient)
63
64### Step 3: Create Settings File
65
66Use Write tool to create `.claude/my-plugin.local.md`:
67
68```markdown
69---
70enabled: <true if Yes, false if No>
71validation_mode: <strict, standard, or lenient>
72max_file_size: 1000000
73notify_on_errors: true
74---
75
76# Plugin Configuration
77
78Your plugin is configured with <mode> validation mode.
79
80To modify settings, edit this file and restart Claude Code.
81```
82
83### Step 4: Inform User
84
85Tell the user:
86- Settings file created at `.claude/my-plugin.local.md`
87- Current configuration summary
88- How to edit manually if needed
89- Reminder: Restart Claude Code for changes to take effect
90- Settings file is gitignored (won't be committed)
91
92## Implementation Notes
93
94Always validate user input before writing:
95- Check mode is valid
96- Validate numeric fields are numbers
97- Ensure paths don't have traversal attempts
98- Sanitize any free-text fields