Skip to main content
effect-systems Expert skill for designing and implementing algebraic effect systems including effect annotation, inference, handlers, polymorphism, and row-based effect typing.
Zur Installation springen Skills Marktplatz Entdecken und erkunden Sie KI-Skills, die von der Community erstellt wurden.
Mit Codex oder Claude installieren Kopieren Sie diesen Prompt, fügen Sie ihn in Codex, Claude oder einen anderen Assistant ein und lassen Sie die Skill-Seite prüfen und installieren.
Prompt kopierenPrompt-Details anzeigen Ein direkter Befehl überspringt den Prüf-Prompt. Prüfen Sie die Quelle, bevor Sie ihn ausführen.
npx skills add https://github.com/a5c-ai/babysitter --skill effect-systemsDer Befehl bleibt in einer Zeile. Scrollen Sie horizontal, um ihn vor dem Kopieren vollständig zu prüfen.
Sie bevorzugen eine lokale Kopie? Laden Sie die Dateien herunter, die SkillsMP derzeit vorliegen.
ZIP herunterladen Herunterladen... Mehr aus diesem Repository
Verwandte Berufe SOC
Basierend auf der SOC-Berufsklassifikation
Reference for querying the Atlas knowledge graph through its MCP tools — the SECONDARY enrichment/comparison layer that adds best-practice context to systems you have ALREADY scanned from your real sources (`az`, repos, dirs). Use when you need to look up nodes, edges, kinds, clusters, stats, or wiki pages in Atlas to compare against your real inventory. (atlas graph, query atlas, atlas mcp, search the graph, graph neighbors, atlas record, atlas kinds, enrichment layer)
Atlas turns your STATED NEED into a real systems atlas by SCANNING your actual sources (Azure via `az`, git repos, local dirs) and process/data mining them, THEN enriching against the Atlas knowledge graph. Use this skill when asked to inventory/map your real systems, scan your cloud + repos + directories, mine the real processes or data they contain, or collect their real constraints/gotchas. (atlas, scan my systems, inventory our azure account, map my repos, real systems atlas, process mining, data mining, collect nuances, system discovery)
assimilate-popular-workflows This skill should be used when the user asks to "find skills in the wild", "assimilate popular workflows", "discover SKILL.md files in repos", "research external skills", "find workflow patterns", "survey the skill landscape", "what skills exist out there", or wants to investigate public repositories for extractable processes, babysitter plugins, and reusable procedural insights. Searches GitHub for SKILL.md files, classifies repos by archetype, and maintains structured research under docs/reference-repos/.
name effect-systems description Expert skill for designing and implementing algebraic effect systems including effect annotation, inference, handlers, polymorphism, and row-based effect typing. allowed-tools Read, Write, Edit, Bash, Glob, Grep graph {"domains":["domain:software-engineering"],"specializations":["specialization:programming-languages"],"skillAreas":["skill-area:language-design","skill-area:compiler-implementation"],"roles":["role:backend-engineer"]}
Effect Systems Skill
Design and implement algebraic effect systems for tracking and handling computational effects in programming languages.
Capabilities
Design effect annotation syntax
Implement effect inference algorithms
Implement effect checking and tracking
Design effect handlers (algebraic effects)
Handle effect polymorphism
Implement effect rows and extensibility
Design effect subtyping
Generate effect-based optimizations
Usage
Invoke this skill when you need to:
Add an effect system to a language
Implement algebraic effects and handlers
Track computational effects in types
Design effect polymorphism
Inputs
Parameter Type Required Description
effectModel string Yes Model (algebraic, monadic, capability)
inferenceStrategy string Yes Strategy (annotated, inferred, mixed)
features array No Features to implement
builtinEffects array No Built-in effects to include
Effect Model Options {
"effectModel" : "algebraic" ,
"effectModel" : "monadic" ,
"effectModel" : "capability"
}
Feature Options {
"features" : [
"effect-inference" ,
"effect-handlers" ,
"effect-polymorphism" ,
"effect-rows" ,
"effect-subtyping" ,
"effect-abstraction" ,
"resumption-control" ,
"multi-shot-continuations"
]
}
Output Structure effect-system/
├── syntax/
│ ├── effect-annotation.grammar # Effect annotation syntax
│ ├── effect-handler.grammar # Handler syntax
│ └── effect-operation.grammar # Operation syntax
├── typing/
│ ├── effect-types.ts # Effect type definitions
│ ├── effect-inference.ts # Effect inference
│ ├── effect-checking.ts # Effect checking
│ └── effect-rows.ts # Row polymorphism
├── handlers/
│ ├── handler-impl.ts # Handler implementation
│ ├── continuation.ts # Continuation management
│ └── resumption.ts # Resumption handling
├── runtime/
│ ├── effect-runtime.ts # Runtime effect support
│ └── builtin-effects.ts # Built-in effects
└── tests/
├── inference.test.ts
├── handlers.test.ts
└── polymorphism.test.ts
Effect System Types
Algebraic Effects (Koka-style)
effect State <S> {
get (): S
put (s : S): ()
}
effect Exception <E> {
raise (e : E): Nothing
}
type EffectType = {
operations : Map <string , OperationType >;
}
interface OperationType {
name : string ;
params : Type [];
result : Type ;
}
interface FunctionType {
params : Type [];
result : Type ;
effects : EffectRow ;
}
type EffectRow =
| { type : 'empty' }
| { type : 'single' ; effect : EffectType }
| { type : 'union' ; effects : EffectType [] }
| { type : 'variable' ; name : string }
| { type : 'extend' ; base : EffectRow ; effect : EffectType };
Effect Handlers
handle expr with {
return (x) -> returnClause (x),
get () -> getClause (resume),
put (s) -> putClause (s, resume)
}
interface Handler {
effect : EffectType ;
returnClause : (value : any ) => any ;
operationClauses : Map <string , OperationClause >;
}
interface OperationClause {
operation : string ;
params : string [];
resumeName : string ;
body : Expr ;
}
function typeHandler (
expr : Expr ,
handler : Handler ,
env : TypeEnv
): { resultType : Type ; remainingEffects : EffectRow } {
const exprType = inferType (expr, env);
checkHandlerCovers (handler, exprType.effects );
const resultType = inferHandlerResult (handler, exprType.result , env);
const remainingEffects = removeEffect (exprType.effects , handler.effect );
return { resultType, remainingEffects };
}
Effect Inference
function inferEffects (expr : Expr , env : TypeEnv ): InferResult {
switch (expr.type ) {
case 'var' :
return { type : lookupType (env, expr.name ), effects : emptyRow () };
case 'lambda' :
const bodyResult = inferEffects (expr.body , extendEnv (env, expr.param , expr.paramType ));
return {
type : { type : 'function' , param : expr.paramType , result : bodyResult.type , effects : bodyResult.effects },
effects : emptyRow ()
};
case 'app' :
const fnResult = inferEffects (expr.fn , env);
const argResult = inferEffects (expr.arg , env);
const fnType = fnResult.type as FunctionType ;
return {
type : fnType.result ,
effects : unionRows (fnResult.effects , argResult.effects , fnType.effects )
};
case 'perform' :
const opType = lookupOperation (env, expr.effect , expr.operation );
const argEffects = expr.args .map (a => inferEffects (a, env).effects );
return {
type : opType.result ,
effects : unionRows (singleRow (expr.effect ), ...argEffects)
};
case 'handle' :
const exprResult = inferEffects (expr.body , env);
const handlerResult = checkHandler (expr.handler , exprResult, env);
return handlerResult;
}
}
Effect Polymorphism
interface EffectPolymorphicType {
effectVars : string [];
typeVars : string [];
type : Type ;
}
type RowVariable = { type : 'rowVar' ; name : string };
function unifyRows (row1 : EffectRow , row2 : EffectRow ): Substitution {
if (row1.type === 'variable' ) {
return { [row1.name ]: row2 };
}
if (row2.type === 'variable' ) {
return { [row2.name ]: row1 };
}
if (row1.type === 'empty' && row2.type === 'empty' ) {
return {};
}
}
Continuation Management
interface Continuation <A, B> {
resume (value : A): B;
}
interface MultiShotContinuation <A, B> extends Continuation <A, B> {
clone (): MultiShotContinuation <A, B>;
}
interface OneShotContinuation <A, B> extends Continuation <A, B> {
readonly consumed : boolean ;
}
class ContinuationCapture {
capture<A, B>(
prompt : Prompt ,
body : (k : Continuation <A, B> ) => B
): B {
const k = captureDelimited (prompt);
return body (k);
}
}
Built-in Effects
const builtinEffects = {
IO : {
operations : {
print : { params : [StringType ], result : UnitType },
readLine : { params : [], result : StringType },
readFile : { params : [StringType ], result : StringType },
writeFile : { params : [StringType , StringType ], result : UnitType }
}
},
State : {
typeParams : ['S' ],
operations : {
get : { params : [], result : TypeVar ('S' ) },
put : { params : [TypeVar ('S' )], result : UnitType }
}
},
Exception : {
typeParams : ['E' ],
operations : {
raise : { params : [TypeVar ('E' )], result : NothingType }
}
},
Async : {
operations : {
await : { params : [PromiseType (TypeVar ('A' ))], result : TypeVar ('A' ) },
spawn : { params : [FunctionType ([], TypeVar ('A' ), AsyncEffect )], result : TaskType (TypeVar ('A' )) }
}
},
NonDet : {
operations : {
choice : { params : [], result : BoolType },
fail : { params : [], result : NothingType }
}
}
};
Effect-Based Optimization
function canOptimize (fn : FunctionType ): OptimizationLevel {
if (isEmptyRow (fn.effects )) {
return 'pure' ;
}
if (onlyReads (fn.effects )) {
return 'read-only' ;
}
if (isLocalState (fn.effects )) {
return 'local-state' ;
}
return 'effectful' ;
}
function eliminateDeadCode (expr : Expr ): Expr {
const effects = inferEffects (expr);
if (isEmptyRow (effects) && !isUsed (expr)) {
return unit;
}
return expr;
}
Workflow
Design effect syntax - Declarations, annotations, handlers
Define effect types - Operations, rows, polymorphism
Implement inference - Effect inference algorithm
Build effect checker - Verify effect annotations
Implement handlers - Handler evaluation/compilation
Add continuations - Delimited continuation support
Create builtins - Common effects (IO, State, etc.)
Generate tests - Inference, handlers, polymorphism
Best Practices Applied
Row polymorphism for flexible effect composition
Clear distinction between operations and handlers
Support both inferred and annotated effects
Efficient continuation representation
Effect-based optimization opportunities
Good error messages for effect mismatches
References
Target Processes
effect-system-design.js
type-system-implementation.js
concurrency-primitives.js