Agent365-devTools
CLAUDE.md61 starsChanged 6 months agoMITView on GitHub
Microsoft Agent 365 DevTools CLI (a365) - A .NET CLI tool built on .NET 8.0 with support for running on .NET 8.0 or higher (e.g., .NET 9, 10). Used for deploying and managing Microsoft Agent 365 applications on Azure. Supports .NET, Node.js, and Python applications with auto-detection. Test Framework: xUnit with FluentAssertions and NSubstitute Test Location: src/Tests/Microsoft.Agents.A365.DevTools.Cli.Tests/ Parallel Test Execution: Tests modifying environment variables or shared resources must disable parallelization:
In this repository3 other files it gives its agents.
- .github/copilot-instructions.mdCopilot instructions
- review-prSkill
- review-stagedSkill
The file
Show its rules and text
We split this CLAUDE.md into the rules it gives an agent
14 rules. About 0 are common, 8 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 108
No emojis in code, comments, logs, or output
- Very specific: line 117
Keep an issue/PR reference ((issue #460)) but drop the surrounding narration.
- Distinctive: line 118
Never narrate the change ("previously we did X, now Y because...") — that is commit-message content.
- Very specific: line 157
Every failure path in a command handler must set context.ExitCode = 1 before returning or continuing.
- Distinctive: line 160
Verify the post-loop summary block covers all zero-export cases, not just the auto-discovery case
- Distinctive: line 174
When a transformation (redaction, sanitization, encoding) is applied to a value, identify every place that same value is written and apply …
- Distinctive: line 176
After writing redaction or sanitization logic, ask: "where else does this raw value appear in the output?"
- Very specific: line 180
Use centralized error codes from Constants/ErrorCodes.cs
- Very specific: line 181
Use centralized messages from Constants/ErrorMessages.cs
- Distinctive: line 208
Check for "Kairo" keyword - flag for review if found
- Distinctive: line 209
Verify Microsoft copyright header on all .cs files
- Distinctive: line 210
Ensure SOLID principles are followed
- Very specific: line 215
Exit code completeness: Every failure branch in a command handler (including continue inside loops) sets context.ExitCode = 1
- Very specific: line 217
Command handler branch tests: Every new SetHandler command handler must have invocation tests covering: invalid input → exit code 1, …
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md 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.
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
Microsoft Agent 365 DevTools CLI (a365) - A .NET CLI tool built on .NET 8.0 with support for running on .NET 8.0 or higher (e.g., .NET 9, 10). Used for deploying and managing Microsoft Agent 365 applications on Azure. Supports .NET, Node.js, and Python applications with auto-detection.
Build Commands
# Install CLI locally (from repo root)
.\scripts\cli\install-cli.ps1
# Manual build and install
cd src/Microsoft.Agents.A365.DevTools.Cli
dotnet clean
dotnet build -c Release
dotnet pack -c Release --no-build
dotnet tool install -g Microsoft.Agents.A365.DevTools.Cli --add-source ./bin/Release --prerelease
# Restore all dependencies
cd src
dotnet restore dirs.proj
dotnet restore tests.proj
# Build all projects
dotnet build dirs.proj --configuration ReleaseTest Commands
# Run all tests
cd src
dotnet test tests.proj --configuration Release
# Run specific test class
dotnet test --filter "FullyQualifiedName~SetupCommandTests"
# Run with coverage
dotnet test --collect:"XPlat Code Coverage"Test Framework: xUnit with FluentAssertions and NSubstitute
Test Location: src/Tests/Microsoft.Agents.A365.DevTools.Cli.Tests/
Parallel Test Execution: Tests modifying environment variables or shared resources must disable parallelization:
[CollectionDefinition("EnvTests", DisableParallelization = true)]
public class EnvTestCollection { }
[Collection("EnvTests")]
public class MyTests { }Architecture
Project Structure
src/Microsoft.Agents.A365.DevTools.Cli/
├── Commands/ # CLI command implementations (AsyncCommand<Settings>)
├── Services/ # Business logic (ConfigService, DeploymentService, etc.)
├── Models/ # Data models (Agent365Config, etc.)
├── Constants/ # Centralized error codes, messages, auth constants
├── Exceptions/ # Custom exceptions
├── Templates/ # Embedded resources (manifest.json, icons)
└── Helpers/ # Helper utilitiesKey Patterns
- Command Pattern: Commands inherit from
AsyncCommand<Settings>, return exit codes (0=success) - Configuration Architecture (Two-file design):
a365.config.json- Static, user-managed, version-controlleda365.generated.config.json- Dynamic, CLI-managed, gitignoredAgent365Configmodel has init-only (static) and get/set (dynamic) properties
- Platform Builder Strategy:
IPlatformBuilderinterface with implementations for DotNet, Node, Python - Dependency Injection: ServiceCollection in Program.cs with singletons for stateless services
Key Services
ConfigService- Configuration load/merge/save with environment variable overridesDeploymentService- Multiplatform deployment orchestrationPlatformDetector- Auto-detect project type (.NET/Node/Python)AuthenticationService- MSAL.NET for Azure and Graph authenticationGraphApiService- Microsoft Graph API interactions
Code Standards
Required Copyright Header (all .cs files)
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.Naming Conventions
- Commands:
{Verb}Command.cs - Services:
{Noun}Service.csor{Noun}Configurator.cs - Tests:
{ClassName}Tests.cs - Private fields:
_camelCase - Public properties:
PascalCase
Code Quality
- No emojis in code, comments, logs, or output
- Nullable reference types enabled (strict null checking)
- Warnings treated as errors
- All
IDisposableobjects must be disposed (especiallyHttpResponseMessage) - Cross-platform compatibility required (Windows, macOS, Linux)
Comments
Comments are crisp: state why in one line, not what the code already shows. Do not write essays.
- A code comment (
//or///<summary>) is one or two lines. If you need a paragraph of rationale, it belongs in the commit message or PR description, not in source. - Keep an issue/PR reference (
(issue #460)) but drop the surrounding narration. - Never narrate the change ("previously we did X, now Y because...") — that is commit-message content.
- Trivial mechanical edits (log-level change, blank-line separator,
catch { throw; }) get zero or one line, never a rationale block.
// Bad: essay restating the change and its history
// Issue #460: when inheritable permissions were configured with kind=allAllowed (covering both
// scopes and roles) AND the blueprint SP was granted the app roles, the agent identity inherits
// them automatically — the same basis the OBO branch relies on. A direct grant then only adds a
// duplicate row and a spurious prompt, so we skip it and report the inherited grant as Granted.
// Good: one-line why + reference
// Skip the direct grant when the role is already inherited from the blueprint (issue #460).CHANGELOG entries
CHANGELOG.md [Unreleased] ships verbatim to nuget.org release notes. Each entry is one crisp consumer-facing sentence about the user-visible change — no class/method names, no implementation mechanism, no multi-sentence rationale. Keep the (#NNN) reference. When a change makes a sibling entry stale, fix it in the same edit.
Input Validation
User-controlled input that reaches file system operations must be validated before use. This applies to CLI arguments, config values read from disk, and any value whose origin is outside this process.
- Validate against an explicit allowlist pattern (e.g.
^[a-z0-9-]+$) before interpolating into file names or paths - Reject inputs containing path separators,
..segments, or characters outside the allowed set - Apply
ArgumentException.ThrowIfNullOrWhiteSpacefor string parameters where an empty or whitespace value would cause a silent failure — a non-nullable type alone is insufficient - CLI
Option<string?>values default to null when omitted but can be explicitly passed as empty or whitespace by the user — checkIsNullOrWhiteSpaceon option values before use, and emit a targeted error rather than falling through to a confusing downstream failure (e.g.Directory.Exists(""))
// Correct: validate user input before using it in a path
if (!Regex.IsMatch(commandName, @"^[a-z0-9-]+$"))
{
logger.LogError("Invalid command name '{Name}'. Use lowercase letters, digits, and hyphens only.", commandName);
context.ExitCode = 1;
return;
}
// Correct: guard non-nullable string parameters against empty/whitespace
ArgumentException.ThrowIfNullOrWhiteSpace(generatedConfigPath);CLI Command Exit Codes
Every failure path in a command handler must set context.ExitCode = 1 before returning or continuing. This includes continue statements inside loops, not just top-level return statements.
- Trace every branch —
if (!condition) { log; continue; }is a failure path and needsExitCode = 1 - Verify the post-loop summary block covers all zero-export cases, not just the auto-discovery case
// Wrong: warning logged but ExitCode left at 0
logger.LogWarning("No log found for '{Name}'.", name);
continue;
// Correct: set exit code before every failure exit
logger.LogWarning("No log found for '{Name}'.", name);
context.ExitCode = 1;
continue;Data Flow Consistency
When a transformation (redaction, sanitization, encoding) is applied to a value, identify every place that same value is written and apply the transformation consistently. Header lines, log output, and file names are common places where the same data appears a second time without the transformation.
- After writing redaction or sanitization logic, ask: "where else does this raw value appear in the output?"
- The source file path, for example, may appear both in log content and in a header — both need the same redaction pass
Error Handling
- Use centralized error codes from
Constants/ErrorCodes.cs - Use centralized messages from
Constants/ErrorMessages.cs - Structured logging with
ILogger<T>and named placeholders
Package Management
Central NuGet package management in src/Directory.Packages.props. Key dependencies:
- System.CommandLine v2.0.0-beta4
- Microsoft.Identity.Client (MSAL.NET)
- Azure.ResourceManager.* (Azure SDK)
- Microsoft.Graph (Graph API)
- ModelContextProtocol (MCP support)
Architecture Documentation
- docs/design.md - Repository-level architecture, patterns, decisions
- src/Microsoft.Agents.A365.DevTools.Cli/design.md - CLI project architecture, configuration system
- src/Microsoft.Agents.A365.DevTools.MockToolingServer/design.md - Mock MCP server architecture
- src/DEVELOPER.md - How to develop, build, test, contribute
Key Documentation
- Agent 365 CLI reference - CLI usage guide with examples
.github/copilot-instructions.md- Code standards and review rulesdocs/commands/- Index/pointers to CLI command documentation on Microsoft Learn
Code Review Checklist
- Check for "Kairo" keyword - flag for review if found
- Verify Microsoft copyright header on all .cs files
- Ensure SOLID principles are followed
- Resource disposal for all IDisposable objects
- Cross-platform compatibility
- Input validation: Any CLI argument or external value used in a file path or file name is validated against an allowlist pattern before use
- Value safety: String parameters that must be non-empty use
ArgumentException.ThrowIfNullOrWhiteSpace, not just a non-nullable type - Exit code completeness: Every failure branch in a command handler (including
continueinside loops) setscontext.ExitCode = 1 - Data flow consistency: Any transformation applied to a value (redaction, sanitization) is applied everywhere that value is written — including headers, summaries, and log lines, not just the primary content
- Command handler branch tests: Every new
SetHandlercommand handler must have invocation tests covering: invalid input → exit code 1, missing resource → exit code 1, bad output path → exit code 1, and successful path → exit code 0 with expected side effect (file written, message logged)
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
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.

