.github/skills/ut-analyst/SKILL.md
Analyze a class or function and produce a structured JSON test plan. Classifies all dependencies (interface, abstract, valueObject, dto, primitive), detects non-deterministic calls, enumerates test cases using black-box techniques (Equivalence Partitioning, Boundary Value Analysis, Decision Table, State Transition), and lists constructor null-guard requirements. Use when asked to analyze a class for testing, create a test plan, classify dependencies, or produce test case inventory. Also invoked as Phase 1 by the unit-test-generator agent.
npx skillsauth add dneprokos/skills-examples ut-analystInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Analyze the source structure, classify all dependencies, detect non-determinism, and produce a structured JSON test plan. This is Phase 1 of the unit test generation pipeline.
Standalone vs. orchestrated — This skill can run independently to produce a test plan for human review or downstream use, or it can be invoked as Phase 1 by the
unit-test-generatoragent, which passes the output to the Architect (Phase 2).
Before analyzing, verify that you have a target class, function, or component. You need one of these:
MyService")If none of these are true, respond with:
Please specify the class or function you want to analyze. You can either:
- Provide the name (e.g., "analyze
MyService")- Open the source file in the editor
- Attach the source file to the conversation
Do not produce a test plan without a concrete target.
.cs → C# | .java → Java | .py → Python | .ts / .tsx → TypeScriptreferences/project-patterns.md — note the project's frameworks, assertion style, and null-exception conventions. This context informs accurate exception type classification (e.g., ArgumentNullException vs NullPointerException vs TypeError)Identify all constructor parameters and classify each as:
interface — declared as an interface typeabstract — declared as an abstract classvalueObject — immutable type with value semantics (e.g., Money, Address, Email)dto — data transfer object / request / response classprimitive — value type or stringDetect non-deterministic calls — scan every method for calls that produce different results on each execution (see table below)
For each public method, enumerate test cases applying black-box techniques (see sections below), including boundary values
For each constructor parameter classified as interface or abstract, add a constructorNullGuards entry specifying the expected exception type
Classify every dependency before any mock strategy is assigned. Never infer mock strategy from the type name alone — classification drives strategy. This constraint exists so the Architect phase has accurate, consistent input.
Apply these techniques systematically to every public method or exported function:
Divide input domains into groups that should behave the same way. Write at least one test per partition. Typical partitions include: valid inputs, invalid inputs, boundary-adjacent values, and special values (null, empty, zero, negative).
Test at the exact boundaries of input domains. For a range [min, max], test: min-1, min, min+1, max-1, max, max+1. For strings: empty string, single char, very long string. For collections: empty, single item, many items.
When a method's behavior depends on combinations of conditions, enumerate the meaningful combinations. Each unique combination of inputs that produces a distinct outcome gets its own test case. Use the language's parameterized test feature to keep these compact.
When the class has internal state that affects behavior (e.g., initialization state, connection status, mode flags), test:
Not every technique applies to every method — use judgment. A simple utility method might only need Equivalence Partitioning and Boundary Value Analysis. A stateful service might need all four.
For each public method or exported function, cover all three categories:
null / None / undefined inputsNaN, InfinityScan the source for calls that produce different results on each execution:
| Category | C# | Java | Python | TypeScript |
| -------------- | ------------------------------------------------------- | -------------------------------------------------------------------- | ------------------------------------- | --------------------------------- |
| Current time | DateTime.Now, DateTime.UtcNow, DateTimeOffset.Now | LocalDateTime.now(), Instant.now(), System.currentTimeMillis() | datetime.now(), datetime.utcnow() | Date.now(), new Date() |
| Random IDs | Guid.NewGuid() | UUID.randomUUID() | uuid4(), uuid.uuid4() | crypto.randomUUID(), uuidv4() |
| Random numbers | new Random(), Random.Shared | new Random(), Math.random() | random.random(), random.randint() | Math.random() |
When a non-deterministic call is detected:
nonDeterministicCalls entry in the JSON plan with the location and call type, plus a stability warning⚠️ This skill does not modify source files automatically. Abstractions are shown as suggestions only.
Emit the complete JSON test plan following the schema in references/analyst-test-plan-schema.md.
If running standalone (not skipReview: true): After emitting the JSON, stop and ask:
"Analyst phase complete. Review the test plan above. Reply 'continue' to proceed to the Architect phase, or provide feedback to adjust the plan."
If skipReview: true (passed by user or orchestrator): Emit the JSON and continue without pausing.
mockStrategy using the deterministic classification rule only (interface/abstract → mock; others → real). Strategic decisions such as non-determinism abstractions or mock overrides are the Architect's responsibilityinterface or abstract constructor parameterdata-ai
Install and configure Windows Credential Manager style secret storage for PowerShell using SecretManagement and SecretStore. Use when users ask to install secret manager support, set up Credential Manager for GitHub token storage, or bootstrap GitHubToken for PR skills.
development
Generate a complete, compilable unit test file from an Analyst test plan and Architect strategy. Uses AAA pattern, language-specific frameworks (NUnit, JUnit 5, pytest, Vitest), correct mock/real dependency instantiation, constructor null-guard tests, parameterized tests, and setup/teardown hooks. Input is the Analyst JSON plan plus Architect strategy summary. Use when asked to generate test code, write test implementation, create test file, or implement tests from a plan. Also invoked as Phase 3 by the unit-test-generator agent.
development
Define the mocking strategy and assertion style for a unit test plan. Classifies each dependency as mock or real, resolves assertion framework and test file location from project patterns, lists constructor null-guard tests with expected exception types, and specifies abstraction interfaces for non-deterministic calls. Input is a JSON test plan from ut-analyst. Use when asked to define mocking strategy, plan test architecture, classify dependencies as mock vs real, or design test structure. Also invoked as Phase 2 by the unit-test-generator agent.
development
Generate token usage reports in table format for different time periods. Use for tracking API token consumption, analyzing usage patterns, monitoring token costs by day/week/month periods.