agentleFS
Microsoft AzureKnown publisherAzure/azure-dev/cli/azd/extensions/skills/azd-extension-unit-testing/SKILL.md

azd-extension-unit-testing

Skill573 starsChanged 26 days agoMITView on GitHub

Write, update, and statically review feature-aligned Go unit tests for azure.ai.agents, azure.ai.connections, azure.ai.inspector, azure.ai.projects, azure.ai.routines, azure.ai.skills, and azure.ai.toolboxes. USE FOR: unit test cases, regression tests, acceptance-criteria mapping, mock assertions, and unit coverage gaps. Establish expected behavior from requirements, not the implementation alone. DO NOT USE FOR: CLI subprocess tests, recorded HTTP playback, live integration, E2E, CI changes, or skill migration.

The file

Show its rules and text

We split this skill into the rules it gives an agent

23 rules. About 0 are common, 23 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈23

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Do not add dependencies, change CI, migrate skills, or modify production behavior unless separately requested.

    line 26
  2. Distinctive:

    Read the implementation to locate the behavior and test seams, not to derive the expected answer from whatever the implementation currently …

    line 38
  3. Distinctive:

    If requirements are clear, proceed.

    line 42
  4. Distinctive:

    If the user asks only for a test plan or review, do not implement tests.

    line 44
  5. Distinctive:

    Call the relevant production logic in-process.

    line 52
  6. Distinctive:

    Do not mock the function under test or assert only a value configured on a mock.

    line 54
  7. Distinctive:

    Do not contact Azure, use developer credentials, create resources, replay HTTP recordings, or launch azd/extension binaries.

    line 55
  8. Distinctive:

    Use synthetic inputs and existing in-memory fixtures.

    line 57
  9. Distinctive:

    If the required claim needs a real process or service, report that it belongs to another test level rather than silently expanding this …

    line 60
  10. Distinctive:

    Use Arrange / Act / Assert and behavior-based test names.

    line 65
  11. Distinctive:

    Verify meaningful interactions, such as no mutation request after validation fails.

    line 71
  12. Distinctive:

    Check structured output semantically.

    line 73
  13. Distinctive:

    When applicable, cover explicit flag conflicts, defaults, tenant selection, redaction, cancellation/timeout decisions, and local state …

    line 75
  14. Distinctive:

    Use realistic response shapes and make unexpected mock calls fail.

    line 78
  15. Distinctive:

    Do not share mutable user configuration or depend on test order.

    line 91
  16. Distinctive:

    Use the repository's temporary-directory and cleanup helpers.

    line 92
  17. Distinctive:

    Avoid arbitrary sleeps and unbounded retries.

    line 94
  18. Distinctive:

    Keep secrets and customer data out of fixtures and failure output.

    line 96
  19. Distinctive:

    Do not weaken assertions, change expected results, or add skips merely to match a product defect.

    line 97
  20. Distinctive:

    Test authoring: Run the smallest relevant tests using the repository's configured runner.

    line 102
  21. Distinctive:

    Check module boundaries, build tags, and platform constraints.

    line 113
  22. Distinctive:

    When reporting coverage, state the tested module, revision, platform, and exclusions.

    line 115
  23. Distinctive:

    Do not claim owner approval, CI execution, or complete coverage without evidence.

    line 122

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

AZD Extension Unit Testing

Purpose and boundaries

Detect feature regressions through focused, deterministic unit tests. Higher coverage is not a substitute for meaningful assertions.

Work only on the requested feature and extension. Read applicable AGENTS.md and existing tests first. Reuse the module's framework, mocks, and helpers. Do not add dependencies, change CI, migrate skills, or modify production behavior unless separately requested. Report defects exposed by a tests-only task.

Review-only tasks, including PR/code reviews, are static-only: inspect code and supplied evidence without editing files, building, running tests, installing tools, or executing PR code. Execution guidance below applies only to test-authoring tasks and never overrides a reviewer's read-only restrictions.

1. Define the expected behavior

  • Identify the user goal and its requirement source: acceptance criteria, test plan, issue/specification, documented contract, or existing supported behavior.
  • Read the implementation to locate the behavior and test seams, not to derive the expected answer from whatever the implementation currently does.
  • State the relevant Given / When / Then: preconditions, action, result, and any forbidden side effects. Keep this brief; no separate plan file is required.
  • If requirements are clear, proceed. If a material expectation is missing or conflicts with current behavior, ask for clarification instead of inventing it.
  • If the user asks only for a test plan or review, do not implement tests.

Choose cases by impact and the change: success, relevant invalid inputs, boundary conditions, error propagation, and state transitions. Do not generate a full parameter matrix or add tests solely to increase coverage.

2. Keep the test at unit scope

  • Call the relevant production logic in-process. Mock or fake external boundaries such as Azure clients, credentials, the clock, or process execution as needed.
  • Do not mock the function under test or assert only a value configured on a mock.
  • Do not contact Azure, use developer credentials, create resources, replay HTTP recordings, or launch azd/extension binaries.
  • Use synthetic inputs and existing in-memory fixtures. Where file behavior requires real files, use isolated temporary directories and describe that boundary; do not claim this proves the installed CLI works.
  • If the required claim needs a real process or service, report that it belongs to another test level rather than silently expanding this task.

3. Assert the feature contract

  • Use Arrange / Act / Assert and behavior-based test names. Use Go table-driven cases when they improve clarity, not to hide unrelated behaviors in one test.
  • Derive expected values independently. Do not use the same production logic for both the actual result and the expected result.
  • Assert relevant values, error codes/content, state, and side effects. "No error," "no panic," or nonempty output alone rarely proves a feature.
  • Verify meaningful interactions, such as no mutation request after validation fails. Avoid private call-order assertions unless ordering is the contract.
  • Check structured output semantically. Require exact text only when exact wording is a supported contract.
  • When applicable, cover explicit flag conflicts, defaults, tenant selection, redaction, cancellation/timeout decisions, and local state cleanup. Do not treat these as mandatory cases for unrelated features.
  • Use realistic response shapes and make unexpected mock calls fail.

Example contract: Given conflicting inputs to azd ai agent invoke, input validation returns the defined error and does not call the service client. Exercise the in-process validation/action; do not deploy an agent for this test. Confirm the actual command contract before choosing the conflicting inputs.

For AI-authored tests, check whether a plausible wrong result would still pass. A constant result, ignored input, swallowed error, or skipped side effect should be rejected when it violates the selected scenario.

4. Keep tests independent and maintainable

  • Do not share mutable user configuration or depend on test order.
  • Use the repository's temporary-directory and cleanup helpers. Restore modified process state; do not combine global environment mutation with parallel tests.
  • Avoid arbitrary sleeps and unbounded retries. Use fake time or controlled state transitions where timing is part of the behavior.
  • Keep secrets and customer data out of fixtures and failure output.
  • Do not weaken assertions, change expected results, or add skips merely to match a product defect. Harmless internal refactors should not break tests.

5. Verify or review the evidence

  • Test authoring: Run the smallest relevant tests using the repository's configured runner. Record the exact command and outcome. For a bug regression, verify failure on the unfixed behavior and success after the fix when safely feasible; do not disturb unrelated work to obtain this evidence.
  • Review only: Inspect assertions, mocks, CI selection, and existing evidence statically. Do not execute code to obtain missing evidence. Assess whether failure-before/success-after evidence was supplied without claiming independent verification. Return only relevant findings in the host reviewer's required format; do not add a separate evidence summary.
  • A compile error, missing fixture/tool, or environment failure is not evidence that an assertion detects the intended defect.
  • Check module boundaries, build tags, and platform constraints. A local pass does not prove CI selects the test; nested Go modules may need separate runs.
  • When reporting coverage, state the tested module, revision, platform, and exclusions. Use it to identify relevant gaps, not to claim functional completeness or average unrelated package percentages.

Test-authoring summary: State the requirement/scenario covered, assertions added, commands run and results, skipped or unverified cases, and whether the CI configuration selects the tests. This summary does not apply to review mode. Do not claim owner approval, CI execution, or complete coverage without evidence.

References

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.