Skip to main content
rule CX Codex

code-signing — Claude Code rule: what it does, how to install

Enforces .NET code signing patterns and SignClient configuration for NuGet packages in CI/CD pipelines.

Apache-2.0 ★ 138 updated 2025-03-29

Install into Cursor · Manually: put the files in place All methods and platforms ↓
.cursor/rules/code-signing.mdc
Open on GitHub

What code-signing does

The rule guides the AI when working with .NET code signing configurations. It triggers automatically on **/signsettings.json, **/appsettings.json, and **/*.nupkg files whenever signing configs are detected.

It outlines configuration structures for Azure Active Directory integration and provides workflow templates for GitHub Actions and Azure DevOps. The instructions prohibit committing private credentials to git, requiring CI/CD secrets instead.

Automated signing jobs will fail in CI pipelines unless the SignClient global dotnet tool is installed beforehand.

What it helps with

  • configure SignClient steps for GitHub Actions release pipelines
  • prepare signsettings.json structures for Azure AD authentication
  • automate artifact signature validation before publishing packages
  • set up PowerShell signing tasks in Azure DevOps

Example prompts for the agent

  • Write a GitHub Actions step to sign our .nupkg files using SignClient
  • Generate signsettings.json for our Azure AD signing service endpoint
  • Add post-signing signature verification to the release workflow

How to install code-signing

Manually: put the files in place

.cursor/rules/code-signing.mdc

Frontmatter: description, globs, alwaysApply

Step by step, with commands for each platform: Cursor rules: .mdc files, four modes and what replaced .cursorrules

Questions about code-signing

How to install code-signing in Claude Code?

Place the rule file at .claude/rules/code-signing.md. If you use Cursor, add it to .cursor/rules/code-signing.mdc.

What triggers the code-signing rule?

It applies to projects with signsettings.json or an appsettings.json file containing a SignClient block, watching matching config files and .nupkg archives.

Which signing tool is expected in CI steps?

Workflows must install SignClient via dotnet tool install --global SignClient and inject credentials via environment secrets.

Source text

code-signing.mdc · Apache-2.0
---
description: Rules and best practices for .NET code signing
globs: **/signsettings.json,**/appsettings.json,**/*.nupkg
alwaysApply: false
---

# .NET Code Signing Rules and Best Practices

## Prerequisites
These rules only apply when one of the following exists:
- `signsettings.json`
- `appsettings.json` with a `SignClient` section

## Code Signing Configuration

### SignClient Configuration
```json
{
  "SignClient": {
    "AzureAd": {
      "AADInstance": "https://login.microsoftonline.com/",
      "ClientId": "[configured in CI]",
      "TenantId": "[configured in CI]"
    },
    "Service": {
      "Url": "https://signing-service.example.com/",
      "ResourceId": "[configured in CI]"
    }
  }
}
```

## Security Best Practices
1. Never commit signing credentials to source control
2. Store signing credentials in CI/CD secret variables
3. Use environment-specific signing configurations
4. Implement proper credential rotation
5. Log signing operations for audit purposes

## CI/CD Integration

### GitHub Actions Example
```yaml
jobs:
  sign:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    
    - name: Install SignClient
      run: dotnet tool install --global SignClient
    
    - name: Sign NuGet Packages
      run: |
        SignClient sign `
          --config signsettings.json `
          --input "**/*.nupkg" `
          --secret "${{ secrets.SIGN_CLIENT_SECRET }}" `
          --name "MyProject" `
          --description "Official release package"
```

### Azure DevOps Example
```yaml
steps:
- task: UseDotNet@2
  inputs:
    useGlobalJson: true

- script: dotnet tool install --global SignClient
  displayName: 'Install SignClient'

- powershell: |
    SignClient sign `
      --config signsettings.json `
      --input "$(Build.ArtifactStagingDirectory)/*.nupkg" `
      --secret "$(SignClientSecret)" `
      --name "$(Build.DefinitionName)" `
      --description "Official release package"
  displayName: 'Sign Packages'
  env:
    SignClientSecret: $(SignClientSecret)
```

## Verification
1. Implement post-signing verification
2. Check signature validity before publishing
3. Include signature verification in test pipeline
4. Document signature verification process

## Package Publishing
1. Only publish signed packages for releases
2. Implement signature verification before publishing
3. Maintain signed package archive
4. Document package signature in release notes

## Troubleshooting
1. Common signing errors and solutions
2. Credential validation steps
3. Service connectivity issues
4. Certificate expiration handling

## Maintenance
1. Regular credential rotation schedule
2. Certificate expiration monitoring
3. Signing service health checks
4. Audit log review process 

© Aaronontheweb · Apache-2.0 · Aaronontheweb/dotnet-cursor-rules

Similar IDE rules

All IDE rules for Security →

From the same set11

The whole set →
meta The meta rule guides edits to *.mdc files, preserving their formatting and steering agents toward existing rule files before creating new ones. CX Codex +1 ★ 138repo stars publishing-dotnettool Guides AI agents when creating and publishing dotnet tools to NuGet. Ensures semantic versioning, correct packaging, and compatibility across .NET versions. CX Codex +1 ★ 138repo stars consuming-dotnettool The consuming-dotnettool rule keeps .NET tool dependencies in a manifest, pins their versions, and adds restore steps for CI/CD. Use it when projects need repeatable tool setup. CX Codex +1 ★ 138repo stars dependency-management Rule for secure NuGet dependency management: vulnerability scanning, license compliance, versioning via dotnet CLI. Auto-applies to project files. CX Codex +1 ★ 138repo stars solution-management solution-management standardizes .NET solution architecture with explicit SDK pinning, shared build properties, and centralized package management. CX Codex +1 ★ 138repo stars benchmarking The benchmarking rule teaches the agent to write valid .NET performance tests using BenchmarkDotNet. Useful when you need to measure code speed and track regressions. CX Codex +1 ★ 138repo stars nuget-package-publishing nuget-package-publishing — a rule that teaches the agent to pack .NET libraries into NuGet packages following industry standards: SPDX license, README, and debug symbols. CX Codex +1 ★ 138repo stars testing Defines xUnit testing conventions for .NET: project configurations, test isolation, coverage thresholds, and integration test setup. CX Codex +1 ★ 138repo stars

Project sponsors

Companies that keep this analytics open