Skip to content

teaceo-debug/DEEP6 / .claude/skills/nt8-build-verify

nt8-build-verify

Verified

FileKindSize
README.mdmarkdown13.6 KB
SKILL.mdskill md1.5 KB
fixes/BRACE_MISMATCH.mdmarkdown5.1 KB
fixes/CS0019.mdmarkdown4.7 KB
fixes/CS0101.mdmarkdown4.9 KB
fixes/CS0103.mdmarkdown4.0 KB
fixes/CS0246.mdmarkdown5.4 KB
fixes/CS0535.mdmarkdown3.6 KB
fixes/CS1061.mdmarkdown5.0 KB
fixes/MISSING_ATTRIBUTE.mdmarkdown5.9 KB
knowledge.mdmarkdown3.5 KB
lib/__init__.pyscript0 B
lib/diagnostics.pyscript2.3 KB
lib/nt8_paths.pyscript3.8 KB
scripts/compile_editor.ps1script5.1 KB
scripts/compile_headless.ps1script9.2 KB
scripts/deploy.ps1script2.6 KB
scripts/fix_loop.ps1script19.7 KB
scripts/fix_router.pyscript15.8 KB
scripts/install_indicator.ps1script16.0 KB
scripts/modal_detect.ps1script10.9 KB
scripts/orchestrator.ps1script19.8 KB
scripts/parse_errors.pyscript4.6 KB
scripts/runtime_check.ps1script2.9 KB
scripts/screenshot_chart.ps1script7.5 KB
scripts/verify_visual.pyscript8.0 KB
scripts/workspace_mutator.pyscript17.6 KB

fixes/CS0019.md

View on GitHub
# CS0019 — Operator cannot be applied to operands

## Pattern
`error CS0019: Operator 'X' cannot be applied to operands of type 'T1' and 'T2'`

## Root Causes (ordered by likelihood)
1. Comparing a `bool` to a `double` or numeric type (e.g., `if (someCondition == 1.0)`)
2. Using `==` or `!=` on a nullable type (`double?`, `int?`) without unwrapping `.Value`
3. Arithmetic between incompatible types without an explicit cast (e.g., `int` and `double` in a context where implicit conversion is blocked)
4. Comparing an enum value to an integer literal without a cast

## Fix Strategies

### Strategy 1: Bool-to-numeric comparison
- **Detect**: The error message shows operand types like `bool` and `double`, `bool` and `int`, or similar. The code is comparing a boolean expression directly to a number.
- **Lookup**: In C#, `bool` cannot be compared to numeric types. The comparison must be rewritten as a boolean expression.
- **Fix**: Remove the numeric comparison and use the boolean directly, or compare the numeric value to the threshold separately.
- **Verify**: Both operands of the operator are the same type (or have a defined operator overload).

```csharp
// Wrong: comparing bool to double
bool isAbove = Close[0] > High[1];
if (isAbove == 1.0) { ... }  // CS0019

// Correct:
if (isAbove) { ... }
// or
if (Close[0] > High[1]) { ... }
```

### Strategy 2: Nullable type without `.Value`
- **Detect**: One operand type in the error is `T?` (e.g., `double?`, `int?`). The operator is `+`, `-`, `*`, `/`, `<`, `>`, `==`, or similar.
- **Lookup**: Nullable types in C# don't support most operators directly. You must either unwrap with `.Value` (after a null check) or use the null-coalescing operator `??` to provide a fallback.
- **Fix**: Add a null check and use `.Value`, or use `?? defaultValue` to unwrap safely.
- **Verify**: The nullable is unwrapped before the operator is applied, and a null guard prevents a `NullReferenceException` at runtime.

```csharp
// Wrong: nullable double in arithmetic
double? maybePrice = GetOptionalPrice();
double result = maybePrice + 10.0;  // CS0019

// Correct option A: null check + .Value
if (maybePrice.HasValue)
    double result = maybePrice.Value + 10.0;

// Correct option B: null-coalescing
double result = (maybePrice ?? 0.0) + 10.0;
```

### Strategy 3: Enum compared to integer literal
- **Detect**: One operand is an enum type (e.g., `MarketPosition`, `State`, a custom DEEP6 enum) and the other is an `int` literal.
- **Lookup**: C# enums are not implicitly convertible to `int` in comparisons. Use the enum member name directly, or cast the integer to the enum type.
- **Fix**: Replace the integer literal with the named enum member, or cast: `(MyEnum)intValue`.
- **Verify**: Both sides of the comparison are the same enum type.

```csharp
// Wrong: comparing MarketPosition to int
if (Position.MarketPosition == 1) { ... }  // CS0019

// Correct:
if (Position.MarketPosition == MarketPosition.Long) { ... }
```

### Strategy 4: Implicit cast blocked between numeric types
- **Detect**: The error shows operand types like `int` and `double`, or `float` and `decimal`, in a context where the compiler cannot apply an implicit conversion (e.g., inside a generic or when the result type is ambiguous).
- **Lookup**: Identify which operand needs to be cast. In NT8, `Close[0]` returns `double`; `CurrentBar` returns `int`. Mixing them in arithmetic usually works via implicit widening, but explicit casts are needed when the target type is narrower.
- **Fix**: Add an explicit cast to align the types: `(double)intValue` or `(int)doubleValue` (with awareness of truncation).
- **Verify**: The cast produces the intended type and the operator is valid for that type.

```csharp
// Wrong: int result from double division assigned to int without cast
int bars = CurrentBar / 2.5;  // CS0019 or CS0266

// Correct:
int bars = (int)(CurrentBar / 2.5);
```

## NT8-Specific Type Notes

| NT8 Expression | C# Type | Common Mistake |
|----------------|---------|----------------|
| `Close[0]` | `double` | Compared to `int` literal |
| `CurrentBar` | `int` | Used in `double` arithmetic without cast |
| `Position.MarketPosition` | `MarketPosition` (enum) | Compared to `int` |
| `State` | `State` (enum) | Compared to `int` |
| `Volume[0]` | `double` | Compared to `long` |
| `IsFirstTickOfBar` | `bool` | Compared to `1` or `0` |

## Example Fix

```diff
  // Checking if we're in a long position
- if (Position.MarketPosition == 1)  // CS0019: MarketPosition vs int
+ if (Position.MarketPosition == MarketPosition.Long)
  {
      // ...
  }

  // Nullable price check
  double? optPrice = GetLevel();
- double spread = optPrice - Close[0];  // CS0019: double? vs double
+ double spread = (optPrice ?? Close[0]) - Close[0];
```
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall