agentleFS
artimathartimath/effect-skills/skills/effect-deslopify-idiomatic/SKILL.md

effect-deslopify-idiomatic

Skill8 starsChanged 9 months agoMITView on GitHub

Audit and remediate Effect code to idiomatic standards. Chains SDD audit methodology with Effect best practices to systematically identify and fix non-idiomatic patterns. USE THIS SKILL WHEN: 'deslopify', 'make this idiomatic effect', 'audit effect quality', 'is this good effect code', 'library-grade effect'.

The file

We split this skill into the rules it gives an agent

10 rules. About 0 are common, 10 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈10

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Keep behavior stable unless fixing a confirmed bug

    line 21
  2. Distinctive:

    Run SDD audit mode across phases 1-4 on the target.

    line 27
  3. Distinctive:

    Test coverage (missing property tests, bun scripts)

    line 38
  4. Distinctive:

    Remediate: if architecture is sound and gaps are localized

    line 43
  5. Distinctive:

    Rewrite: only if architecture is unsalvageable (majority of phases FAIL)

    line 44
  6. Distinctive:

    Test gaps (property tests, vitest conversion)

    line 53
  7. Distinctive:

    Add/keep regression tests for bug fixes (TDD: failing test first, then fix).

    line 57
  8. Distinctive:

    Run all applicable gates:

    line 61
  9. Distinctive:

    After running deslopify, report:

    line 133
  10. Distinctive:

    Test/gate results (pass/fail)

    line 136

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Effect Deslopify (Idiomatic Remediation)

Systematic audit and remediation of Effect-TS code to library-grade idiomatic standards.

Companion skills (install separately): effectts (pattern reference), sdd (methodology). These provide the pattern reference and methodology this skill orchestrates.

Target

Apply to any Effect-TS codebase, package, or file path.

Mission

  • De-slopify the target
  • Make code library-grade idiomatic Effect
  • Keep behavior stable unless fixing a confirmed bug

Workflow

1. Audit (SDD Phases 1-4)

Run SDD audit mode across phases 1-4 on the target.

2. Gap Analysis

Produce a gap list covering:

  • Schema modeling (bare brands, missing constraints, manual mappers)
  • Service boundaries (wrong abstraction level, god services)
  • Error channels (silent swallowing, wrong error types)
  • Layer wiring (missing deps, provide vs provideMerge)
  • Purity violations (impure ops outside Effect tracking)
  • Exhaustiveness (switch instead of Match.exhaustive)
  • Test coverage (missing property tests, bun scripts)

3. Decide: Remediate or Rewrite

For each gap:

  • Remediate if architecture is sound and gaps are localized
  • Rewrite only if architecture is unsalvageable (majority of phases FAIL)

4. Implement Fixes

Implement highest-impact fixes. Priority order:

  1. Bugs (incorrect behavior, discarded Effect values)
  2. Schema constraints (bare brands, missing validation)
  3. Error modeling (Data.TaggedError -> Schema.TaggedError)
  4. Service patterns (Effect.fn, annotateLogs)
  5. Test gaps (property tests, vitest conversion)

5. Regression Tests

Add/keep regression tests for bug fixes (TDD: failing test first, then fix).

6. Verify Gates

Run all applicable gates:

  • Your project's typecheck command (e.g. npx tsc --noEmit or pnpm check)
  • npx effect-language-service quickfixes --project tsconfig.json (if configured)
  • Relevant test suites

Idiomatic Constraints

These are non-negotiable for library-grade Effect code:

ConstraintWhy
No as anyType escapes hide real errors
No silent catchAll error swallowingErrors must be logged or propagated
No raw fetch when typed client existsDuplicating URLs loses type safety
No ad-hoc mutable state in Effect pathsUse Ref for tracked state
Impure ops wrapped in Effect.sync / Effect APIsEffect must track all side effects
Match.exhaustive not switchCompile-time case coverage
Errors modeled explicitlySchema.TaggedError with typed channels
Effect.fn on all service methodsAutomatic tracing spans
Effect.annotateLogs per service moduleStructured observability
yield* new TaggedError() in generatorsNot Effect.fail(new TaggedError())

Before / After Examples

Bare Brand -> Constrained Brand

// BEFORE (sloppy): accepts empty strings, whitespace, anything
const UserId = Schema.String.pipe(Schema.brand("UserId"))

// AFTER (idiomatic): enforces domain invariants
const UserId = Schema.NonEmptyString.pipe(
  Schema.pattern(/^usr_[a-z0-9]+$/),
  Schema.brand("UserId")
)

Manual Tracing -> Effect.fn

// BEFORE (sloppy): manual withSpan, no argument capture
findById: (id: UserId) =>
  sql`SELECT * FROM users WHERE id = ${id}`.pipe(
    Effect.flatMap(rows => decode(rows[0])),
    Effect.withSpan("UserRepo.findById"),
  ),

// AFTER (idiomatic): Effect.fn captures args + creates span
findById: Effect.fn("UserRepo.findById")(function*(id: UserId) {
  const rows = yield* sql`SELECT * FROM users WHERE id = ${id}`
  if (rows.length === 0) return yield* new UserNotFound({ userId: id })
  return yield* Schema.decodeUnknown(User)(rows[0])
}),

Silent Error Swallowing -> Explicit Handling

// BEFORE (sloppy): error silently disappears
const result = yield* dangerousOp.pipe(
  Effect.catchAll(() => Effect.succeed(fallback))
)

// AFTER (idiomatic): error logged before fallback
const result = yield* dangerousOp.pipe(
  Effect.tapError((e) => Effect.logWarning("Falling back", { error: e })),
  Effect.catchAll(() => Effect.succeed(fallback))
)

Output

After running deslopify, report:

  • Changed files (with summary of what changed)
  • Anti-patterns removed (count by category)
  • Test/gate results (pass/fail)
  • Residual risks + follow-ups (anything not fixed in this pass)

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.