Skip to content

Commit 79db525

Browse files
cundernehrChris UndernehrCopilotkatriendgWilliamBerryiii
authored
feat(prompts): add cspell-config prompt for automated spell check maintenance (#1516)
# feat(prompts): add cspell-config prompt for automated spell check maintenance Added a new experimental prompt to the `experimental` collection that automates `cspell.json` maintenance. The prompt instructs Copilot to run spell checking across the workspace, curate project-specific words, update the words array (alphabetized and deduped), and synchronize `ignorePaths` with `.gitignore`. ## Description Introduced `.github/prompts/experimental/cspell-config.prompt.md` and registered it across collection manifests and plugin outputs. The prompt guides Copilot through a structured workflow: run `cspell`, collect unknown words, filter garbage tokens from legitimate project vocabulary, update `cspell.json` with curated entries, and re-run validation to confirm reduced issue counts. Acceptance criteria target fewer than 50 remaining issues after execution. - Registered the **cspell-config prompt** in `collections/experimental.collection.yml` under a new `# Prompts` section - Added the prompt to `collections/hve-core-all.collection.yml` with `maturity: experimental` - Updated `plugins/experimental/.github/plugin/plugin.json` with a new `"commands"` array exposing `commands/experimental/` - Added `"commands/experimental/"` to `plugins/hve-core-all/.github/plugin/plugin.json`, maintaining alphabetical order ## Related Issue(s) None ## Type of Change Select all that apply: **Code & Documentation:** * [ ] Bug fix (non-breaking change fixing an issue) * [x] New feature (non-breaking change adding functionality) * [ ] Breaking change (fix or feature causing existing functionality to change) * [ ] Documentation update **Infrastructure & Configuration:** * [ ] GitHub Actions workflow * [ ] Linting configuration (markdown, PowerShell, etc.) * [ ] Security configuration * [ ] DevContainer configuration * [ ] Dependency update **AI Artifacts:** * [ ] Reviewed contribution with `prompt-builder` agent and addressed all feedback * [ ] Copilot instructions (`.github/instructions/*.instructions.md`) * [x] Copilot prompt (`.github/prompts/*.prompt.md`) * [ ] Copilot agent (`.github/agents/*.agent.md`) * [ ] Copilot skill (`.github/skills/*/SKILL.md`) > Note for AI Artifact Contributors: > > * Agents: Research, indexing/referencing other project (using standard VS Code GitHub Copilot/MCP tools), planning, and general implementation agents likely already exist. Review `.github/agents/` before creating new ones. > * Skills: Must include both bash and PowerShell scripts. See [Skills](../docs/contributing/skills.md). > * Model Versions: Only contributions targeting the **latest Anthropic and OpenAI models** will be accepted. Older model versions (e.g., GPT-3.5, Claude 3) will be rejected. > * See [Agents Not Accepted](../docs/contributing/custom-agents.md#agents-not-accepted) and [Model Version Requirements](../docs/contributing/ai-artifacts-common.md#model-version-requirements). **Other:** * [ ] Script/automation (`.ps1`, `.sh`, `.py`) * [ ] Other (please describe): ## Sample Prompts (for AI Artifact Contributions) **User Request:** Invoke the `cspell-config` prompt (via `/prompt` or equivalent) to update the project's `cspell.json` with domain-specific vocabulary. **Execution Flow:** 1. Runs `npx cspell --config cspell.json "**/*"` to identify unknown words 2. Collects and categorizes unknown tokens, filtering garbage/generated strings 3. Adds high-value project-specific tokens to the `words` array (alphabetized, deduped) 4. Synchronizes `ignorePaths` with `.gitignore` entries 5. Re-runs cspell and reports final issue counts **Output Artifacts:** Updated `cspell.json` with expanded `words` array and refined `ignorePaths`. A summary of added tokens, ignored paths, and remaining issue count. **Success Indicators:** - `cspell.json` words array is alphabetized and contains no duplicates - `ignorePaths` reflects `.gitignore` exclusions for generated folders - Final cspell run shows fewer than 50 issues (or provides rationale and next actions) > [!NOTE] > Human review is recommended for agent-populated Sample Prompts content. ## Testing - Markdown linting (`npm run lint:md`): Failed (environment issue — missing `markdownlint-rule-search-replace` module, pre-existing) - Spell checking (`npm run spell-check`): Failed (4 pre-existing issues in unrelated files: *docs/contributing/documentation-maintenance.md*, *docs/getting-started/methods/submodule.md*) - Frontmatter validation (`npm run lint:frontmatter`): Passed (537 files validated, 0 errors) - Skill structure validation (`npm run validate:skills`): Passed (19 skills, 0 errors, 1 pre-existing warning in *customer-card-render*) - Link validation (`npm run lint:md-links`): Failed (environment issue — `markdown-link-check` not installed, pre-existing) - PowerShell analysis (`npm run lint:ps`): Passed (all files clean) - Security analysis: No sensitive data exposure, dependency vulnerabilities, or privilege escalation detected - Diff-based assessment: All manifest updates are consistent and maintain alphabetical ordering - Manual testing was not performed ## Checklist ### Required Checks * [x] Documentation is updated (if applicable) * [x] Files follow existing naming conventions * [x] Changes are backwards compatible (if applicable) * [ ] Tests added for new functionality (if applicable) (N/A — prompt artifact; no test infrastructure applies) ### AI Artifact Contributions <!-- If contributing an agent, prompt, instruction, or skill, complete these checks --> * [ ] Used `/prompt-analyze` to review contribution * [ ] Addressed all feedback from `prompt-builder` review * [ ] Verified contribution follows common standards and type-specific requirements ### Required Automated Checks The following validation commands must pass before merging: * [ ] Markdown linting: `npm run lint:md` (N/A — environment missing `markdownlint-rule-search-replace`) * [ ] Spell checking: `npm run spell-check` (N/A — 4 pre-existing issues in unrelated files) * [x] Frontmatter validation: `npm run lint:frontmatter` * [x] Skill structure validation: `npm run validate:skills` * [ ] Link validation: `npm run lint:md-links` (N/A — `markdown-link-check` not installed) * [x] PowerShell analysis: `npm run lint:ps` > [!WARNING] > This PR includes **experimental** GHCP artifacts that may have breaking changes. > - `.github/prompts/experimental/cspell-config.prompt.md` ## GHCP Artifact Maturity | File | Type | Maturity | Notes | |------|------|----------|-------| | `.github/prompts/experimental/cspell-config.prompt.md` | Prompt | ⚠️ experimental | Pre-release only | ### GHCP Maturity Acknowledgment - [ ] I acknowledge this PR includes non-stable GHCP artifacts - [ ] Non-stable artifacts are intentional for this change ## Additional Notes - The experimental collection did not previously have a `# Prompts` section; one was introduced to house this entry. - Plugin outputs were regenerated via `npm run plugin:generate` before committing. --------- Co-authored-by: Chris Undernehr <chris.u@microsoft.com> Co-authored-by: Copilot <copilot@github.com> Co-authored-by: Katrien De Graeve <katriendg@users.noreply.github.com> Co-authored-by: Bill Berry <WilliamBerryiii@users.noreply.github.com>
1 parent 84077a8 commit 79db525

11 files changed

Lines changed: 117 additions & 0 deletions

File tree

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
---
2+
agent: "agent"
3+
description: "Creates or updates the project cspell configuration with project-specific words and ignores"
4+
---
5+
6+
# Update cspell configuration with project-specific words and ignores
7+
8+
## Context
9+
10+
* Goal: Add commonly used project-specific words to the cspell configuration, alphabetize the words list, and add useful `ignorePaths` aligned with the project's ignore files.
11+
* cspell supports multiple config formats and file names. The agent must detect which format the project uses rather than assuming any specific one.
12+
* Projects may also use custom dictionary files (`.txt` word lists) organized in a dedicated directory. The agent must discover and respect existing dictionary structure.
13+
14+
## Required Steps
15+
16+
### Step 1: Detect project context
17+
18+
1. Identify the project's primary language and package manager by inspecting files at the workspace root (e.g., `package.json`, `pyproject.toml`, `Cargo.toml`, `go.mod`, `*.csproj`, `pom.xml`, `Gemfile`).
19+
2. Determine how cspell is installed or available. Check for: a project dependency (npm, pip, or equivalent), a global install (`cspell --version`), or `npx`/`npx`-equivalent availability. If cspell is not available, ask the user for their preferred installation method.
20+
3. Check for an existing spell-check script in the project's task runner (e.g., `package.json` scripts, `Makefile` targets, `justfile` recipes, `pyproject.toml` scripts). Use the project command when one exists.
21+
22+
### Step 2: Detect cspell configuration
23+
24+
1. Search the workspace root for any cspell config file using a broad glob pattern (e.g., `cspell*`, `.cspell*`). cspell recognizes many naming variants including dotfiles (`.cspell.json`), plain names (`cspell.json`), JSONC (`cspell.jsonc`), JS modules (`cspell.config.{js,cjs,mjs}`), and YAML (`cspell.config.{yaml,yml}`). Also check `package.json` for a `cspell` configuration key.
25+
2. If multiple config files exist, use the first match and note the others for the user.
26+
3. If no config file exists, create `cspell.json` with a minimal scaffold (`version`, `language`, `ignorePaths`, `words`).
27+
4. Record the detected config path and format (JSON, YAML, or JS module) for subsequent steps.
28+
29+
### Step 3: Detect custom dictionaries
30+
31+
1. Search for a `.cspell/` directory or any path referenced in the config's `dictionaryDefinitions` field.
32+
2. Catalog existing custom dictionary text files (`.txt` word lists) and note their names, paths, and apparent categories.
33+
3. Check the `dictionaries` field for enabled built-in dictionaries (e.g., `k8s`, `docker`, `rust`, `aws`, `terraform`, `python`, `csharp`).
34+
4. When adding new words later, route each token to either the inline `words` array or an existing custom dictionary file based on category fit. If no custom dictionaries exist, add all tokens to the inline `words` array.
35+
36+
### Step 4: Run initial spell check
37+
38+
1. Run cspell using the project command discovered in Step 1, or fall back to direct invocation (e.g., `npx cspell "**/*"`, `cspell "**/*"`).
39+
2. Collect unknown words from the output, excluding paths already covered by `ignorePaths`.
40+
41+
### Step 5: Curate and categorize tokens
42+
43+
1. Group unknown tokens into categories: project-specific terms, acronyms, technology names, environment variables, proper nouns, and potential typos.
44+
2. Filter out obvious garbage using these heuristics:
45+
* Hex strings of 16+ characters (`[a-f0-9]{16,}`)
46+
* Base64 looking strings (`[A-Za-z0-9+/]{20,}={0,2}`)
47+
* Tokens appearing only in lockfiles, minified assets, or build output
48+
3. Identify likely typos that should be fixed in source rather than added to the dictionary (e.g., `recieve``receive`). Report these separately for the user to review. <!-- cspell:disable-line -->
49+
4. For each remaining token, decide placement: inline `words` array for project-specific terms, or the appropriate custom dictionary file when one exists and the token fits its category.
50+
51+
### Step 6: Update configuration and dictionaries
52+
53+
1. Add curated tokens to the `words` array or the appropriate custom dictionary file. Preserve original casing and avoid introducing duplicates.
54+
2. Sort the `words` array alphabetically (case-insensitive sort, preserve original case).
55+
3. Sort custom dictionary text files alphabetically with one word per line if they follow that convention.
56+
4. Add or refine `ignorePaths` entries to align with the project's ignore files (`.gitignore`, `.dockerignore`, etc.), but do not ignore source folders containing meaningful code and documentation.
57+
5. Preserve the existing config format and style conventions (indentation, trailing commas, module export structure).
58+
59+
### Step 7: Validate and report
60+
61+
1. Re-run cspell using the same command from Step 4.
62+
2. Report the final counts: files checked, issues found, files with issues.
63+
3. If the issue count has not meaningfully decreased from baseline (target: ≥80% reduction), provide a short rationale and suggest next actions (add more words, fix typos, or add more ignore paths).
64+
4. List any typos identified in Step 5 that should be fixed in source.
65+
66+
## Acceptance criteria
67+
68+
* The cspell configuration includes a comprehensive `ignorePaths` array that excludes generated and vendored folders.
69+
* The `words` array and any custom dictionary files contain the most common project-specific tokens, alphabetized and deduplicated.
70+
* A final cspell run shows a meaningful reduction from the baseline (target ≥80%, or the agent documents the remaining categories with rationale).
71+
72+
## Notes and best practices
73+
74+
* Preserve original casing for tokens (do not normalize to uppercase or lowercase).
75+
* Prefer adding tokens for environment variables, infrastructure outputs, and technology names rather than silencing real typos.
76+
* When in doubt about a token that appears only once in generated files, prefer ignoring the generated file path instead of adding the token.
77+
* For diacritics and special characters (e.g., `Piña`, `José`, `Müller`, `Straße`, `naïve`, `résumé`, `Zürich`), preserve the original forms but consider adding simplified fallbacks only if tests or files use them. <!-- cspell:disable-line -->
78+
* When the project uses a JS/CJS/MJS config format, preserve the module export structure and do not convert to JSON.
79+
* Adapt file-type globs for the spell-check command to the project's languages (e.g., `"**/*.{py,md,yaml,yml}"` for Python projects, `"**/*.{cs,md,json}"` for C# projects).
80+
81+
---
82+
83+
Proceed with the Required Steps to detect, update, and validate the cspell configuration.

collections/experimental.collection.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ Experimental and preview artifacts not yet promoted to stable collections. Items
1010
| **pptx** | Creates, updates, and manages PowerPoint slide decks using YAML-driven content with python-pptx |
1111
| **pptx-subagent** | Executes PowerPoint skill operations including content extraction, YAML creation, deck building, and visual validation |
1212

13+
### Prompts
14+
15+
| Name | Description |
16+
|-------------------|---------------------------------------------------------------------------------------------|
17+
| **cspell-config** | Creates or updates the project cspell configuration with project-specific words and ignores |
18+
1319
### Instructions
1420

1521
| Name | Description |

collections/experimental.collection.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ items:
2525
kind: skill
2626
- path: .github/skills/experimental/vscode-playwright
2727
kind: skill
28+
# Prompts
29+
- path: .github/prompts/experimental/cspell-config.prompt.md
30+
kind: prompt
31+
maturity: experimental
2832
# Instructions
2933
- path: .github/instructions/experimental/experiment-designer.instructions.md
3034
kind: instruction

collections/hve-core-all.collection.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ Use this edition when you want access to everything without choosing a focused c
8282
| **checkpoint** | Save or restore conversation context using memory files |
8383
| **code-review-full** | Run both functional and standards code reviews on the current branch in a single pass |
8484
| **code-review-functional** | Pre-PR branch diff review for functional correctness, error handling, edge cases, and testing gaps |
85+
| **cspell-config** | Creates or updates the project cspell configuration with project-specific words and ignores |
8586
| **doc-ops-update** | Invoke doc-ops agent for documentation quality assurance and updates |
8687
| **dt-canonical-deck** | Unified canonical deck workflow for opt-in offer, snapshot generation/refresh, and optional customer-card PowerPoint build |
8788
| **dt-figma-export** | Export Design Thinking artifacts to a collaborative FigJam board or Figma Design file using the official Figma MCP server |

collections/hve-core-all.collection.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,9 @@ items:
199199
- path: .github/prompts/design-thinking/dt-start-project.prompt.md
200200
kind: prompt
201201
maturity: preview
202+
- path: .github/prompts/experimental/cspell-config.prompt.md
203+
kind: prompt
204+
maturity: experimental
202205
- path: .github/prompts/github/github-add-issue.prompt.md
203206
kind: prompt
204207
- path: .github/prompts/github/github-discover-issues.prompt.md

plugins/experimental/.github/plugin/plugin.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
"agents/experimental/",
77
"agents/experimental/subagents/"
88
],
9+
"commands": [
10+
"commands/experimental/"
11+
],
912
"skills": [
1013
"skills/experimental/"
1114
]

plugins/experimental/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ Experimental and preview artifacts not yet promoted to stable collections. Items
1919
| **pptx** | Creates, updates, and manages PowerPoint slide decks using YAML-driven content with python-pptx |
2020
| **pptx-subagent** | Executes PowerPoint skill operations including content extraction, YAML creation, deck building, and visual validation |
2121

22+
### Prompts
23+
24+
| Name | Description |
25+
|-------------------|---------------------------------------------------------------------------------------------|
26+
| **cspell-config** | Creates or updates the project cspell configuration with project-specific words and ignores |
27+
2228
### Instructions
2329

2430
| Name | Description |
@@ -53,6 +59,12 @@ copilot plugin install experimental@hve-core
5359
| pptx | Creates, updates, and manages PowerPoint slide decks using YAML-driven content with python-pptx |
5460
| pptx-subagent | Executes PowerPoint skill operations including content extraction, YAML creation, deck building, and visual validation |
5561

62+
## Commands
63+
64+
| Command | Description |
65+
|---------------|---------------------------------------------------------------------------------------------|
66+
| cspell-config | Creates or updates the project cspell configuration with project-specific words and ignores |
67+
5668
## Instructions
5769

5870
| Instruction | Description |
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../.github/prompts/experimental/cspell-config.prompt.md

plugins/hve-core-all/.github/plugin/plugin.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"commands/coding-standards/",
2424
"commands/data-science/",
2525
"commands/design-thinking/",
26+
"commands/experimental/",
2627
"commands/github/",
2728
"commands/hve-core/",
2829
"commands/jira/",

plugins/hve-core-all/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ Use this edition when you want access to everything without choosing a focused c
8989
| **checkpoint** | Save or restore conversation context using memory files |
9090
| **code-review-full** | Run both functional and standards code reviews on the current branch in a single pass |
9191
| **code-review-functional** | Pre-PR branch diff review for functional correctness, error handling, edge cases, and testing gaps |
92+
| **cspell-config** | Creates or updates the project cspell configuration with project-specific words and ignores |
9293
| **doc-ops-update** | Invoke doc-ops agent for documentation quality assurance and updates |
9394
| **dt-canonical-deck** | Unified canonical deck workflow for opt-in offer, snapshot generation/refresh, and optional customer-card PowerPoint build |
9495
| **dt-figma-export** | Export Design Thinking artifacts to a collaborative FigJam board or Figma Design file using the official Figma MCP server |
@@ -377,6 +378,7 @@ copilot plugin install hve-core-all@hve-core
377378
| dt-method-next | Assess DT project state and recommend next method with sequencing validation - Brought to you by microsoft/hve-core |
378379
| dt-resume-coaching | Resume a Design Thinking coaching session — reads coaching state and re-establishes context - Brought to you by microsoft/hve-core |
379380
| dt-start-project | Start a new Design Thinking coaching project with state initialization and first coaching interaction - Brought to you by microsoft/hve-core |
381+
| cspell-config | Creates or updates the project cspell configuration with project-specific words and ignores |
380382
| github-add-issue | Create a GitHub issue using discovered repository templates and conversational field collection |
381383
| github-discover-issues | Discover GitHub issues through user-centric queries, artifact-driven analysis, or search-based exploration and produce planning files for review |
382384
| github-execute-backlog | Execute a GitHub backlog plan by creating, updating, linking, closing, and commenting on issues from a handoff file |

0 commit comments

Comments
 (0)