skills I believed were committed

This commit is contained in:
2026-06-12 22:08:36 +01:00
parent 8450f90e89
commit e05572bcec
9 changed files with 183 additions and 116 deletions
+25 -17
View File
@@ -57,20 +57,24 @@ If the user already has a user story (e.g., from `user-stories.md`), use that. O
Work through the user story using Example Mapping. For each rule, identify:
### Rules (yellow) — Domain concepts
- Nouns and concepts in the domain
- What the system manages
- Example: "Health", "Damage", "Character", "Level", "Faction"
### Examples (blue) — Concrete scenarios
- Specific instances of rules
- Should be testable
- Example: "Character with 500 health takes 200 damage → 300 health"
### Questions (pink) — Ambiguities
- Things we don't know or aren't sure about
- Example: "What happens when damage exceeds health?"
### Answers (green) — Resolved questions
- Write directly on the pink sticky
- Example: "Health becomes 0, character dies"
@@ -82,18 +86,22 @@ Create a structured output like this:
## Example Map: [User Story Title]
### Rules
1. [Rule description]
2. [Rule description]
### Examples
- [Example 1]
- [Example 2]
### Questions
- [Question 1]
- [Question 2]
### Answers
- [Answer to Question 1]
- [Answer to Question 2]
```
@@ -171,13 +179,10 @@ Translate Allium invariants and rules into fast-check properties.
import fc from 'fast-check';
// "Health is never negative"
fc.property(
fc.integer({ min: 0, max: 10000 }),
(health) => {
const c = new Character({ health: Health.create(health) });
return c.health.value >= 0;
}
);
fc.property(fc.integer({ min: 0, max: 10000 }), (health) => {
const c = new Character({ health: Health.create(health) });
return c.health.value >= 0;
});
```
#### Rule Properties (State Transitions)
@@ -191,7 +196,7 @@ fc.property(
const c = new Character({ health: Health.create(health) });
c.takeDamage(Damage.create(damage));
return c.health.value === Math.max(0, health - damage);
}
},
);
```
@@ -199,14 +204,11 @@ fc.property(
```typescript
// "Zero damage changes nothing"
fc.property(
fc.integer({ min: 0, max: 10000 }),
(health) => {
const c = new Character({ health: Health.create(health) });
c.takeDamage(Damage.create(0));
return c.health.value === health;
}
);
fc.property(fc.integer({ min: 0, max: 10000 }), (health) => {
const c = new Character({ health: Health.create(health) });
c.takeDamage(Damage.create(0));
return c.health.value === health;
});
```
### Property Naming
@@ -250,7 +252,9 @@ class Health {
return level >= 6 ? 1500 : 1000;
}
get value(): number { return this.value; }
get value(): number {
return this.value;
}
add(amount: number): Health {
return Health.create(Math.min(this.value + amount, Health.maxForLevel(this.level.value)));
@@ -321,20 +325,24 @@ Here's a complete example walking through "Characters can Deal Damage":
### Example Map
**Rules:**
1. Damage is subtracted from Health
2. When damage exceeds health, health becomes 0 and character dies
3. A Character cannot Deal Damage to itself
**Examples:**
- Character with 1000 health takes 200 damage → 800 health
- Character with 100 health takes 200 damage → 0 health, dead
- Character tries to deal damage to self → no effect
**Questions:**
- Can a dead character take damage?
- Does damage stack across multiple attacks?
**Answers:**
- Dead characters cannot take damage (they're already dead)
- Yes, damage stacks (each attack reduces health further)