# Format Params

> Apply consistent method parameter line break formatting across C# projects. Formats parameter lists in declarations (methods, constructors, local functions, delegates) while leaving invocations untouched. Use when the user wants to format method parameters or apply parameter line break formatting.

- Skill: `atc-net/format-params` (Agent Skill)
- Install (CLI): `npx skillmds@latest add atc-net/format-params`
- Raw SKILL.md: https://api.skillmd.com/api/skills/atc-net/format-params/raw
- Safety review: PASS (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: atc-net (https://skillmd.com/u/atc-net)
- Updated: 2026-08-19
- Page: https://skillmd.com/skills/atc-net/format-params

---


# Format Method Parameters

## Scope: What to Format

**ALL projects:**

All *.cs files EXCEPT auto-generated code.
Exclude files with:

- "generated", ".g.cs", ".designer.cs" in filename
- AssemblyInfo.cs files
- `[GeneratedCode]` or `[GeneratedCodeAttribute]`
- `<auto-generated>` tags
- "auto-generated" in headers
- "This code was generated by a tool"

**ONLY format parameter lists in DECLARATIONS:**

- Method declarations (public, private, protected, internal, static, async, virtual, override, abstract, etc.)
- Constructor declarations
- Local function declarations (functions defined inside methods)
- Delegate declarations

**DO NOT format parameter lists in INVOCATIONS or EXPRESSIONS:**

- Method calls/invocations (e.g., `.Replace(...)`, `.Substring(...)`)
- Constructor invocations (e.g., `new MyClass(...)`)
- Ternary operators (e.g., `condition ? value1 : value2`)
- Lambda expressions (e.g., `(x, y) => x + y`)
- LINQ query expressions
- Indexer property declarations (e.g., `this[int x, int y]`)

## Formatting Rules

### Rule 1: Multiple Parameters

Break down **all parameters** if a method has **more than 1 parameter**, with each parameter on its own line.

### Rule 2: Single Long Parameter

Break down a **single parameter** if the total line length (including indentation) exceeds **80 characters**.

## Examples

### Declarations to Format

```csharp
// No parameters - no break
public void MyMethod1()

// Single short parameter - no break
public void MyMethod2(int parameter1)

// Single parameter, total length > 80 chars - break
public void MyLooooooooooooooooooooooooooooooooooooooooooonMethod4(
    int parameter1)

// 2 parameters - break all
public void MyMethod5(
    int parameter1,
    int parameter2)

// 3+ parameters - break all
public void MyMethod6(
    int parameter1,
    int parameter2,
    int parameter3)

// Constructor with multiple parameters - break all
public MyClass(
    string name,
    int age,
    bool isActive)

// Local function with multiple parameters - break all
void LocalFunction(
    int param1,
    string param2)

// Delegate with multiple parameters - break all
public delegate void MyEventHandler(
    object sender,
    EventArgs e);
```

### Invocations to Leave Unchanged

```csharp
// Method invocations - DO NOT format
var result = assembly.GetBeautifiedName().Replace("Api", "API", StringComparison.Ordinal);
var name = someObject.SomeMethod(arg1, arg2, arg3);

// Constructor invocations - DO NOT format
var obj = new MyClass(param1, param2, param3);

// Ternary operators - DO NOT format
return condition ? value1 : value2;

// Lambda expressions - DO NOT format
var filtered = items.Where((item, index) => item.IsActive && index > 0);

// Indexer declarations - DO NOT format
public string this[int row, int column]
```

## Execution Instructions

### 1. Scan for C# files

Find all `.cs` files in the repository.

### 2. Identify DECLARATIONS (not invocations)

**Method declarations:**
- Lines starting with access modifiers: `public`, `private`, `protected`, `internal`
- Lines with method modifiers: `static`, `virtual`, `override`, `abstract`, `async`, `sealed`
- Pattern: `[modifiers] [return-type] [method-name]([parameters])`
- Must have a return type (or `void`) before the method name
- Usually followed by `{`, `;`, or `=>`

**Constructor declarations:**
- Pattern: `[modifiers] [class-name]([parameters])`
- Class name matches the containing class
- No return type before the name

**Local function declarations:**
- Found inside method bodies
- Pattern: `[return-type] [function-name]([parameters])`

**Delegate declarations:**
- Pattern: `[modifiers] delegate [return-type] [delegate-name]([parameters]);`
- Contains the `delegate` keyword

**Key distinction from invocations:**
- Declarations have modifiers (public, private, static, etc.) OR are preceded by a type
- Invocations follow a `.` (member access), are on the right side of `=`, or are arguments to other methods

### 3. Apply formatting rules

For each declaration found:
- If 2+ parameters: break all parameters onto separate lines
- If 1 parameter: break only if total line length > 80 characters
- Ensure proper indentation (4 spaces per indentation level)
- Place opening parenthesis `(` on same line as method name
- Place each parameter on its own line with proper indentation
- Keep closing parenthesis `)` on same line as last parameter

### 4. Process in batches

Work on files in manageable batches (e.g., 10-20 files at a time).

### 5. Verify after each batch

Run `dotnet build` to ensure no syntax errors.

### 6. Track progress

Use todo list to track which files have been processed.

### 7. Final verification

Run full test suite after all changes complete.

## Guidelines

- **Preserve all code logic and comments**
- **Maintain existing indentation style** (spaces vs tabs)
- **Handle edge cases**: attributes, generic types, default values, nullable types, ref/out/in parameters
- **Do not modify method bodies** - only parameter declarations
- **Do not modify method invocations** - only declarations
- **Leave ternary operators unchanged**
- **Leave lambda expressions unchanged**
- **Leave LINQ expressions unchanged**
- **If uncertain whether something is a declaration or invocation**, skip it and flag for manual review

