code-philosophy

code-philosophy is a skill for Claude Code, Codex from kdcokenny/ocx. It costs 32 tokens per session (687 once invoked), scanned A, original, MIT.

A set of internal principles for keeping application logic and data flow simple, predictable, and resistant to errors.

In plain words
What is it for?
Use it when designing or reviewing backend logic, React components, hooks, state management, and other code that validates input or moves data through an application.
Why use it?
It provides consistent ways to handle invalid input, reduce deep nesting, and prevent impossible or confusing states in code.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions OpenCode.

Good fit Use it when designing or reviewing backend logic, React components, hooks, state management, and other code that validates input or moves data through an application.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/kdcokenny/ocx/code-philosophy
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add kdcokenny/ocx --skill code-philosophy
Clone the repo
git clone --depth 1 https://github.com/kdcokenny/ocx

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for code-philosophy

README.md
[![agentmods](https://agentmods.dev/badge/skills/kdcokenny/ocx/code-philosophy/github.svg)](https://agentmods.dev/skills/kdcokenny/ocx/code-philosophy)
Your own site
<a href="https://agentmods.dev/skills/kdcokenny/ocx/code-philosophy"><img src="https://agentmods.dev/badge/skills/kdcokenny/ocx/code-philosophy/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for code-philosophy

Your own site · 80×15
<a href="https://agentmods.dev/skills/kdcokenny/ocx/code-philosophy"><img src="https://agentmods.dev/badge/skills/kdcokenny/ocx/code-philosophy.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 32 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 687 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00032 $0.00687
Opus 5.5 $0.00013 $0.00275
Sonnet 5.5 $0.00006 $0.00137
Haiku 4.5 $0.00003 $0.00069

Measured 2mo ago against content hash 9f97042d8e0e, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

code-philosophy scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

legacy/docs/kdco/skills/code-philosophy/SKILL.md · 50 lines

How it starts

The opening of the file, as written. The whole thing — 50 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Frozen V1 reference. This document is preserved from OCX e79df6f. Its tool names, models, APIs, and installation instructions describe OpenCode V1. For the supported V2 setup, see the OCX 3 documentation.

Internal Logic Philosophy: The 5 Laws of Elegant Defense

Role: Principal Engineer for all Internal Logic & Data Flow — applies to backend, React components, hooks, state management, and any code where functionality matters.

Philosophy: Elegant Simplicity — code should guide data so naturally that errors become impossible, keeping core logic flat, readable, and pristine.

The 5 Laws

1. The Law of the Early Exit (Guard Clauses)

  • Concept: Indentation is the enemy of simplicity. Deep nesting hides bugs.
  • Rule: Handle edge cases, nulls, and errors at the very top of functions.
  • Practice: Use if (!valid) return; doWork(); instead of if (valid) { doWork(); }.

2. Make Illegal States Unrepresentable (Parse, Don't Validate)

  • Concept: Don't check data repeatedly; structure it so it can't be wrong.
  • Rule: Parse inputs at the boundary. Once data enters internal logic, it must be in trusted, typed state.
  • Why: Removes defensive checks deep in algorithmic code, keeping core logic pristine.

3. The Law of Atomic Predictability

  • Concept: A function must never surprise the caller.
  • Rule: Functions should be "Pure" where possible. Same Input = Same Output. No hidden mutations.
  • Defense: Avoid void functions that mutate global state. Return new data structures instead.

4. The Law of "Fail Fast, Fail Loud"

  • Concept: Silent failures cause complexity later.
  • Rule: If a state is invalid, halt immediately with a descriptive error. Do not try to "patch" bad data.
  • Result: Keeps logic simple by never accounting for "half-broken" states.

Read the full file on GitHub · 50 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2mo ago Changed · +2 lines 9f97042d8e0e
  2. 3mo ago First seen · 48 lines · 32 tokens per session scan A 7f15b42b52e5

Subscribe to this mod's changes

code-philosophy is a skill published in the GitHub repository kdcokenny/ocx (982 stars, last pushed 2mo ago), licensed MIT. It adds 32 tokens to every session and 687 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

code-philosophy compared with skills from other repositories

code-philosophy next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
code-philosophykdcokenny/ocxSkill9822mo agoMITA32Claude Code, Codex
pr-stewardagent-of-empires/agent-of-empiresSkill5.3ktodayMITA130Claude Code, Codex
codeql-reviewagent-of-empires/agent-of-empiresSkill5.3ktodayMITA72Claude Code, Codex
hypothesessynthetic-sciences/openscienceSkill4.5kyesterdayApache-2.0A99Claude Code
aoe-invariantsagent-of-empires/agent-of-empiresSkill5.3ktodayMITA92Claude Code, Codex
aoe-runtime-lifecycleagent-of-empires/agent-of-empiresSkill5.3ktodayMITA76Claude Code, Codex
aoe-sandbox-boundaryagent-of-empires/agent-of-empiresSkill5.3ktodayMITA85Claude Code, Codex