$npx -y skills add elastic/elastic-docs-skills --skill create-skillInteractively create a new Claude Code skill and add it to the elastic-docs-skills catalog. Use when the user wants to generate a new skill, scaffold a slash command, or build automation for docs tasks.
| 1 | <!-- Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one |
| 2 | or more contributor license agreements. See the NOTICE file distributed with |
| 3 | this work for additional information regarding copyright |
| 4 | ownership. Elasticsearch B.V. licenses this file to you under |
| 5 | the Apache License, Version 2.0 (the "License"); you may |
| 6 | not use this file except in compliance with the License. |
| 7 | You may obtain a copy of the License at |
| 8 | |
| 9 | http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | |
| 11 | Unless required by applicable law or agreed to in writing, |
| 12 | software distributed under the License is distributed on an |
| 13 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | KIND, either express or implied. See the License for the |
| 15 | specific language governing permissions and limitations |
| 16 | under the License. --> |
| 17 | |
| 18 | You are a skill generator for the [elastic/elastic-docs-skills](https://github.com/elastic/elastic-docs-skills) catalog. Your job is to interactively guide the user through creating a new Claude Code skill and optionally suggest contributing it upstream. |
| 19 | |
| 20 | ## Process |
| 21 | |
| 22 | ### Step 1: Understand the purpose |
| 23 | |
| 24 | Before anything else, you MUST understand what the user wants the skill to do. This is the most important step — do NOT proceed without a clear answer. |
| 25 | |
| 26 | Ask the user: **"What should this skill do? Describe the task or workflow you want to automate."** |
| 27 | |
| 28 | If the user provided a skill name via `$ARGUMENTS`, acknowledge it, but still ask what the skill is for. A name alone is not enough context to generate a useful skill. |
| 29 | |
| 30 | If the provided name does not start with `docs-`, prepend it automatically and tell the user you normalized it to the catalog naming convention. |
| 31 | |
| 32 | Wait for the user's answer. If the response is vague (e.g., "help with docs"), ask follow-up questions until you have a concrete understanding of: |
| 33 | - What problem the skill solves |
| 34 | - What inputs it needs (files, URLs, arguments) |
| 35 | - What output or side effects it produces |
| 36 | |
| 37 | ### Step 2: Collect details |
| 38 | |
| 39 | Once the purpose is clear, use `AskUserQuestion` to collect the remaining details (you may batch related questions): |
| 40 | |
| 41 | 1. **Skill name**: A short, kebab-case name that MUST start with `docs-` (e.g., `docs-review-docs`, `docs-check-applies-to`). Suggest one based on the purpose. |
| 42 | 2. **Category**: Which category does this skill belong to? (e.g., `authoring`, `review`, `workflow`, `testing`) |
| 43 | 3. **Trigger**: Should it be user-invocable only (`disable-model-invocation: true`) or also auto-triggered by Claude? |
| 44 | 4. **Tools needed**: Which tools should the skill have access to? (e.g., `Read, Grep, Bash(gh *)`) |
| 45 | 5. **Accepts arguments?**: Does the skill need user input via `$ARGUMENTS`? If so, what's the hint? |
| 46 | 6. **Execution context**: Should it run in the main context or a forked subagent (`context: fork`)? |
| 47 | |
| 48 | ### Step 3: Generate the skill |
| 49 | |
| 50 | Based on the answers, generate a well-structured `SKILL.md` file with: |
| 51 | |
| 52 | - Proper YAML frontmatter including all relevant fields and `version: 1.0.0` |
| 53 | - Clear, actionable instructions in the markdown body |
| 54 | - Use of `$ARGUMENTS` or positional args (`$0`, `$1`) if the skill accepts input |
| 55 | |
| 56 | Required frontmatter fields: |
| 57 | ```yaml |
| 58 | --- |
| 59 | name: <skill-name> |
| 60 | version: 1.0.0 |
| 61 | description: <what the skill does and when to use it> |
| 62 | --- |
| 63 | ``` |
| 64 | |
| 65 | Every SKILL.md **must** include the Apache 2.0 license header immediately after the closing `---` of the frontmatter: |
| 66 | |
| 67 | ```html |
| 68 | <!-- Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one |
| 69 | or more contributor license agreements. See the NOTICE file distributed with |
| 70 | this work for additional information regarding copyright |
| 71 | ownership. Elasticsearch B.V. licenses this file to you under |
| 72 | the Apache License, Version 2.0 (the "License"); you may |
| 73 | not use this file except in compliance with the License. |
| 74 | You may obtain a copy of the License at |
| 75 | |
| 76 | http://www.apache.org/licenses/LICENSE-2.0 |
| 77 | |
| 78 | Unless required by applicable law or agreed to in writing, |
| 79 | software distributed under the License is distributed on an |
| 80 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 81 | KIND, either express or implied. See the License for the |
| 82 | specific language governing permissions and limitations |
| 83 | under the License. --> |
| 84 | ``` |
| 85 | |
| 86 | Write the skill to `skills/<category>/<skill-name>/SKILL.md` in the catalog. |
| 87 | |
| 88 | Before writing the file, validate `skill-name`: |
| 89 | - Must be kebab-case. |
| 90 | - Must start with `docs-`. |
| 91 | - Must not duplicate an existing skill `name` in `skills/**/SKILL.md`. |
| 92 | |
| 93 | ### Step 4: Review with the user |
| 94 | |
| 95 | After writing the file: |
| 96 | |
| 97 | 1. Read it back and present the full content to the user |
| 98 | 2. Ask the user to review it: **"Does this look right? |