requirements
Skill8 starsChanged 9 months agoMITView on GitHub
This skill should be used when the user asks about "Effect services", "dependency injection", "Effect.Tag", "Context.Tag", "Layer", "Effect.provide", "Effect.provideService", "service implementation", "managing dependencies", "Layer.succeed", "Layer.effect", "Layer.scoped", "composing layers", "Layer.merge", "Layer.provide", "default services", "layer memoization", "testability", "test layers", "mock services", or needs to understand how Effect handles the Requirements (R) type parameter.
- Reads credentials
11 other projects use a version of this.
Adopted by
Most recently taken up by
- byshahriar/skill-forgetheir own version, first seen Aug 29, 2026
- dewil/ai-toolkittheir own version, first seen Aug 25, 2026
- marcusbelz/di2-starter-kittheir own version, first seen Jul 17, 2026
- ptsilivis/autonomousguytheir own version, first seen Jul 4, 2026
- aborroy/aiup-alfrescotheir own version, first seen Jun 22, 2026
- GenKerensky/pi-cartographertheir own version, first seen Jun 14, 2026
Used with
Projects with it also use architecture and plan.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
AnthropicSkillarchitecture
Create or evaluate an architecture decision record (ADR). Use when choosing between technologies (e.g., Kafka vs SQS), documenting a design decision with trade-offs and consequences, reviewing a system design proposal, or designing a new component from requirements and constraints.
Also in 4 projects that use this
BlockSkillplan
Draft a TDD, PRD, or lightweight plan in the conversation without committing it.
Also in 3 projects that use this
Other versions11 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 11
- ptsilivis/autonomousguy★ 34same name
- aborroy/aiup-alfresco★ 14same name
- dewil/ai-toolkit★ 9same name
- websublime/mister-anderson★ 3same name
- Modular-Earth-LLC/solutions-architecture-agent★ 2same name
- mitchdowd/skills★ 1same name
- stoffl6781/claude-skill★ 1same name
- AI-Driven-School/aiki★ 0same name
- byshahriar/skill-forge★ 0same name
- GenKerensky/pi-cartographer★ 0same name
1 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository23 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- references/llms-full.txtllms.txt
- api-doc-lookupSkill
- batching-cachingSkill
- code-styleSkill
- concurrencySkill
- configurationSkill
- data-typesSkill
- effect-aiSkill
- effect-coreSkill
- error-managementSkill
- ObservabilitySkill
- pattern-matchingSkill
- platformSkill
- resourcesSkill
- runtimeSkill
- schedulingSkill
- schemaSkill
- sinksSkill
- stateSkill
- streamsSkill
- testingSkill
- traitsSkill
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 1 is distinctive, and 2 are very specific to this project.
0
Common
Most of the 8 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 224
Use Layer.succeed for services that don't need to track state:
- Very specific: line 235
Use Layer.effect with Ref for services that need to maintain state:
- Distinctive: line 320
Search for these sections:
“Common” is measured: kept by at least 6 in 10 of the 8 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Requirements Management in Effect
Overview
The third type parameter in Effect<A, E, R> represents requirements - services and dependencies the effect needs to run:
Effect<Success, Error, Requirements>;
// ^^^^^^^^^^^^ Services neededEffect uses a powerful dependency injection system based on Context and Layer.
The primary reason to define services is testability. Every external dependency (API calls, databases, file systems, third-party SDKs) MUST be wrapped in a Context.Tag service so that tests can provide a test implementation instead of hitting real systems. This is how Effect achieves 100% test coverage — business logic depends only on service interfaces, and tests swap in test layers that control all I/O.
Defining Services
Using Effect.Tag (Recommended)
import { Effect, Context } from "effect";
// Define service interface and tag together
class UserRepository extends Context.Tag("UserRepository")<
UserRepository,
{
readonly findById: (id: string) => Effect.Effect<User, UserNotFound>;
readonly save: (user: User) => Effect.Effect<void>;
}
>() {}
// Using the service
const program = Effect.gen(function* () {
const repo = yield* UserRepository;
const user = yield* repo.findById("123");
return user;
});
// Type: Effect<User, UserNotFound, UserRepository>Alternative: Context.Tag Directly
interface UserRepository {
readonly findById: (id: string) => Effect.Effect<User, UserNotFound>;
}
const UserRepository = Context.Tag<UserRepository>("UserRepository");Using Services
const program = Effect.gen(function* () {
const userRepo = yield* UserRepository;
const emailService = yield* EmailService;
const user = yield* userRepo.findById(userId);
yield* emailService.send(user.email, "Welcome!");
});Creating Layers
Layers are recipes for building services:
Layer.succeed - Simple Value
const LoggerLive = Layer.succeed(Logger, {
log: (msg) => Effect.sync(() => console.log(msg)),
});Layer.effect - Effect-Based Construction
const ConfigLive = Layer.effect(
Config,
Effect.gen(function* () {
const env = yield* Effect.sync(() => process.env);
return {
apiUrl: env.API_URL ?? "http://localhost:3000",
debug: env.DEBUG === "true",
};
}),
);Layer.scoped - Resource with Lifecycle
const DatabaseLive = Layer.scoped(
Database,
Effect.gen(function* () {
const pool = yield* Effect.acquireRelease(createPool(), (pool) => Effect.promise(() => pool.end()));
return {
query: (sql) => Effect.promise(() => pool.query(sql)),
};
}),
);Layer.function - From Function
const HttpClientLive = Layer.function(HttpClient, (baseUrl: string) => ({
get: (path) => Effect.tryPromise(() => fetch(baseUrl + path)),
}));Providing Dependencies
Effect.provide - Provide Layer
const program = getUserById("123");
const runnable = program.pipe(Effect.provide(AppLive));
await Effect.runPromise(runnable);Effect.provideService - Provide Single Service
const runnable = program.pipe(
Effect.provideService(UserRepository, {
findById: (id) => Effect.succeed(mockUser),
save: (user) => Effect.void,
}),
);Composing Layers
Layer.merge - Combine Independent Layers
const InfraLive = Layer.merge(DatabaseLive, LoggerLive);Layer.provide - Layer Dependencies
const UserRepositoryLive = Layer.effect(
UserRepository,
Effect.gen(function* () {
const db = yield* Database;
return {
findById: (id) => db.query(`SELECT * FROM users WHERE id = ${id}`),
};
}),
);
const FullUserRepo = UserRepositoryLive.pipe(Layer.provide(DatabaseLive));Layer.provideMerge - Provide and Keep
const Combined = UserRepositoryLive.pipe(Layer.provideMerge(DatabaseLive));Building Application Layers
Typical Pattern
const InfraLive = Layer.mergeAll(DatabaseLive, LoggerLive, HttpClientLive);
const RepositoryLive = Layer.mergeAll(UserRepositoryLive, OrderRepositoryLive).pipe(Layer.provide(InfraLive));
const ServiceLive = Layer.mergeAll(UserServiceLive, OrderServiceLive).pipe(Layer.provide(RepositoryLive));
const AppLive = ServiceLive.pipe(Layer.provide(InfraLive));Layer Memoization
Layers are memoized by default - each service is created once:
const AppLive = Layer.mergeAll(UserServiceLive, OrderServiceLive).pipe(Layer.provide(DatabaseLive));Fresh Layers (No Memoization)
const FreshDatabase = Layer.fresh(DatabaseLive);Default Services
Effect provides default implementations for common services:
const program = Effect.gen(function* () {
const now = yield* Clock.currentTimeMillis;
const random = yield* Random.next;
});Overriding Defaults
import { TestClock } from "effect";
const testProgram = program.pipe(Effect.provide(TestClock.layer));Testing with Services (CRITICAL for 100% Coverage)
Every service MUST have a test layer. This is how you achieve complete test coverage without hitting real external systems.
Simple Test Layer (Stateless)
Use Layer.succeed for services that don't need to track state:
const EmailServiceTest = Layer.succeed(EmailService, {
send: (to, subject, body) => Effect.void, // No-op in tests
sendBulk: (recipients, subject, body) => Effect.void,
});Stateful Test Layer (Repositories)
Use Layer.effect with Ref for services that need to maintain state:
const UserRepositoryTest = Layer.effect(
UserRepository,
Effect.gen(function* () {
const store = yield* Ref.make<Map<string, User>>(new Map());
return {
findById: (id: string) =>
Effect.gen(function* () {
const users = yield* Ref.get(store);
return yield* Option.match(Option.fromNullable(users.get(id)), {
onNone: () => Effect.fail(new UserNotFound({ userId: id })),
onSome: Effect.succeed,
}).pipe(Effect.flatten);
}),
save: (user: User) => Ref.update(store, (m) => new Map(m).set(user.id, user)),
};
}),
);Composing Test Layers
const TestEnv = Layer.mergeAll(UserRepositoryTest, EmailServiceTest, PaymentGatewayTest);Using Test Layers with @effect/vitest
import { it, expect, layer } from "@effect/vitest";
import { Effect } from "effect";
layer(TestEnv)("UserService", (it) => {
it.effect("should create user and send welcome email", () =>
Effect.gen(function* () {
const repo = yield* UserRepository;
const email = yield* EmailService;
const user = new User({ id: "1", name: "Alice", email: "alice@test.com" });
yield* repo.save(user);
yield* email.send(user.email, "Welcome!", "Hello Alice");
const found = yield* repo.findById("1");
expect(found.name).toBe("Alice");
}),
);
});Combining Test Layers with Property Testing
The ultimate testing pattern — service test layers control all I/O, Arbitrary generates all data:
layer(TestEnv)("UserService Properties", (it) => {
it.effect.prop("should save and retrieve any valid user", [Arbitrary.make(User)], ([user]) =>
Effect.gen(function* () {
const repo = yield* UserRepository;
yield* repo.save(user);
const found = yield* repo.findById(user.id);
expect(found).toEqual(user);
}),
);
});Best Practices
- Define service interface with Tag - Keeps interface and tag together
- ALWAYS create a test layer for every service - This is required, not optional. Without test layers, your code is untestable.
- Wrap ALL external dependencies in services - API calls, database queries, file I/O, third-party SDKs, email, caches, queues — everything external MUST go through a service
- Use Layer.scoped for resources - Ensures proper cleanup
- Compose layers bottom-up - Infrastructure → Repositories → Services
- Keep layers focused - One service per layer typically
- Name convention -
*Livefor production layers,*Testfor test layers (e.g.,UserRepositoryLive,UserRepositoryTest) - Use
Layer.effectwithReffor stateful test layers - Repositories and caches need state tracking - Combine test layers with Arbitrary - Services control I/O, Arbitrary generates data — together they enable 100% coverage
Additional Resources
For comprehensive requirements management documentation, consult ${CLAUDE_PLUGIN_ROOT}/references/llms-full.txt.
Search for these sections:
- "Managing Services" for service patterns
- "Managing Layers" for layer composition
- "Layer Memoization" for sharing services
- "Default Services" for built-in services
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
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.

