Core conventions and patterns for ExcelMcp
46
32%
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Passed
No known issues
Optimize this skill with Tessl
npx tessl skill review --optimize ./.squad/skills/project-conventions/SKILL.mdExcelMcp is a Windows-only toolset for programmatic Excel automation via COM interop, with TWO equal entry points: MCP Server (for AI assistants) and CLI (for scripting/agents). .NET/C# codebase.
Core commands NEVER wrap batch.Execute() in try-catch that returns error results. Let exceptions propagate naturally — batch.Execute() handles them via TaskCompletionSource.
// ✅ CORRECT
return await batch.Execute((ctx, ct) => {
// operation
return ValueTask.FromResult(new OperationResult { Success = true });
});
// ❌ WRONG — double-wraps, loses stack context
try { return await batch.Execute(...); }
catch (Exception ex) { return new OperationResult { Success = false, ErrorMessage = ex.Message }; }ALL dynamic COM objects must be released in finally blocks using ComUtilities.Release(ref obj!). NEVER use catch blocks to swallow exceptions.
Success == true ⟹ ErrorMessage == null || ErrorMessage == "". Set Success in try block, always false in catch.
isError: true for business errors; throw McpException for validationAnsiConsole.MarkupLineerror field for compatibility and add richer diagnostics additively (errorMessage, isError, exceptionType, hresult, innerError) instead of renaming contracts in place.ServiceResponse transport first so both entry points receive the same failure detail.[Description("...")] attributes to each exposed parameter that needs to appear in the published schema./// <param> comments are not enough by themselves for MCP client discoverability; verify the live schema with an integration test that calls ListToolsAsync().tests/ExcelMcp.Core.Tests/, tests/ExcelMcp.McpServer.Tests/, tests/ExcelMcp.CLI.Tests/dotnet test tests/ExcelMcp.Core.Tests --filter "Feature=<name>&RunType!=OnDemand"success=false, isError=true, error == errorMessage, expected exceptionType, and scenario-specific presence/absence of errorCategory, hresult, and innerError.1 on business-error paths (for example, missing sheet or invalid input). If the setup command itself returns non-JSON stdout, treat that as startup/harness noise and surface raw stdout/stderr in the helper exception instead of misclassifying it as a contract failure.ServiceAction coverage and current MCP tool docs first.TreatWarningsAsErrors=true with .NET analyzerssrc/ExcelMcp.ComInterop/ — COM patterns, STA threading, sessions
src/ExcelMcp.Core/ — Excel business logic, commands
src/ExcelMcp.Service/ — Session management, command routing
src/ExcelMcp.McpServer/ — MCP protocol tools
src/ExcelMcp.CLI/ — Command-line interface
src/ExcelMcp.Generators*/ — Source generators
tests/ — Integration tests (no unit tests)
skills/shared/ — Single source of truth for docs/promptsBefore classifying a formatting bug as missing functionality, check both range and range_format.
range owns value/formula-adjacent display formats such as set-number-formatrange_format owns visual styling and layout actions such as format-range, auto-fit-columns, and auto-fit-rowsIf the capability already exists under one of those tools, treat it as a discoverability/API-shape issue first, not a backend feature gap.
For real batching work, prefer existing list-of-objects patterns over ad hoc JSON blobs. IRangeEditCommands.Sort(... List<SortColumn> ...) is a precedent that the shared surface can carry structured collections cleanly.
queryTable.Refresh(false) (synchronous).IClassFixture<T> AND [Collection("...")].set-values fails with ArgumentOutOfRangeException, inspect for jagged List<List<object?>> input before blaming COM.Before assigning a bug to Core, check three things in order:
Use this especially for reports that claim a hard product limit or a missing feature. Wide-range failures and formatting gaps are often mis-triaged when tests or tool surfaces already cover the scenario elsewhere.
468809e
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.