MCPGateway: Skill for Codex

.codex/skills/crap-score/SKILL.md

crap-score is a skill for Codex from managedcode/MCPGateway. It costs 101 tokens per session (1,894 once invoked), scanned A, a copy of crap-score, MIT.

A method for estimating code risk from two measures: cyclomatic complexity, which counts decision paths, and code coverage, which shows how much tests exercise the code. The resulting CRAP score highlights code that is both complicated and poorly tested.

In plain words
What is it for?
Use it to assess .NET methods, classes, or files, compare testing risk, and decide which complex or weakly tested code to address first.
Why use it?
A coverage percentage alone may hide complex code that is still risky to change. The score helps identify where more tests or simpler code may be needed.

Skill for Codex

Written for Codex: installed under .codex/.

This is managedcode/MCPGateway's own configuration. It tells Codex how to work on MCPGateway itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything MCPGateway configures →

Reuse

Borrowing it

Nothing to install: this file belongs to managedcode/MCPGateway. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/managedcode/MCPGateway/main/.codex/skills/crap-score/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/managedcode/MCPGateway

Made for: 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 crap-score

README.md
[![agentmods](https://agentmods.dev/badge/skills/managedcode/mcpgateway/crap-score/github.svg)](https://agentmods.dev/skills/managedcode/mcpgateway/crap-score)
Your own site
<a href="https://agentmods.dev/skills/managedcode/mcpgateway/crap-score"><img src="https://agentmods.dev/badge/skills/managedcode/mcpgateway/crap-score/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 crap-score

Your own site · 80×15
<a href="https://agentmods.dev/skills/managedcode/mcpgateway/crap-score"><img src="https://agentmods.dev/badge/skills/managedcode/mcpgateway/crap-score.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 101 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,894 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.
Origin 98% copy Near-identical to another mod 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.00101 $0.01894
Opus 5.5 $0.00040 $0.00758
Sonnet 5.5 $0.00020 $0.00379
Haiku 4.5 $0.00010 $0.00189

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

Security

Grade A, and why

crap-score 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 1mo 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

This is a copy

98% identical to crap-score — 5 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

.codex/skills/crap-score/SKILL.md · 154 lines

How it starts

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

CRAP Score Analysis

Calculate CRAP (Change Risk Anti-Patterns) scores for .NET methods to identify code that is both complex and undertested.

Background

The CRAP score combines cyclomatic complexity and code coverage into a single metric:

$$\text{CRAP}(m) = \text{comp}(m)^2 \times (1 - \text{cov}(m))^3 + \text{comp}(m)$$

Where:

  • $\text{comp}(m)$ = cyclomatic complexity of method $m$
  • $\text{cov}(m)$ = code coverage ratio (0.0 to 1.0) of method $m$
CRAP Score Risk Level Interpretation
< 5 Low Simple and well-tested
5-15 Moderate Acceptable for most code
15-30 High Needs more tests or simplification
> 30 Critical Refactor and add coverage urgently

A method with 100% coverage has CRAP = complexity (the minimum). A method with 0% coverage has CRAP = complexity^2 + complexity.

When to Use

  • User wants to assess which methods are risky due to low coverage and high complexity
  • User asks for CRAP score of specific methods, classes, or files
  • User wants to prioritize which code to test next
  • User wants to evaluate test quality beyond simple coverage percentages

When Not to Use

  • User just wants to run tests (use run-tests skill)
  • User wants to write new tests (use writing-mstest-tests skill or general coding assistance)
  • User only wants a coverage percentage without complexity analysis

Inputs

Input Required Description
Target scope Yes Method name, class name, or file path to analyze
Test project path No Path to the test project. Defaults to discovering test projects in the solution.
Source project path No Path to the source project under analysis

Workflow

Step 1: Collect code coverage data

If no coverage data exists yet (no Cobertura XML available), always run dotnet test with coverage collection first and mention the exact command in your response. Do not skip this step -- CRAP scores require coverage data.

Read the full file on GitHub · 154 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 1mo ago First seen · 154 lines · 101 tokens per session scan A 02eefbf6cbf8

Subscribe to this mod's changes

crap-score is a skill published in the GitHub repository managedcode/MCPGateway (5 stars, last pushed 8d ago), licensed MIT. It adds 101 tokens to every session and 1,894 once invoked, about $0.0004 per session on Opus 5.5. A static security scan graded it A with 0 findings. It is 98% identical to crap-score, differing in 5 lines, and is treated as a copy.

Related

Other skills, from other repositories

dotnet-best-practices

Ensure .NET/C# code follows maintainable, modern best practices. Use when reviewing or improving C# code, solution structure, async patterns, dependency injection, or testability.

PracticalSwan/agent-skills · 43 tokens

maintain-discatsharp

Review, modify, test, document, or release the DisCatSharp repository. Use for DisCatSharp source changes, API additions and migrations, Discord payload models, serialization, command synchronization, Gateway dispatch, REST behavior, analyzer work, multi-target testing, DocFX generation, release notes, and repository…

Aiko-IT-Systems/DisCatSharp · 69 tokens

test-discipline

Update tests when changing APIs — no exceptions.

elbruno/ElBruno.MempalaceNet · 12 tokens

author-test

Generate a test given sample. Parameters: C# SDK repository root; Package name: one of Azure.AI.Projects, Azure.AI.Projects.Agents or Azure.AI.Extensions.OpenAI; the sample to use as a starting point for the test.

Azure/azure-sdk-for-net · 68 tokens

migrate-mstest-v3-to-v4

Use this skill before answering, planning, or editing any MSTest 3.x-to-4.x upgrade or post-upgrade failure. Triggers include "MSTest v4 breaking changes"; CS0507/CS0103/CS1061/CS1615; ExecuteAsync, CallerInfo, DisplayName, or custom TestMethodAttribute; ClassCleanupBehavior; ContainsKey; ThrowsExactly or…

managedcode/dotnet-skills · 179 tokens

migrate-xunit-to-mstest

Convert .NET tests from xUnit.net v2/v3 to MSTest v4 while preserving VSTest or MTP. Use for replacing xunit packages, Fact/Theory/InlineData/MemberData, assertions, IClassFixture/ICollectionFixture, ITestOutputHelper, TestContext cancellation, traits/Owner, skips, timeouts, and xUnit parallelization. Also use when a…

managedcode/dotnet-skills · 141 tokens