Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 0 additions & 28 deletions .claude-plugin/marketplace.json

This file was deleted.

1 change: 0 additions & 1 deletion AGENTS.md

This file was deleted.

1 change: 0 additions & 1 deletion CLAUDE.md

This file was deleted.

182 changes: 182 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Repository Overview

The FinOps Toolkit is an open-source collection of tools for adopting and implementing FinOps capabilities in the Microsoft Cloud. It contains templates, PowerShell modules, workbooks, optimization engines, and supporting documentation organized in a modular architecture.

## Common Commands

### Building and Development

```bash
# Build entire toolkit
npm run build
# or
pwsh -Command ./src/scripts/Build-Toolkit

# Build FinOps hubs
pwsh -Command ./src/scripts/Build-Toolkit finops-hub

# Build specific components
npm run build-ps # PowerShell module only
pwsh -Command ./src/scripts/Build-Bicep # Bicep templates
pwsh -Command ./src/scripts/Build-Workbook # Azure Monitor workbooks
pwsh -Command ./src/scripts/Build-OpenData # Open data files

# Deploy for testing
npm run deploy-test
# or
pwsh -Command ./src/scripts/Deploy-Toolkit -Build -Test

# Package for release
npm run package
# or
pwsh -Command ./src/scripts/Package-Toolkit -Build
```

### Testing

```bash
# Run PowerShell unit tests
npm run pester
# or
pwsh -Command Invoke-Pester -Output Detailed -Path ./src/powershell/Tests/Unit/*

# Run integration tests
pwsh -Command ./src/scripts/Test-PowerShell -Integration

# Run specific test categories
pwsh -Command ./src/scripts/Test-PowerShell -Hubs -Exports

# Lint PowerShell code
pwsh -Command ./src/scripts/Test-PowerShell -Lint
```

### Bicep Development

```bash
# Validate Bicep templates
bicep build path/to/template.bicep --stdout

# Test template deployment
az deployment group what-if --resource-group myRG --template-file template.bicep
```

## Architecture and Code Organization

### High-Level Structure

- **`/src/templates/`** - ARM/Bicep infrastructure templates with modular namespace organization
- **`/src/powershell/`** - PowerShell module with public/private functions and comprehensive tests
- **`/src/optimization-engine/`** - Azure Optimization Engine for cost recommendations
- **`/src/workbooks/`** - Azure Monitor workbooks for governance and optimization
- **`/src/open-data/`** - Reference data (pricing, regions, services) with utilities
- **`/src/scripts/`** - Build automation and development tools
- **`/docs/`** - Jekyll documentation website
- **`/docs-mslearn/`** - Microsoft Learn documentation website
- **`/docs-wiki/`** - GitHub wiki documentation

### Current Architectural Reorganization

The FinOps hubs solution is actively migrating to a namespace-based modular structure:

- **`Microsoft.FinOpsHubs/`** - Core FinOps Hub infrastructure modules
- **`Microsoft.CostManagement/`** - Cost management exports and schemas
- **`fx/`** - Shared foundation components (hub-types, scripts, utilities)

### Template Architecture

Templates use a multi-target build system that generates:

- Azure Quickstart Templates (ARM JSON)
- Bicep Registry modules
- Standalone deployments
- Azure portal UI definitions

Key patterns:

- **`.build.config`** files control build behavior per template
- **`settings.json`** contains component-specific configuration
- **`ftkver.txt`** files maintain version synchronization
- **Conditional resource deployment** based on parameters

### PowerShell Module Structure

- **`Public/`** - User-facing cmdlets (Get-_, Set-_, New-\*, etc.)
- **`Private/`** - Internal utilities and helpers
- **`Tests/Unit/`** - Pester unit tests with mocking
- **`Tests/Integration/`** - End-to-end Azure integration tests
- **Module manifest** defines exports and dependencies

### Data Flow and Integration

- **Open data** provides reference information consumed by templates and PowerShell
- **Build scripts** orchestrate compilation across all components
- **Version management** is centralized through `Update-Version.ps1`
- **Templates reference** shared schemas and types from `fx/` namespace

## Key Development Patterns

### Template Development

- Use `newApp()` and `newHub()` functions from `fx/hub-types.bicep` for consistent resource naming
- Follow the conditional deployment pattern: `resource foo 'type' = if (condition) { ... }`
- Implement proper parameter validation with `@allowed`, `@minValue`, `@maxValue`
- Include telemetry tracking via `defaultTelemetry` parameter

### PowerShell Development

- All public functions must have comment-based help
- Use approved verbs from `Get-Verb`
- Implement comprehensive parameter validation
- Support `-WhatIf` and `-Confirm` for destructive operations
- Include Pester tests for all functions

### Testing Strategy

- **Lint tests** validate syntax and coding standards
- **Unit tests** test isolated function behavior with mocks
- **Integration tests** perform end-to-end validation against Azure
- **Template validation** uses `bicep build` and ARM what-if deployments

### Build System Integration

The PowerShell-based build system:

- Compiles templates to multiple target formats
- Validates all code before packaging
- Maintains version consistency across components
- Generates release artifacts automatically

### Version Management

- Central version in `package.json` (currently 12.0.0)
- Synchronized across all components via build scripts
- Individual `ftkver.txt` files distributed to modules
- Git tags correspond to release versions

## Repository Conventions

### Branch Strategy

- **`dev`** - Main integration branch
- Feature branches merge into `dev`
- Releases are tagged from `dev`

### File Organization

- Templates follow namespace/module/component structure
- PowerShell follows standard module layout
- Documentation uses Jekyll conventions
- Build artifacts are generated, not checked in

### Coding Standards

- Always follow the content and coding standards defined in `docs-wiki/Coding-guidelines.md`
- Content (text strings): Follow the Microsoft style guide and always use sentence casing except for proper nouns
- Bicep: Follow Azure Bicep style guide
- PowerShell: Use PowerShell best practices and approved verbs
- Documentation: Use markdown with consistent formatting
- Commit messages: Use conventional commit format
9 changes: 1 addition & 8 deletions docs-mslearn/toolkit/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: FinOps toolkit changelog
description: Review the latest features and enhancements in the FinOps toolkit, including updates to FinOps hubs, Power BI reports, and more.
author: MSBrett
ms.author: brettwil
ms.date: 02/24/2026
ms.date: 02/25/2026
ms.topic: reference
ms.service: finops
ms.subservice: finops-toolkit
Expand Down Expand Up @@ -54,13 +54,6 @@ The following section lists features and enhancements that are currently in deve

## v14

### Claude Code plugin v1.0

- **Added**
- Added Claude Code plugin with skills for FinOps hubs and Azure Cost Management.
- Added 4 agents (CFO, FinOps practitioner, database query, hubs agent), 4 commands, and an output style.
- Moved KQL query catalog from `src/queries/` into the plugin.

### [FinOps hubs](hubs/finops-hubs-overview.md) v14

- **Fixed**
Expand Down
2 changes: 1 addition & 1 deletion src/queries/catalog/costs-enriched-base.kql
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
// for FinOps reporting, allocation, and optimization.
//
// For full schema and column definitions, see:
// See finops-hub-database-guide.md#column-definitions in the queries reference directory
// https://raw.githubusercontent.com/microsoft/finops-toolkit/refs/heads/msbrett/features/ghc/src/queries/finops-hub-database-guide.md#column-definitions
// ============================================================================

let startDate = startofmonth(ago(30d));
Expand Down
6 changes: 3 additions & 3 deletions src/queries/catalog/quarterly-cost-by-resource-group.kql
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// ============================================================================
// Query: Top N Quarterly Cost by Resource Group
// Description:
// Returns the top N cost rows (by resource group, subaccount, and month) over the last quarter (3 months).
// Each row represents one resource group in one month — useful for identifying the highest single-month cost drivers.
// Returns the top N resource groups by total effective cost over the last quarter (3 months).
// Includes monthly breakdown and subaccount context for each resource group.
// Author: FinOps Toolkit
// Parameters:
// N: Number of top resource groups to return (default: 5)
// startDate: Start date for the reporting period (e.g., startofmonth(ago(90d)))
// endDate: End date for the reporting period (e.g., startofmonth(now()))
// Output:
// Each row is a (resource group, subaccount, month) combination with its total effective cost.
// Each row represents a resource group, subaccount, and month with its total effective cost.
// Usage:
// Use this query to identify major cost drivers and trends at the resource group level for quarterly reporting.
// Last Tested: 2025-05-17
Expand Down
4 changes: 2 additions & 2 deletions src/queries/finops-hub-database-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ The FinOps hubs database is designed to support advanced cost and usage analytic

## Query Best Practices

- **Start with the [`costs-enriched-base`](./catalog/costs-enriched-base.kql) query:**
Use this query as your base for any cost or usage analytics. It provides the full enrichment and savings logic for all cost columns and is the recommended foundation for custom analytics and reporting.
- **Start with the CostsPlus Query:**
Use the provided CostsPlus query as your base for any cost or usage analytics. This ensures you benefit from the latest schema, enrichment logic, and FinOps best practices.

- **Use KQL (Kusto Query Language):**
All queries should be written in KQL for compatibility with Azure Data Explorer.
Expand Down
3 changes: 0 additions & 3 deletions src/templates/claude-plugin/.build.config

This file was deleted.

23 changes: 0 additions & 23 deletions src/templates/claude-plugin/.claude-plugin/plugin.json

This file was deleted.

Loading