/unity-coding-skills:find-and-setup-analysis-rule [pattern or analyzer-name]from unity-coding-skills
Finds and sets up a Roslyn analyzer, IDE inspection, or plugin to flag a coding pattern in Unity projects at warning or higher severity. Use to enforce coding rules, ban APIs, or prevent recurring bugs.
Ships in unity-coding-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Finds an analysis rule that flags a coding pattern as the code is written, and sets it up in the Unity project. An analysis rule is an IDE inspection or a Roslyn analyzer rule, and a diagnostic is what it reports on the code it flags.
Take the coding pattern from the pattern argument: a description, the code the analysis rule should flag, and optionally the code it should not, e.g., the code before and after a bug fix.
Combine the argument with the coding pattern in the conversation, if any; when the argument is omitted, take it from the conversation alone.
A named API, e.g., "ban GameObject.Find", is the code to flag.
If the code to flag is missing, or the input fits several patterns, use AskUserQuestion to ask the user before proceeding.
When the input names a Roslyn analyzer package to install, e.g., "install BannedApiAnalyzers", take the package instead of a coding pattern: skip Step 1, and in Step 2 propose installing it per Roslyn Analyzer Package. Leave every rule at its default severity unless the user specifies one; set a specified severity per Configuration.
Choose the option whose diagnostic meets the user's need, by where each option diagnoses:
error severity it stops code that would, e.g., freeze at run time, before a test runs it (see Severity)/resolve-diagnostics runs: that skill collects the diagnostics from Rider, at the severities .editorconfig setsLook into the options in whatever order fits the pattern; when several have an analysis rule that flags the code to flag and meet the need equally, choose the earliest listed.
Each of these analysis rules takes precedence over every other rule for its pattern. When the pattern matches one, propose it in Step 2 without searching the lists of rules below; set it up per its option below.
RS0030 of BannedApiAnalyzers.Unity, a Roslyn analyzer package; read ${CLAUDE_SKILL_DIR}/resources/banned-api-analyzers-unity.mdswitch statement over an enum that does not list every enum value — a value added to the enum later falls silently into default, or into no branch at all; IDE inspections:
resharper_switch_statement_handles_some_known_enum_values_with_default_highlighting flags a switch that lists some enum values and handles the rest in default; it catches a case left unadded when a value is added to the enumresharper_switch_statement_missing_some_enum_cases_no_default_highlighting flags a switch without default that misses some enum valuesSearch each list of rules in its own general-purpose subagent, launched in parallel, so that the lists stay out of this context.
Give each subagent the URL of the list and the coding pattern, with the code to flag and the code not to flag.
Have it read the whole list, in parts when the page is long (e.g., WebFetch with offset), then the documentation of each rule that may match, and return only the rules that flag the code to flag — each with its ID, what it flags, and its URL — or that the list has none.
Read ${CLAUDE_SKILL_DIR}/resources/roslyn-analyzer-package.md first: it lists the known analyzer packages with what each flags, and tells how to choose a version of a package and install it.
Search the lists of rules of the known analyzer packages that may cover the pattern; when several packages flag the code to flag, prefer one the project already has. Find the installed ones by the installation method:
org.nuget.<package ID in lowercase> entries in Packages/manifest.json; also com.nowsprinting.test-framework.analyzers, which bundles NUnit.Analyzerspackages.config (by default in Assets/)When neither has an analyzer package, the project has none.
Search Code Inspections in C# | ReSharper, which lists every configurable inspection, each with its EditorConfig property (resharper_<name>_highlighting).
A plugin adds an inspection that the IDE lacks. These are the known plugins, for Rider:
A method whose complexity exceeds a threshold — propose cognitive complexity when the user says just "complexity":
Each reports a warning on a method above the threshold, which the user sets on the plugin's options page.
Only the user can install a plugin: propose it with its link, and in Step 3 ask the user to install it. Tell the user that every team member has to install it to see the diagnostic.
When no other option detects the pattern, propose writing an analyzer in the Unity project — the rule, with the code it should flag and should not — rather than setting it up: that is the user's decision. TestHelper.UI.Analyzers~ is an example to model it on:
Assets/; only a UPM package project, which has no place outside the package, puts it in a ~-suffixed directory, which Unity's asset importer ignores, as the example does.asmdef of the assemblies it diagnosesMicrosoft.CodeAnalysis.Testing, runnable without UnityMicrosoft.CodeAnalysis referenced at the version the project's Unity loads (see Choosing a Version in ${CLAUDE_SKILL_DIR}/resources/roslyn-analyzer-package.md)design-diagnostic) and implement (implement-diagnostic) a rule test-first, under .claude/skills/Present to the user, via AskUserQuestion:
Apply the changes the user approves. Then ask the user to:
Set the severity the user specifies; when the user specifies none for a rule found in Step 1, set warning or error: /resolve-diagnostics handles only warning or higher severity.
Two files take the severity of an analysis rule.
Choose the one that fits the files the project already has, with one exception: only .globalconfig meets a request to fail the compilation before the tests run, or to change the severity in Unity's compiler.
.editorconfig — for an IDE inspection or an analyzer rule; it applies in the IDE only:
[*.cs]
resharper_switch_statement_missing_some_enum_cases_no_default_highlighting = warning
dotnet_diagnostic.RS0030.severity = warning
Tell the user that a Rider inspection appears in Rider only: team members on other IDEs do not see it.
.globalconfig — for an analyzer rule; it applies in Unity's compilation too, which fails on an error:
is_global = true
dotnet_diagnostic.RS0030.severity = error
Assets/Default.globalconfig applies to the whole project.
A .globalconfig next to an .asmdef applies to that assembly only, which then reads nothing from Default.globalconfig: copy into it the entries the assembly still needs.
A .globalconfig has no sections by file type or path.
A Unity version without .globalconfig support takes a .ruleset file instead (see Analyzer scope and rule set files).
Choose the version of the package and install it per ${CLAUDE_SKILL_DIR}/resources/roslyn-analyzer-package.md.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub nowsprinting/unity-coding-skills --plugin unity-coding-skills12 skills in this plugin
/code-writing-guideProvides coding guidelines for Unity projects. Make sure to use this skill whenever writing, creating, editing, or modifying code files. This includes implementing new features, fixing bugs, refactoring, adding tests, or any task that results in code changes. Even for small edits or one-line fixes, load this skill to ensure project conventions are followed./design-testsDesigns tests from a specification, whatever document states it — a requirements document, design docs, or an ADR: extracts the test targets, then creates test cases for each target at the test level of its subject — e.g., integration tests for a scene or prefab, unit tests for a class's API. Use this skill whenever the specification is settled and the next step is to design the tests./edit-sceneCreates and modifies Unity scene and prefab files. Use this skill whenever creating, editing, or modifying .unity scene files or .prefab prefab files. This includes adding GameObjects, building uGUI hierarchies, wiring up components, and any task that results in changes to .unity or .prefab files./fix-bugDiagnoses and fixes bugs using a test-first workflow (reproduce, diagnose, fix). Use this skill whenever the user reports a bug, describes unexpected behavior, or asks to investigate or fix a defect./implementImplements a feature or a specification change test-first, phase by phase from the parts with no dependencies up: each phase designs its missing test cases, then writes failing tests and the production code that passes them. Use this skill whenever the user asks to implement or add a feature, or to change an existing specification./measure-spec-coverageMeasures the specification coverage of one specification document: models its specifications with test techniques into coverage items, then checks off each coverage item a test verifies, finding the tests by the `// Test-basis:` comments in test files. Use this skill when the user asks how well a specification is tested, or which of its behaviors no test verifies.Other plugins' skills for the same job