home / skills / splitleaseteam / splitlease_monorepo / fp-rater
/.claude/skills/fp-rater
This skill analyzes a code file for functional programming adherence and outputs a minimalist FP score out of 10.
npx playbooks add skill splitleaseteam/splitlease_monorepo --skill fp-raterReview the files below or copy the command above to add this skill to your agents.
---
name: fp-rater
description: |
Automatically rates functional programming adherence after editing or creating code files. Use when: (1) A code file has been edited or created, (2) The file contains programming logic (JavaScript/TypeScript, Python, etc.). Output a minimalist rating table showing FP score out of 10.
---
# Functional Programming Rating
After editing or creating a code file, output a minimalist rating of its adherence to functional programming principles.
## When to Rate
Rate files containing programming logic after:
- Creating new code files
- Editing existing code files
Do NOT rate:
- Configuration files (JSON, YAML, etc.)
- Markup files (HTML, CSS, Markdown, .md files)
- Data files
- Documentation files
## Rating Criteria
Evaluate the file against these 7 principles (score out of 10):
1. **PURITY** - Pure functions (same inputs → same outputs, no side effects)
2. **IMMUTABILITY** - No mutations (use spread operators, return new values)
3. **EXPLICIT DEPENDENCIES** - Dependencies as parameters, not globals
4. **EFFECTS AT EDGES** - I/O and side effects at boundaries, not mixed with logic
5. **ERRORS AS VALUES** - Result/Either types instead of exceptions for expected failures
6. **DECLARATIVE STYLE** - map/filter/reduce over imperative loops
7. **COMPOSITION** - Small, focused, composable functions
## Scoring Guidelines
- **9-10**: Exemplary FP - follows nearly all principles
- **7-8**: Strong FP - follows most principles with minor violations
- **5-6**: Mixed approach - some FP patterns, some imperative
- **3-4**: Mostly imperative - minimal FP adherence
- **1-2**: Non-functional - direct violations of most principles
## Output Format
After completing file edits, append this exact table format at the bottom of your response:
```
Allegiance to Functional Programming
┌─────────────────────────┬───────┐
│ File │ Score │
├─────────────────────────┼───────┤
│ filename.ext │ X/10 │
└─────────────────────────┴───────┘
```
Replace `filename.ext` with the actual file name and X with the numeric score. Include ONLY this table - no explanations, no breakdown, no additional commentary.
## Example
After editing `userService.ts`, append:
```
Allegiance to Functional Programming
┌─────────────────────────┬───────┐
│ File │ Score │
├─────────────────────────┼───────┤
│ userService.ts │ 7/10 │
└─────────────────────────┴───────┘
```
This skill automatically rates how well a modified or newly created code file follows functional programming principles. It provides a concise numeric assessment so developers can quickly gauge FP adherence and decide if refactors are needed.
After a file containing programming logic is created or edited, the skill analyses the code against seven FP principles: purity, immutability, explicit dependencies, effects at edges, errors-as-values, declarative style, and composition. It computes a single FP score out of 10 and outputs a minimalist rating table referencing the file name and score.
Which file types are scored?
Files with programming logic such as JavaScript, TypeScript, Python, and similar languages are scored. Config, markup, data, and documentation files are ignored.
What does the score represent?
A single 0–10 score summarizing adherence to seven FP principles. Higher scores indicate stronger functional style across purity, immutability, composition, and related dimensions.