بنقرة واحدة
use-case-driven-development
Use when implementing any feature or bugfix, before writing implementation code
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Use when implementing any feature or bugfix, before writing implementation code
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Use when completing tasks, implementing major features, or before merging to verify work meets requirements
Use when executing implementation plans with independent tasks in the current session
Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always
Use when you have a spec or requirements for a multi-step task, before touching code
You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent and requirements before producing a product-level spec.
Use when you have a written implementation plan to execute in a separate session with review checkpoints
| name | use-case-driven-development |
| description | Use when implementing any feature or bugfix, before writing implementation code |
Start from an approved writing plan. Confirm the plan already defines the use case flow, core data structures, and interface contracts. Then write an integration test that proves the flow works end to end. Finally, implement the minimum amount of code required to make the current use case pass.
Core principle: You do not need to write fine-grained unit tests for every internal function, but you must control the core data structures, interface boundaries, and complete flow of the use case.
The goal of testing is not to prove that “a certain function is implemented correctly,” but to prove that:
The input, state changes, interface calls, data flow, and output of a real use case are coherent.
Use this for:
Fine-grained unit tests may still be kept when:
Do not start implementation from this skill unless a writing plan exists and is usable.
The writing plan, not this skill, owns detailed planning and contract definition. Before writing implementation code, confirm the plan clearly defines:
PLAN CHECK → INTEGRATION TEST → IMPLEMENT → VERIFY → REFACTOR
This skill does not create the product spec, use case map, or interface contracts. Those are writing-plans work.
Before continuing, locate the relevant implementation plan. If no plan exists, stop and invoke medium-powers:writing-plans first.
The plan must include:
If the plan is missing one of these, stop and repair the plan before writing tests or implementation code.
Use the plan as the boundary for this execution pass.
Confirm:
If implementation reveals that the plan is wrong, update the plan first. Do not silently redesign inside implementation.
The test should cover a complete flow, not an internal function.
A good test focuses on:
test('creates a session and generates an assistant message after the user submits a prompt', async () => {
const app = createTestApp({
agentRunner: fakeAgentRunner({
response: 'Hello, I can help you.'
})
});
const result = await app.submitPrompt({
workspaceId: 'workspace-1',
prompt: 'Hello'
});
const session = await app.sessions.getById(result.sessionId);
expect(session.workspaceId).toBe('workspace-1');
expect(session.status).toBe('completed');
expect(session.messages).toEqual([
{ role: 'user', content: 'Hello' },
{ role: 'assistant', content: 'Hello, I can help you.' }
]);
});
This test verifies the complete use case: entry point, session creation, runner invocation, message writing, and final state.
test('appendMessage works', async () => {
const repo = mockRepo();
await appendMessage(repo, 'session-1', { role: 'user', content: 'hi' });
expect(repo.appendMessage).toHaveBeenCalled();
});
This test only verifies that a mock was called. It does not prove that the flow actually works.
Do not write tests whose main assertion is that old behavior, a removed feature, or an unsupported path no longer works.
If the plan's test target would become that kind of negative test, you may skip creating it. Record that the negative test was skipped and reference only the relevant plan description. Do not invent a broader negative-test suite.
Only implement the code required to make the current use case integration test pass.
Do not implement ahead of time:
It is acceptable to start with a simple, direct, replaceable implementation.
Run the integration test for the corresponding use case.
Confirm that:
If the test fails, fix the implementation first. If the test is hard to write, first check whether the interface boundaries or data structures are unclear.
Refactoring is only allowed after the integration test passes.
Allowed:
Not allowed:
The default testing granularity is:
One integration test group per use case
Instead of:
One test per function
Only mock system boundaries. Do not mock the core business flow.
The core data structures are clear. The interface contracts are clear. The use case flow is clear. The integration test proves that the flow works.
Otherwise, it is not done.