|
| 1 | +--- |
| 2 | +name: create-specifica-feature |
| 3 | +description: > |
| 4 | + Step-by-step guide for creating a new Specifica feature folder with |
| 5 | + spec.md and design.md. Use when adding a new feature, workflow, or |
| 6 | + cross-cutting concern to spec/ or middleware/{component}/spec/. |
| 7 | + Also covers where to place the folder (project-level vs component-level) |
| 8 | + and how to register a link in AGENTS.md. |
| 9 | +--- |
| 10 | + |
| 11 | +# Creating a Specifica Feature |
| 12 | + |
| 13 | +[Specifica](https://specifica.org) organises software specs as plain Markdown |
| 14 | +files in a directory: one folder per feature, three optional files |
| 15 | +(`spec.md`, `design.md`, `tasks.md`). |
| 16 | + |
| 17 | +--- |
| 18 | + |
| 19 | +## 1. Choose the Right Location |
| 20 | + |
| 21 | +| Concern | Location | |
| 22 | +| ------- | -------- | |
| 23 | +| Affects multiple components, or belongs to no single component | `spec/<feature>/` (project-level) | |
| 24 | +| Internal to one component | `middleware/<component>/spec/<feature>/` (component-level) | |
| 25 | + |
| 26 | +**Rule of thumb:** if the spec would need to be copied if a second component |
| 27 | +appeared, it is project-level. |
| 28 | + |
| 29 | +--- |
| 30 | + |
| 31 | +## 2. Create the Folder |
| 32 | + |
| 33 | +Use kebab-case names that describe the feature. |
| 34 | + |
| 35 | +```bash |
| 36 | +# component-level example |
| 37 | +mkdir -p middleware/sql_to_arc/spec/<feature> |
| 38 | + |
| 39 | +# project-level example |
| 40 | +mkdir -p spec/<feature> |
| 41 | +``` |
| 42 | + |
| 43 | +--- |
| 44 | + |
| 45 | +## 3. Write `spec.md` — The *What* |
| 46 | + |
| 47 | +`spec.md` captures **requirements**: what the feature must do, in testable, |
| 48 | +checkbox form. Keep implementation details out. |
| 49 | + |
| 50 | +```markdown |
| 51 | +# <Feature Title> |
| 52 | + |
| 53 | +One-sentence description of purpose and context. Include the trigger |
| 54 | +condition and the expected output or side-effect. |
| 55 | + |
| 56 | +## Requirements |
| 57 | + |
| 58 | +- [ ] <Single, testable behaviour — one sentence> |
| 59 | +- [ ] <Another behaviour> |
| 60 | +- [ ] ... |
| 61 | + |
| 62 | +## Edge Cases |
| 63 | + |
| 64 | +<Scenario> → <Expected outcome>. |
| 65 | + |
| 66 | +<Another scenario> → <Expected outcome>. |
| 67 | +``` |
| 68 | + |
| 69 | +**Rules for requirements:** |
| 70 | + |
| 71 | +- One behaviour per checkbox — if you need "and" it is two requirements. |
| 72 | +- State the outcome, not the implementation (`→ return 404` not `→ use Flask abort()`). |
| 73 | +- Every edge case ends with a concrete outcome — no open-ended statements. |
| 74 | + |
| 75 | +--- |
| 76 | + |
| 77 | +## 4. Write `design.md` — The *How* |
| 78 | + |
| 79 | +`design.md` captures **decisions**: how it works and why. Skip obvious |
| 80 | +implementation details; focus on non-obvious choices and trade-offs. |
| 81 | + |
| 82 | +```markdown |
| 83 | +# <Feature Title> — Design |
| 84 | + |
| 85 | +## <Architecture / Module Overview> |
| 86 | + |
| 87 | +Brief description or diagram of the main components and their |
| 88 | +responsibilities. |
| 89 | + |
| 90 | +## Key Decisions |
| 91 | + |
| 92 | +1. **<Decision title>** |
| 93 | + — <Reasoning. What alternatives were considered and why they were |
| 94 | + rejected.> |
| 95 | + |
| 96 | +2. **<Decision title>** |
| 97 | + — <Reasoning.> |
| 98 | +``` |
| 99 | + |
| 100 | +**Rules for Key Decisions:** |
| 101 | + |
| 102 | +- Every decision has a stated reason (the `—` clause is mandatory). |
| 103 | +- "We chose X over Y because Z" is the target sentence structure. |
| 104 | +- Decisions are numbered so they can be referenced from code comments |
| 105 | + or other specs. |
| 106 | + |
| 107 | +--- |
| 108 | + |
| 109 | +## 5. Write `tasks.md` — The *Work* (optional) |
| 110 | + |
| 111 | +`tasks.md` is an ordered checklist. Use it for multi-step implementation |
| 112 | +work or migrations. Omit it for completed or stable features. |
| 113 | + |
| 114 | +```markdown |
| 115 | +# <Feature Title> — Tasks |
| 116 | + |
| 117 | +- [ ] <First step (no dependencies)> |
| 118 | +- [ ] <Second step> |
| 119 | +- [x] <Already done> |
| 120 | +``` |
| 121 | + |
| 122 | +Tasks are ordered by dependency. Checked boxes = done. Tools can parse |
| 123 | +and update `tasks.md` programmatically — keep entries flat and unambiguous. |
| 124 | + |
| 125 | +--- |
| 126 | + |
| 127 | +## 6. Register in `AGENTS.md` |
| 128 | + |
| 129 | +Add a link under the **Architecture & Design** section so every agent can |
| 130 | +discover the new spec. |
| 131 | + |
| 132 | +```markdown |
| 133 | +- **[`middleware/sql_to_arc/spec/<feature>/`](...)** — Short description. |
| 134 | +``` |
| 135 | + |
| 136 | +Use a relative path from the repository root. |
| 137 | + |
| 138 | +--- |
| 139 | + |
| 140 | +## 7. Project Conventions |
| 141 | + |
| 142 | +These rules apply specifically to this project (see also |
| 143 | +[`spec/principles.md`](../../../spec/principles.md)): |
| 144 | + |
| 145 | +- `spec.md` never restates database view definitions — reference |
| 146 | + `docs/sql_to_arc_database_views.md` instead. |
| 147 | +- Requirements that are already captured in `spec/principles.md` |
| 148 | + (typing, `uv`, `os.environ`) are **not** repeated in feature specs. |
| 149 | +- Design decisions that affect public API types go in the component-level |
| 150 | + spec, not the project-level spec. |
| 151 | +- `tasks.md` is optional and should be removed once the feature is fully |
| 152 | + implemented to avoid stale checklists. |
0 commit comments