Skip to content
Back to skills

Code Style

ASecurity

Language-agnostic code-design rules for explicit state, failure, ownership, and I/O boundaries. Use when implementing, refactoring, or reviewing code.

  • 12 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 6, 2026
code-qualitytypescriptrustshellexpressrefactoringgitapi

Works with

  • api

Security analysis

A100/100

Pro scans all 19 files and shows the line behind each finding

Scanned September 6, 2026

npx -y skills add Casper-Studios/casper-marketplace --skill code-style --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Code Style?

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

Security grade badge for Code Style
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/casper-studios-code-style/badge)](https://www.skillsdirectory.com/skills/casper-studios-code-style)

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
---
name: code-style
description: Language-agnostic code-design rules for explicit state, failure, ownership, and I/O boundaries. Use when implementing, refactoring, or reviewing code.
license: MPL-2.0
metadata:
  author: 'Basti Ortiz <ortiz@bastidood.dev>'
  source: 'https://github.com/BastiDood/skills'
---

# Code Style

This skill keeps code explicit, linear, and honest about state, failure, ownership, and side effects. Its directives favor enforceable invariants, narrow boundaries, simple abstractions, and sans-I/O decision logic.

Treat each directive as a language-agnostic semantic requirement. Adapt its TypeScript example to the target language's native syntax, type system, resource-management mechanisms, and compiler checks.

## Effective Strategies for Clear, Correct Code

Follow the guidelines below. Read each linked reference that applies before writing or reviewing code.

1. Express control flow so that the permitted state and successful path are easy to read.
   - [Use affirmative conditions when a condition needs mental negation to understand.](./references/affirmative-conditions.md)
   - [Reject invalid or exceptional cases early with guard clauses.](./references/guard-clauses.md)
   - [Make decisions visible at their point of effect instead of concealing valid values or control flow through implicit behavior.](./references/explicit-over-implicit.md)
   - [Reserve conditional expressions for selecting one of two simple values, not for hidden effects.](./references/conditional-expressions.md)
2. Make valid state explicit and enforce it throughout the system.
   - [Make contradictory field combinations unrepresentable by enforcing invariants.](./references/enforce-invariants.md)
   - [Fail impossible states when an internal guarantee is broken instead of continuing with invented state.](./references/fail-impossible-states.md)
   - [Prevent new finite-state members from silently inheriting a fallback through exhaustive decisions.](./references/exhaustive-decisions.md)
3. Keep failure, ownership, and information at their decision-owning boundaries.
   - [Handle and record each failure once at a narrow error boundary, preserving unrelated errors and their original causes.](./references/narrow-error-boundaries.md)
   - [Bind resource ownership to lifetime so a resource never escapes uninitialized or unreleased.](./references/resources-own-lifetimes.md)
   - [Preserve caller-relevant information when normalizing external data so continuation, retry, filtering, fallback, and other policy choices remain with the caller.](./references/preserve-information.md)
   - [Let consumers control continuation and stopping through lazy pagination.](./references/lazy-pagination.md)
4. Keep abstractions and public contracts intentional.
   - [Keep one-off or cosmetic indirection out of the design with simple abstractions.](./references/simple-abstractions.md)
   - [Convert untrusted external payloads into trusted values at the first controlled boundary.](./references/validate-at-boundaries.md)
   - [Keep required absence explicit and reject fabricated defaults unless the domain defines the exact value.](./references/no-fabricated-defaults.md)
   - [Keep consumer APIs intentional and side-effect-free with narrow public surfaces.](./references/narrow-public-surfaces.md)
   - [Put decisions in a pure core and keep I/O in the imperative shell.](./references/pure-core-imperative-shell.md)

Files in this skill

  • LICENSE.txt16.3 KB
  • SKILL.md3.4 KB
  • agents/openai.yaml118 B
  • references/affirmative-conditions.md720 B
  • references/conditional-expressions.md934 B
  • references/enforce-invariants.md1.2 KB
  • references/exhaustive-decisions.md863 B
  • references/explicit-over-implicit.md802 B
  • references/fail-impossible-states.md1.1 KB
  • references/guard-clauses.md943 B
  • references/lazy-pagination.md1 KB
  • references/narrow-error-boundaries.md2.3 KB
  • references/narrow-public-surfaces.md924 B
  • references/no-fabricated-defaults.md992 B
  • references/preserve-information.md925 B
  • references/pure-core-imperative-shell.md1.2 KB
  • references/resources-own-lifetimes.md963 B
  • references/simple-abstractions.md1.2 KB
  • references/validate-at-boundaries.md1.1 KB

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.