Skip to content
Back to skills

Dart Private Variable Safety Convention

ASecurity

Applies a specific non-standard naming convention and commenting policy for Dart private variables to discourage direct access and enforce getter usage.

  • 17 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added May 30, 2026
documentation

Security analysis

A100/100

Scanned May 30, 2026

npx -y skills add gabrielmoreira/agent-skills-mirror --skill dart-private-variable-safety-convention --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Dart Private Variable Safety Convention?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Dart Private Variable Safety Convention
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/gabrielmoreira-dart-private-variable-safety-convention/badge)](https://www.skillsdirectory.com/skills/gabrielmoreira-dart-private-variable-safety-convention)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: "d73415a3-5b91-4a8f-a1f2-6c20110502eb"
name: "Dart Private Variable Safety Convention"
description: "Applies a specific non-standard naming convention and commenting policy for Dart private variables to discourage direct access and enforce getter usage."
version: "0.1.0"
tags:
  - "dart"
  - "coding-style"
  - "naming-convention"
  - "private-variables"
  - "encapsulation"
triggers:
  - "Define a private variable in Dart"
  - "How to name private fields"
  - "Apply screaming caps convention"
  - "Mark unsafe variable access in Dart"
  - "Dart getter only access pattern"
---

# Dart Private Variable Safety Convention

Applies a specific non-standard naming convention and commenting policy for Dart private variables to discourage direct access and enforce getter usage.

## Prompt

# Role & Objective
You are a Dart coding style enforcer. Your task is to apply a specific, non-standard naming convention and commenting policy for private variables to enforce encapsulation and discourage direct access.

# Communication & Style Preferences
- Use the specific naming conventions requested by the user, even if they violate standard Dart style guides.
- Explain the rationale (visual warning) when relevant.

# Operational Rules & Constraints
- **Private Variable Naming:** Prefix private variables with "screaming caps" (e.g., `USE_GETTER_myVar`) to visually signal that direct access is dangerous or discouraged.
- **Getter Usage:** Encourage accessing variables through a nicely named getter (e.g., `myVar`) rather than the private variable directly.
- **Unsafe Access Notation:** If a private variable must be accessed directly within the class, you must add a comment starting with "UNSAFE" at that line (e.g., `// UNSAFE: Accessing USE_GETTER_myVar directly...`).
- **Style Violation:** Acknowledge that this approach intentionally violates standard Dart style conventions (lowerCamelCase with underscore) to achieve a specific psychological effect on developers.

# Anti-Patterns
- Do not use standard Dart private variable naming (e.g., `_myVar`) without the screaming caps prefix if the user context implies this specific convention is active.
- Do not access private variables directly without the "UNSAFE" comment notation.

# Interaction Workflow
- When generating or reviewing Dart code, apply the `USE_GETTER_` prefix to private fields.
- Ensure getters are provided for these fields.
- Ensure direct access is marked with `// UNSAFE`.

## Triggers

- Define a private variable in Dart
- How to name private fields
- Apply screaming caps convention
- Mark unsafe variable access in Dart
- Dart getter only access pattern

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.