prism-maintain
Maintain the Prism codebase: measure cyclomatic complexity, refactor hotspots, and enforce the anti-slop type discipline. Use when the user asks about "complexity", "refactor", "hotspot", "maintainability", "code health", "anti-slop", "lint rules", or "clean up" the Prism repo.
- License 许可
- MIT
- 最近更新
- 2026-10-08
- Stars
- ★ 11
- Forks
- 3
01 前言 Front Matter
- name
- prism-maintain
- tags
- [ "typescript", "effect-ts", "refactoring", "complexity", "lint", "maintainability" ]
- author
- irfndi
- license
- MIT
- version
- 0.1.0
- homepage
- https://github.com/irfndi/prism-liquidity-agent
- description
- Maintain the Prism codebase: measure cyclomatic complexity, refactor hotspots, and enforce the anti-slop type discipline. Use when the user asks about "complexity", "refactor", "hotspot", "maintainability", "code health", "anti-slop", "lint rules", or "clean up" the Prism repo.
- compatibility
- Requires Bun 1.4+ and oxlint with the vendored anti-slop plugin.
03 SKILL.md 正文
Prism Code Maintenance
Measure complexity, refactor hotspots, keep the code human-maintainable.
Methodology adapted from
saurabhkumar8112/cyclomatic-complexity-skill
(Apache-2.0); type discipline enforced by the vendored
dmmulroy/anti-slop v0.1.2 plugin in
tools/oxlint/anti-slop/.
Complexity gates (project config wins)
bun run lint enforces complexity: max 10 as an error via oxlint
(type-aware — it is the authoritative measure for this Effect-TS codebase;
line-counters like lizard mis-parse Effect.gen chains and report phantom
CCN 50+ on 15-line functions, so never act on lizard numbers here).
Bands: 1–6 fine · 7–10 watch (refactor only if touching the function anyway) · 11+ must split before merge (lint fails).
Watch-band probe (never commit this config):
sed '"'"'s/"max": 10/"max": 6/'"'"' .oxlintrc.json > .oxlint-cc6.json
bunx oxlint --config .oxlint-cc6.json engine ops bench cli
rm .oxlint-cc6.json
Workflow (mandatory)
- Measure the touched functions, rank by CCN descending.
- Report hotspots with numbers BEFORE touching anything.
- Refactor worst first, one function at a time.
- Re-measure; close with the report table below.
- Verify:
bun run lint,bun run format, fullbun run testgreen with ZERO test edits (unchanged tests passing is the behavior proof).
## Complexity report
| Function | Before | After |
|----------|--------|-------|
| runPoolEntryGates | 11 | 9 |
Extracted: isSafetyBinsSkippable, snapshotPriceDrift
Behavior verified: full suite green, no test edits
Refactor tactics (preference order)
- Guard clauses — invert, return early, kill nesting.
- Extract function — name for WHAT, not how.
- Lookup table / map over if-else chains.
- Named predicates —
isPositiveFiniteApr(x)beats boolean soup. - Lookup before polymorphism: Effect code dispatches via Layers and tagged unions, not class hierarchies.
continueover nestedifin loops.
Hard rules: preserve behavior · never game the metric (a dense one-liner hiding 6 branches is worse than the honest chain) · never break exported signatures without asking · one responsibility per function.
When NOT to split
- Numbered risk-gate chains (
engine/risk-service.ts): sequential early-return blocks are the documented convention (AGENTS.md) — splitting scatters the gate narrative. - Single decision-loop
Effect.genblocks (engine/program.ts): splitting obscures per-cycle sequencing; extract pure predicates instead. - Agent-overlay handlers and network retry logic in untouched domains.
Anti-slop plugin (vendored v0.1.2 parity)
Source: tools/oxlint/anti-slop/ (.ts sources + index.mjs bundles +
upstream *.test.ts contracts, which need oxlint/plugins-dev to execute).
Rebuild bundles after any source change — never hand-edit .mjs:
bun build tools/oxlint/anti-slop/index.ts --outfile tools/oxlint/anti-slop/index.mjs
bun build tools/oxlint/anti-slop/effect/index.ts --outfile tools/oxlint/anti-slop/effect/index.mjs
Rules that most often bite: no-known-value-widening (open-dict
annotations — prefer finite type contracts, satisfies, accumulators, or
Map), require-safety-comment-for-type-assertion (every as needs a
SAFETY: justification with non-empty text), no-unknown-parameters /
no-unknown-returns (parse at the boundary, return named domain types).
Never suppress or weaken a rule — fix the code.
04 同仓库更多 Skills
obsidian-clipper-template-creator
Guide for creating templates for the Obsidian Web Clipper. Use when you want to create a new clipping template, understand available variables, or format clipped content.
obsidian-clipper-template-creator
Guide for creating templates for the Obsidian Web Clipper. Use when you want to create a new clipping template, understand available variables, or format clipped content.
python-api
Programmatic Object-Detection-Metrics API guidance for BoundingBox, BoundingBoxes, Evaluator, enums, coordinate conversion, AP/mAP semantics, and source-style import diagnostics.
file-evaluation
Folder-based PASCAL VOC AP/mAP evaluation from ground-truth and detection text files.
object-detection-metrics
Guides legacy Object-Detection-Metrics PASCAL VOC AP/mAP evaluation from detection text folders and direct Python API classes.
nx-workspace-patterns
Configure and optimize Nx monorepo workspaces. Use when setting up Nx, configuring project boundaries, optimizing build caching, or implementing affected commands.