spec-feature 1.0.7 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -165
- package/bin/cli.js +112 -19
- package/package.json +2 -2
- package/spec/constitution/00-purpose-and-precedence.md +19 -0
- package/spec/constitution/01-scope-and-non-goals.md +19 -0
- package/spec/constitution/02-evidence-and-no-hallucinations.md +23 -0
- package/spec/constitution/03-questions-and-unknowns.md +23 -0
- package/spec/constitution/04-change-discipline-minimal-diff.md +21 -0
- package/spec/constitution/05-tools-and-command-policy.md +20 -0
- package/spec/constitution/06-spec-feature-workflow-guardrails.md +22 -0
- package/spec/constitution/07-quality-gates-definition-of-done.md +19 -0
- package/spec/constitution/08-security-secrets-and-privacy.md +19 -0
- package/spec/constitution/09-communication-contract.md +20 -0
- package/spec/constitution/10-git-and-release-policy.md +19 -0
- package/spec/constitution/99-glossary.md +8 -0
- package/spec/constitution/README.md +30 -0
- package/spec/core/hotfix.md +3 -0
- package/spec/core/plan.md +3 -0
- package/spec/core/spec.md +3 -0
- package/spec/core/tasks.md +6 -0
- package/spec/core/verify.md +4 -0
- package/spec/feature.md +4 -0
package/README.md
CHANGED
|
@@ -4,203 +4,98 @@
|
|
|
4
4
|
|
|
5
5
|
**Turn your idea into a ready development plan in minutes!**
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Create technical specifications, plans, and tasks for your development team using AI from a single description.
|
|
8
8
|
|
|
9
|
-
## 🎯
|
|
9
|
+
## 🎯 Benefits
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
The specification becomes the single source of truth — no more guessing about what you intended to build.
|
|
13
|
-
|
|
14
|
-
### **🤝 Fewer misunderstandings between human and AI**
|
|
15
|
-
Clear "contracts" / specifications help avoid "vibe coding" — when AI "guesses" your intentions and often builds something not quite what you need.
|
|
16
|
-
|
|
17
|
-
### **📚 Architecture and decisions are documented**
|
|
18
|
-
"Why did we choose this solution?" will be captured in the specification, not in emails, chats, or someone's head.
|
|
19
|
-
|
|
20
|
-
### **✅ Controlled task breakdown**
|
|
21
|
-
Small tasks are easier to review, test, and correct — fewer "big commits that are hard to understand".
|
|
22
|
-
|
|
23
|
-
### **🔄 Flexibility and evolution**
|
|
24
|
-
Specifications are not "dead" — they can be updated, refactored, and revised when requirements change.
|
|
25
|
-
|
|
26
|
-
### **🤖 AI assistant integration**
|
|
27
|
-
Specification + plan + tasks give AI "context" and boundaries within which it can generate code more safely.
|
|
11
|
+
✨ Clear project start • 🤝 Fewer misunderstandings • 📚 Documented architecture • ✅ Controlled tasks • 🔄 Easy updates • 🤖 Better AI integration
|
|
28
12
|
|
|
29
13
|
## ⚡ Quick Start
|
|
30
14
|
|
|
31
|
-
### 🚀 Using npx (recommended)
|
|
32
|
-
|
|
33
|
-
The easiest way to get started with Spec Feature:
|
|
34
|
-
|
|
35
15
|
```bash
|
|
36
|
-
# Initialize
|
|
16
|
+
# Initialize in current directory
|
|
37
17
|
npx spec-feature init
|
|
38
18
|
|
|
39
|
-
#
|
|
19
|
+
# Or with custom folder name
|
|
40
20
|
npx spec-feature init my-project-docs
|
|
41
21
|
```
|
|
42
22
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
23
|
+
Creates the Spec Feature structure inside `spec/` by default, or inside the folder name you provide.
|
|
24
|
+
|
|
25
|
+
## 📁 Structure
|
|
26
|
+
|
|
27
|
+
```mermaid
|
|
28
|
+
graph TD
|
|
29
|
+
A[spec/] --> B[README.md]
|
|
30
|
+
A --> C[feature.md]
|
|
31
|
+
A --> D[core/]
|
|
32
|
+
A --> E[features/]
|
|
33
|
+
|
|
34
|
+
D --> F[spec.md]
|
|
35
|
+
D --> G[plan.md]
|
|
36
|
+
D --> H[tasks.md]
|
|
37
|
+
D --> I[verify.md]
|
|
38
|
+
D --> J[hotfix.md]
|
|
39
|
+
|
|
40
|
+
E --> K[user-auth/]
|
|
41
|
+
K --> L[spec.md]
|
|
42
|
+
K --> M[plan.md]
|
|
43
|
+
K --> N[tasks.md]
|
|
44
|
+
K --> O[verify-report.md]
|
|
55
45
|
```
|
|
56
46
|
|
|
57
|
-
|
|
47
|
+
**Templates** (core/) → **Features** (features/)
|
|
58
48
|
|
|
59
|
-
|
|
49
|
+
## 🎬 Workflow
|
|
60
50
|
|
|
61
|
-
|
|
62
|
-
npm install spec-feature
|
|
63
|
-
|
|
64
|
-
# Add to package.json scripts
|
|
65
|
-
{
|
|
66
|
-
"scripts": {
|
|
67
|
-
"init-spec": "spec-feature init",
|
|
68
|
-
"init-docs": "spec-feature init documentation"
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
```
|
|
51
|
+
**Send these prompts to your AI assistant** (Claude, Cursor, Copilot, etc.) to create, execute, and update features.
|
|
72
52
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
### 🏗️ Initial structure (created during initialization)
|
|
76
|
-
```
|
|
77
|
-
/spec
|
|
78
|
-
├── README.md ← this guide
|
|
79
|
-
├── feature.md ← main template for launching spec-feature
|
|
80
|
-
└── core ← base templates for specific stages
|
|
81
|
-
├── spec.md ← specification structure
|
|
82
|
-
├── plan.md ← technical plan structure
|
|
83
|
-
├── tasks.md ← task list structure
|
|
84
|
-
├── verify.md ← verification report structure
|
|
85
|
-
└── hotfix.md ← hotfix and update structure
|
|
86
|
-
```
|
|
53
|
+
### 1️⃣ Create Feature
|
|
87
54
|
|
|
88
|
-
### 🎯 Full structure (after creating the first feature)
|
|
89
55
|
```
|
|
90
|
-
/
|
|
91
|
-
|
|
92
|
-
├── feature.md ← main template for launching spec-feature
|
|
93
|
-
├── core ← base templates for specific stages
|
|
94
|
-
│ ├── spec.md ← specification structure
|
|
95
|
-
│ ├── plan.md ← technical plan structure
|
|
96
|
-
│ ├── tasks.md ← task list structure
|
|
97
|
-
│ ├── verify.md ← verification report structure
|
|
98
|
-
│ └── hotfix.md ← hotfix and update structure
|
|
99
|
-
└── features ← folder with feature materials (created automatically)
|
|
100
|
-
├── <feature> ← specific feature folder (e.g., `user-auth`)
|
|
101
|
-
│ ├── spec.md ← current specification
|
|
102
|
-
│ ├── plan.md ← technical plan
|
|
103
|
-
│ ├── tasks.md ← implementation checklist
|
|
104
|
-
│ └── verify-report.md (optional) — verification log
|
|
105
|
-
└── ... ← other features created from templates
|
|
56
|
+
Use the template from spec/feature.md.
|
|
57
|
+
#feature-name# Your description here
|
|
106
58
|
```
|
|
107
59
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
## 🎬 Getting Started
|
|
111
|
-
|
|
112
|
-
To create a feature specification, use the `spec/feature.md` template with any AI Assistant that can create folders and files (such as `Claude Code`, `Gemini CLI`, `Codex CLI`, `Copilot`, `Cursor`, etc.).
|
|
113
|
-
|
|
114
|
-
### 📝 Input parameter format
|
|
60
|
+
Format: `#feature# description` → creates `spec/features/feature-name/` with 3 files:
|
|
115
61
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
62
|
+
```mermaid
|
|
63
|
+
flowchart LR
|
|
64
|
+
A[feature.md template] --> B[spec.md]
|
|
65
|
+
A --> C[plan.md]
|
|
66
|
+
A --> D[tasks.md]
|
|
67
|
+
```
|
|
120
68
|
|
|
121
|
-
###
|
|
69
|
+
### 2️⃣ Execute Tasks
|
|
122
70
|
|
|
123
71
|
```
|
|
124
|
-
|
|
125
|
-
#user-auth# Need to add user authentication via email and password. The user should be able to register, log in, and recover their password. Integration with the existing notification system is mandatory.
|
|
72
|
+
Execute all tasks in spec/features/{FEATURE}/tasks.md
|
|
126
73
|
```
|
|
127
74
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
## 🚀 Launching Task Execution
|
|
138
|
-
|
|
139
|
-
After creating the specification and plan, you can proceed with implementation:
|
|
140
|
-
|
|
141
|
-
1. **🎯 Launch task execution**
|
|
142
|
-
```
|
|
143
|
-
Execute all tasks in `spec/features/{FEATURE}/tasks.md`
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
2. **⚡ What happens during execution**
|
|
147
|
-
- AI assistant sequentially executes tasks from the checklist
|
|
148
|
-
- Each completed task is marked as finished
|
|
149
|
-
- When problems arise, the assistant may request clarifications
|
|
150
|
-
- Progress can be tracked by updating checkboxes in `tasks.md`
|
|
151
|
-
|
|
152
|
-
3. **📝 Example for user-auth feature**
|
|
153
|
-
```
|
|
154
|
-
Execute all tasks in `spec/features/user-auth/tasks.md`
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
## ✅ What Happens After Task Execution
|
|
158
|
-
|
|
159
|
-
After completing all tasks, automatic verification is launched:
|
|
160
|
-
|
|
161
|
-
1. **🔍 Automatic verification**
|
|
162
|
-
- AI assistant uses the `spec/core/verify.md` template
|
|
163
|
-
- Compares implemented functionality with requirements from `spec.md`
|
|
164
|
-
- Checks compliance with the technical plan from `plan.md`
|
|
165
|
-
|
|
166
|
-
2. **📊 Verification results**
|
|
167
|
-
- A report `spec/features/{FEATURE}/verify-report.md` is created
|
|
168
|
-
- Task statuses in `tasks.md` are updated (✅ completed / ❌ requires refinement)
|
|
169
|
-
- Found discrepancies and recommendations are recorded
|
|
170
|
-
|
|
171
|
-
3. **📋 Verification report content**
|
|
172
|
-
- Summary of completed tasks
|
|
173
|
-
- List of found problems
|
|
174
|
-
- Recommendations for fixes
|
|
175
|
-
- Assessment of feature readiness for production
|
|
176
|
-
|
|
177
|
-
## 🔄 Updating Existing Feature
|
|
75
|
+
```mermaid
|
|
76
|
+
flowchart TD
|
|
77
|
+
A[tasks.md] --> B[Task 1]
|
|
78
|
+
B --> C[Task 2]
|
|
79
|
+
C --> D[Task N]
|
|
80
|
+
D --> E[All Complete]
|
|
81
|
+
E --> F[Auto Verification]
|
|
82
|
+
F --> G[verify-report.md]
|
|
83
|
+
```
|
|
178
84
|
|
|
179
|
-
|
|
85
|
+
### 3️⃣ Update Feature
|
|
180
86
|
|
|
181
|
-
**📝 Update example:**
|
|
182
87
|
```
|
|
183
88
|
Use the template from spec/feature.md.
|
|
184
|
-
#
|
|
89
|
+
#feature-name# New requirements
|
|
185
90
|
```
|
|
186
91
|
|
|
187
|
-
|
|
92
|
+
Overwrites spec.md, plan.md, tasks.md with updated content.
|
|
188
93
|
|
|
189
94
|
## 🛠️ Troubleshooting
|
|
190
95
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
- **✅ Solution:** Check task numbering in `tasks.md` and reorder if necessary
|
|
198
|
-
|
|
199
|
-
**❌ Problem:** Verification doesn't launch automatically
|
|
200
|
-
- **✅ Solution:** Make sure all tasks in `tasks.md` are marked as completed, then manually launch verification:
|
|
201
|
-
```
|
|
202
|
-
Use the template from spec/core/verify.md to verify spec/features/{FEATURE}/
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
**❌ Problem:** Conflict when updating existing feature
|
|
206
|
-
- **✅ Solution:** Create a backup of current files before updating or use git to track changes
|
|
96
|
+
| Problem | Solution |
|
|
97
|
+
|---------|----------|
|
|
98
|
+
| No feature folder created | Check format `#feature# context` |
|
|
99
|
+
| Wrong task order | Reorder numbers in tasks.md |
|
|
100
|
+
| Verification not launched | All tasks must be checked, or run manually: `Use template from spec/core/verify.md to verify spec/features/{FEATURE}/` |
|
|
101
|
+
| Update conflicts | Use git to track changes |
|
package/bin/cli.js
CHANGED
|
@@ -7,48 +7,141 @@ import { fileURLToPath } from "url";
|
|
|
7
7
|
const __filename = fileURLToPath(import.meta.url);
|
|
8
8
|
const __dirname = path.dirname(__filename);
|
|
9
9
|
|
|
10
|
+
const DEFAULT_FOLDER = "spec";
|
|
10
11
|
const args = process.argv.slice(2);
|
|
11
12
|
const command = args[0];
|
|
12
13
|
|
|
14
|
+
const AGENTS_START = "<!-- spec-feature:agents:start -->";
|
|
15
|
+
const AGENTS_END = "<!-- spec-feature:agents:end -->";
|
|
16
|
+
|
|
13
17
|
if (command === "init") {
|
|
14
18
|
const targetDir = process.cwd();
|
|
15
|
-
const folderName = args[1] ||
|
|
19
|
+
const folderName = args[1] || DEFAULT_FOLDER;
|
|
16
20
|
const destinationDir = path.join(targetDir, folderName);
|
|
17
|
-
const
|
|
21
|
+
const templateDir = path.join(__dirname, "..", DEFAULT_FOLDER);
|
|
22
|
+
|
|
23
|
+
if (!fs.existsSync(templateDir)) {
|
|
24
|
+
console.error(`❌ Template directory not found: ${templateDir}`);
|
|
25
|
+
process.exit(1);
|
|
26
|
+
}
|
|
18
27
|
|
|
19
|
-
function copyRecursive(src, dest) {
|
|
28
|
+
function copyRecursive(src, dest, relative = "") {
|
|
20
29
|
const stat = fs.statSync(src);
|
|
21
|
-
|
|
30
|
+
|
|
22
31
|
if (stat.isDirectory()) {
|
|
23
32
|
if (!fs.existsSync(dest)) {
|
|
24
33
|
fs.mkdirSync(dest, { recursive: true });
|
|
34
|
+
if (relative) {
|
|
35
|
+
console.log(`Created: ${folderName}/${relative}`);
|
|
36
|
+
}
|
|
25
37
|
}
|
|
26
|
-
|
|
27
|
-
|
|
38
|
+
|
|
39
|
+
fs.readdirSync(src).forEach(entry => {
|
|
40
|
+
const nextRelative = relative ? `${relative}/${entry}` : entry;
|
|
41
|
+
copyRecursive(path.join(src, entry), path.join(dest, entry), nextRelative);
|
|
28
42
|
});
|
|
29
|
-
|
|
30
|
-
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (fs.existsSync(dest)) {
|
|
47
|
+
console.log(`Skipped (already exists): ${folderName}/${relative}`);
|
|
48
|
+
return;
|
|
31
49
|
}
|
|
50
|
+
|
|
51
|
+
fs.copyFileSync(src, dest);
|
|
52
|
+
console.log(`Created: ${folderName}/${relative}`);
|
|
32
53
|
}
|
|
33
54
|
|
|
34
|
-
// Create the destination directory if it doesn't exist
|
|
35
55
|
if (!fs.existsSync(destinationDir)) {
|
|
36
56
|
fs.mkdirSync(destinationDir, { recursive: true });
|
|
37
57
|
}
|
|
38
58
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
59
|
+
copyRecursive(templateDir, destinationDir);
|
|
60
|
+
|
|
61
|
+
const agentsWorkflowBlock = `${AGENTS_START}
|
|
62
|
+
|
|
63
|
+
## spec-feature workflow
|
|
64
|
+
|
|
65
|
+
This repository uses **spec-feature** to define features as structured documents before implementation.
|
|
66
|
+
|
|
67
|
+
### Templates origin
|
|
68
|
+
|
|
69
|
+
The \`spec/\` directory is generated by running \`npx spec-feature init\` in the repository root (typically by a human during project setup). Treat files under \`spec/core/\` as canonical templates for creating and updating feature artifacts.
|
|
70
|
+
|
|
71
|
+
### Structure
|
|
72
|
+
|
|
73
|
+
- \`spec/core/\` — templates: \`spec.md\`, \`plan.md\`, \`tasks.md\`, \`verify.md\`, \`hotfix.md\`
|
|
74
|
+
- \`spec/feature.md\` — unified prompt template to create/update a feature
|
|
75
|
+
- \`spec/features/<feature>/{spec.md,plan.md,tasks.md}\` — generated feature artifacts
|
|
76
|
+
- \`spec/features/<feature>/verify-report.md\` — verification output (after tasks / manual verify)
|
|
77
|
+
|
|
78
|
+
### Create or update a feature
|
|
42
79
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
80
|
+
Use the template from \`spec/feature.md\` and provide input as:
|
|
81
|
+
|
|
82
|
+
\`#<feature># <context>\`
|
|
83
|
+
|
|
84
|
+
Result: create/update the folder \`spec/features/<feature>/\` and produce \`spec.md\` → \`plan.md\` → \`tasks.md\`.
|
|
85
|
+
|
|
86
|
+
### Execute tasks
|
|
87
|
+
|
|
88
|
+
When implementation is requested, execute tasks from:\n\n- \`spec/features/<feature>/tasks.md\`
|
|
89
|
+
|
|
90
|
+
### Verify
|
|
91
|
+
|
|
92
|
+
Use \`spec/core/verify.md\` to verify \`spec/features/<feature>/\` and write \`verify-report.md\`.
|
|
93
|
+
|
|
94
|
+
### Quality bar (for generated artifacts)
|
|
95
|
+
|
|
96
|
+
- No empty headers, no placeholders
|
|
97
|
+
- \`spec.md\`: at least 3 user stories + explicit assumptions
|
|
98
|
+
- \`plan.md\`: references concrete decisions from \`spec.md\` (avoid generic plans)
|
|
99
|
+
- \`tasks.md\`: checkable, ordered, references concrete paths under \`spec/features/<feature>/\`
|
|
100
|
+
- If updating an existing feature, prefer updating existing files; use \`spec/core/hotfix.md\` to describe changes
|
|
101
|
+
|
|
102
|
+
${AGENTS_END}
|
|
103
|
+
`;
|
|
104
|
+
|
|
105
|
+
const agentsPath = path.join(targetDir, "AGENTS.md");
|
|
106
|
+
const agentsBlockRegex = new RegExp(
|
|
107
|
+
`${escapeRegExp(AGENTS_START)}[\\s\\S]*?${escapeRegExp(AGENTS_END)}`,
|
|
108
|
+
"m",
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
try {
|
|
112
|
+
if (!fs.existsSync(agentsPath)) {
|
|
113
|
+
const initialAgents = `# AGENTS\n\n${agentsWorkflowBlock}\n`;
|
|
114
|
+
fs.writeFileSync(agentsPath, initialAgents, "utf8");
|
|
115
|
+
console.log("Created: AGENTS.md");
|
|
46
116
|
} else {
|
|
47
|
-
|
|
117
|
+
const existingAgents = fs.readFileSync(agentsPath, "utf8");
|
|
118
|
+
if (existingAgents.includes(AGENTS_START) && existingAgents.includes(AGENTS_END)) {
|
|
119
|
+
const updatedAgents = existingAgents.replace(agentsBlockRegex, agentsWorkflowBlock).replace(/\s*$/, "\n");
|
|
120
|
+
if (updatedAgents !== existingAgents) {
|
|
121
|
+
fs.writeFileSync(agentsPath, updatedAgents, "utf8");
|
|
122
|
+
console.log("Updated: AGENTS.md (spec-feature block)");
|
|
123
|
+
} else {
|
|
124
|
+
console.log("Skipped: AGENTS.md (spec-feature block unchanged)");
|
|
125
|
+
}
|
|
126
|
+
} else {
|
|
127
|
+
const trimmed = existingAgents.replace(/\s*$/, "");
|
|
128
|
+
const appendedAgents = `${trimmed}\n\n${agentsWorkflowBlock}\n`;
|
|
129
|
+
fs.writeFileSync(agentsPath, appendedAgents, "utf8");
|
|
130
|
+
console.log("Appended: AGENTS.md (spec-feature workflow)");
|
|
131
|
+
}
|
|
48
132
|
}
|
|
49
|
-
})
|
|
133
|
+
} catch (err) {
|
|
134
|
+
console.error("❌ Failed to write AGENTS.md:", err?.message || err);
|
|
135
|
+
process.exit(1);
|
|
136
|
+
}
|
|
50
137
|
|
|
51
138
|
console.log(`✅ Spec Feature initialized in '${folderName}' folder!`);
|
|
52
|
-
|
|
53
|
-
|
|
139
|
+
process.exit(0);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
console.log("Usage: npx spec-feature init [folder-name]");
|
|
143
|
+
process.exit(1);
|
|
144
|
+
|
|
145
|
+
function escapeRegExp(str) {
|
|
146
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
54
147
|
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Purpose and precedence
|
|
2
|
+
|
|
3
|
+
## Rules
|
|
4
|
+
|
|
5
|
+
- MUST treat `spec/constitution/*` as the highest-priority constraints for agent behavior and project workflow.
|
|
6
|
+
- MUST NOT override a constitution rule by “common sense” or best practices unless the constitution explicitly allows it.
|
|
7
|
+
- MUST keep rules **specific and testable** (avoid vague statements like “write clean code”).
|
|
8
|
+
- SHOULD record constitution changes as small diffs and mention the reason.
|
|
9
|
+
|
|
10
|
+
## How to verify
|
|
11
|
+
|
|
12
|
+
- Check that any instruction set or template used for work includes “Read and follow `spec/constitution/*` first”.
|
|
13
|
+
- If a conflict is detected, confirm the chosen action matches the precedence described in `spec/constitution/README.md`.
|
|
14
|
+
|
|
15
|
+
## Exceptions
|
|
16
|
+
|
|
17
|
+
- If the user explicitly requests to violate a constitution rule, MUST pause and ask for confirmation acknowledging the deviation.
|
|
18
|
+
|
|
19
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Scope and non-goals
|
|
2
|
+
|
|
3
|
+
## Rules
|
|
4
|
+
|
|
5
|
+
- MUST only do what the user explicitly requested and/or what is explicitly listed in the current `spec/features/{FEATURE}/tasks.md`.
|
|
6
|
+
- MUST NOT add “nice-to-have” improvements, refactors, cleanups, dependency upgrades, formatting-only changes, or architectural rewrites unless explicitly requested.
|
|
7
|
+
- MUST keep changes limited to the minimal set of files required to satisfy the request.
|
|
8
|
+
- SHOULD clarify scope boundaries in writing before starting implementation if scope is ambiguous.
|
|
9
|
+
|
|
10
|
+
## How to verify
|
|
11
|
+
|
|
12
|
+
- Every changed file can be mapped to a specific task item or explicit user request.
|
|
13
|
+
- No unrelated changes (renames, reformatting, refactors) are present in diffs.
|
|
14
|
+
|
|
15
|
+
## Exceptions
|
|
16
|
+
|
|
17
|
+
- Emergency fixes (security/production outage) are allowed only if explicitly declared as such by the user or incident context.
|
|
18
|
+
|
|
19
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Evidence and no hallucinations
|
|
2
|
+
|
|
3
|
+
## Rules
|
|
4
|
+
|
|
5
|
+
- MUST NOT invent facts about the codebase, infrastructure, requirements, or runtime behavior.
|
|
6
|
+
- MUST base any claim about the repository on observable evidence:
|
|
7
|
+
- existing files, configs, logs, tests, or explicit user messages.
|
|
8
|
+
- MUST cite the exact source when making a factual claim (file path; ideally the relevant snippet).
|
|
9
|
+
- MUST write `No data — needs clarification: <specific question>` when information is missing.
|
|
10
|
+
- SHOULD separate facts from proposals:
|
|
11
|
+
- Facts: evidence-backed.
|
|
12
|
+
- Proposals: clearly labeled as suggestions.
|
|
13
|
+
|
|
14
|
+
## How to verify
|
|
15
|
+
|
|
16
|
+
- For every statement like “the project uses X”, there is a matching file/config reference.
|
|
17
|
+
- Unknown areas are marked with “No data — needs clarification…”, not guessed.
|
|
18
|
+
|
|
19
|
+
## Exceptions
|
|
20
|
+
|
|
21
|
+
- None. If evidence is not available, ask or stop.
|
|
22
|
+
|
|
23
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Questions and unknowns
|
|
2
|
+
|
|
3
|
+
## Rules
|
|
4
|
+
|
|
5
|
+
- MUST ask clarifying questions when:
|
|
6
|
+
- requirements are ambiguous,
|
|
7
|
+
- success criteria are unclear,
|
|
8
|
+
- there are multiple valid implementations with different tradeoffs,
|
|
9
|
+
- actions would be destructive or expensive.
|
|
10
|
+
- MUST prefer 1–2 high-impact questions over a long questionnaire.
|
|
11
|
+
- MUST propose sensible defaults as options (without executing them unless confirmed).
|
|
12
|
+
- MUST stop and wait if the missing information blocks a correct implementation.
|
|
13
|
+
|
|
14
|
+
## How to verify
|
|
15
|
+
|
|
16
|
+
- Ambiguous inputs always produce clarifying questions and a short list of options.
|
|
17
|
+
- Blocking unknowns are not silently assumed.
|
|
18
|
+
|
|
19
|
+
## Exceptions
|
|
20
|
+
|
|
21
|
+
- If the user explicitly authorizes choosing defaults, the chosen defaults MUST be recorded in the spec/plan/tasks.
|
|
22
|
+
|
|
23
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Change discipline and minimal diff
|
|
2
|
+
|
|
3
|
+
## Rules
|
|
4
|
+
|
|
5
|
+
- MUST make the smallest possible change set that satisfies acceptance criteria.
|
|
6
|
+
- MUST NOT reformat or reorder unrelated code.
|
|
7
|
+
- MUST NOT change public contracts (APIs, CLI, schemas) without explicit requirement and explicit migration notes.
|
|
8
|
+
- MUST keep edits localized; avoid wide refactors unless explicitly requested.
|
|
9
|
+
- SHOULD document any non-obvious change rationale in a short note (spec/plan/tasks or PR description).
|
|
10
|
+
|
|
11
|
+
## How to verify
|
|
12
|
+
|
|
13
|
+
- Diff contains only relevant files/lines.
|
|
14
|
+
- No purely stylistic changes outside the requested scope.
|
|
15
|
+
- Contract changes include explicit notes and verification steps.
|
|
16
|
+
|
|
17
|
+
## Exceptions
|
|
18
|
+
|
|
19
|
+
- Mechanical renames or formatting changes are allowed only if explicitly requested by the user.
|
|
20
|
+
|
|
21
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Tools and command policy
|
|
2
|
+
|
|
3
|
+
## Rules
|
|
4
|
+
|
|
5
|
+
- MUST prefer repository-local evidence over external assumptions.
|
|
6
|
+
- MUST NOT run destructive commands without explicit user approval (delete, reset, force, migrations on production, etc.).
|
|
7
|
+
- MUST keep command execution minimal and non-interactive by default.
|
|
8
|
+
- MUST describe why a command is needed before running it.
|
|
9
|
+
- MUST NOT introduce new dependencies, services, or build steps unless explicitly requested.
|
|
10
|
+
|
|
11
|
+
## How to verify
|
|
12
|
+
|
|
13
|
+
- Every command has a clear purpose tied to a task.
|
|
14
|
+
- No new dependencies appear without an explicit requirement.
|
|
15
|
+
|
|
16
|
+
## Exceptions
|
|
17
|
+
|
|
18
|
+
- None unless explicitly requested by the user.
|
|
19
|
+
|
|
20
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# spec-feature workflow guardrails
|
|
2
|
+
|
|
3
|
+
## Rules
|
|
4
|
+
|
|
5
|
+
- MUST keep all spec-feature artifacts under `spec/`.
|
|
6
|
+
- MUST follow the sequence:
|
|
7
|
+
- specification (`spec.md`) → plan (`plan.md`) → tasks (`tasks.md`) → execution → verification (`verify-report.md`).
|
|
8
|
+
- MUST NOT execute implementation tasks unless the user explicitly requests execution and references `spec/features/{FEATURE}/tasks.md`.
|
|
9
|
+
- MUST keep `spec.md`, `plan.md`, and `tasks.md` consistent (terms, components, constraints).
|
|
10
|
+
- MUST update `tasks.md` checkboxes to reflect actual state during verification.
|
|
11
|
+
- SHOULD update the constitution when a feature introduces a new invariant or process rule.
|
|
12
|
+
|
|
13
|
+
## How to verify
|
|
14
|
+
|
|
15
|
+
- No implementation begins before an explicit request referencing `spec/features/{FEATURE}/tasks.md`.
|
|
16
|
+
- Artifacts exist and are consistent (no contradictory terms/constraints).
|
|
17
|
+
|
|
18
|
+
## Exceptions
|
|
19
|
+
|
|
20
|
+
- Hotfixes: follow `spec/core/hotfix.md` rules for synchronized updates of `spec.md`, `plan.md`, `tasks.md`.
|
|
21
|
+
|
|
22
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Quality gates and Definition of Done
|
|
2
|
+
|
|
3
|
+
## Rules
|
|
4
|
+
|
|
5
|
+
- MUST define “done” as meeting the criteria in `tasks.md` Definition of Done.
|
|
6
|
+
- MUST NOT mark tasks as complete without running the required checks (tests, linters, manual scenarios) stated in the task.
|
|
7
|
+
- MUST record verification output under `spec/features/{FEATURE}/verify-report.md` when the workflow requires it.
|
|
8
|
+
- SHOULD prefer automated checks and keep manual steps explicit and repeatable.
|
|
9
|
+
|
|
10
|
+
## How to verify
|
|
11
|
+
|
|
12
|
+
- Completed checkboxes have corresponding evidence (test output, report, or documented manual steps).
|
|
13
|
+
- Verification report exists when required and reflects the real state.
|
|
14
|
+
|
|
15
|
+
## Exceptions
|
|
16
|
+
|
|
17
|
+
- If checks cannot run (environment limits), MUST document the reason and the alternative evidence required.
|
|
18
|
+
|
|
19
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Security, secrets, and privacy
|
|
2
|
+
|
|
3
|
+
## Rules
|
|
4
|
+
|
|
5
|
+
- MUST NOT expose secrets (tokens, keys, passwords) in code, logs, specs, or examples.
|
|
6
|
+
- MUST treat user data and sensitive data as confidential by default.
|
|
7
|
+
- MUST avoid copying sensitive production data into tickets/specs.
|
|
8
|
+
- SHOULD prefer secure-by-default settings and least-privilege access.
|
|
9
|
+
|
|
10
|
+
## How to verify
|
|
11
|
+
|
|
12
|
+
- No secrets appear in diffs, specs, or logs.
|
|
13
|
+
- Any introduced config or documentation does not include real credentials.
|
|
14
|
+
|
|
15
|
+
## Exceptions
|
|
16
|
+
|
|
17
|
+
- None. Use placeholders for secrets.
|
|
18
|
+
|
|
19
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Communication contract
|
|
2
|
+
|
|
3
|
+
## Rules
|
|
4
|
+
|
|
5
|
+
- MUST communicate constraints and uncertainty explicitly.
|
|
6
|
+
- MUST separate facts from proposals.
|
|
7
|
+
- MUST provide short, high-signal progress updates during long tasks.
|
|
8
|
+
- MUST keep the final summary concise and actionable.
|
|
9
|
+
- MUST follow repository-specific language rules if defined by the user or the project.
|
|
10
|
+
|
|
11
|
+
## How to verify
|
|
12
|
+
|
|
13
|
+
- Updates are tied to progress and do not contain invented facts.
|
|
14
|
+
- Output includes clear next steps when blockers exist.
|
|
15
|
+
|
|
16
|
+
## Exceptions
|
|
17
|
+
|
|
18
|
+
- None.
|
|
19
|
+
|
|
20
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Git and release policy
|
|
2
|
+
|
|
3
|
+
## Rules
|
|
4
|
+
|
|
5
|
+
- MUST NOT create commits unless the user explicitly requests it.
|
|
6
|
+
- MUST keep commit messages in English if project rules require it.
|
|
7
|
+
- MUST not change git history (rebase, force-push) without explicit approval.
|
|
8
|
+
- SHOULD keep changes reviewable and grouped by purpose.
|
|
9
|
+
|
|
10
|
+
## How to verify
|
|
11
|
+
|
|
12
|
+
- No commits exist unless requested.
|
|
13
|
+
- Any commit message format follows project rules.
|
|
14
|
+
|
|
15
|
+
## Exceptions
|
|
16
|
+
|
|
17
|
+
- None unless explicitly requested by the user.
|
|
18
|
+
|
|
19
|
+
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Glossary
|
|
2
|
+
|
|
3
|
+
- **Constitution**: a set of highest-priority, project-wide rules constraining agent and contributor behavior.
|
|
4
|
+
- **Evidence**: observable repository/user-provided sources (files, configs, logs, tests, explicit messages) used to justify factual claims.
|
|
5
|
+
- **Scope**: the work explicitly requested by the user and/or explicitly listed in `spec/features/{FEATURE}/tasks.md`.
|
|
6
|
+
- **Hallucination**: any invented fact or claim not supported by evidence.
|
|
7
|
+
|
|
8
|
+
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Project Constitution (spec-feature)
|
|
2
|
+
|
|
3
|
+
This folder contains **project-wide rules** that constrain AI agents and human contributors.
|
|
4
|
+
The goal is to prevent hallucinations, scope creep, and unreviewed changes by enforcing a strict, verifiable workflow.
|
|
5
|
+
|
|
6
|
+
## How to use
|
|
7
|
+
|
|
8
|
+
- Read and follow **all** files in `spec/constitution/` before making any changes.
|
|
9
|
+
- If there is a conflict between documents:
|
|
10
|
+
- Constitution rules override feature specs and plans.
|
|
11
|
+
- Feature specs override implementation plans.
|
|
12
|
+
- Plans override task list details only where explicitly stated.
|
|
13
|
+
- Update the constitution when a feature introduces a new invariant, workflow constraint, or quality gate.
|
|
14
|
+
|
|
15
|
+
## File index
|
|
16
|
+
|
|
17
|
+
- `00-purpose-and-precedence.md`
|
|
18
|
+
- `01-scope-and-non-goals.md`
|
|
19
|
+
- `02-evidence-and-no-hallucinations.md`
|
|
20
|
+
- `03-questions-and-unknowns.md`
|
|
21
|
+
- `04-change-discipline-minimal-diff.md`
|
|
22
|
+
- `05-tools-and-command-policy.md`
|
|
23
|
+
- `06-spec-feature-workflow-guardrails.md`
|
|
24
|
+
- `07-quality-gates-definition-of-done.md`
|
|
25
|
+
- `08-security-secrets-and-privacy.md`
|
|
26
|
+
- `09-communication-contract.md`
|
|
27
|
+
- `10-git-and-release-policy.md`
|
|
28
|
+
- `99-glossary.md`
|
|
29
|
+
|
|
30
|
+
|
package/spec/core/hotfix.md
CHANGED
|
@@ -9,8 +9,11 @@ Template automates feature maintenance after release: records hotfixes and synch
|
|
|
9
9
|
|
|
10
10
|
**General rules**
|
|
11
11
|
|
|
12
|
+
- Before doing anything, read and follow `spec/constitution/*`.
|
|
13
|
+
- If information is missing, write `No data — needs clarification: <what exactly>` and do not guess.
|
|
12
14
|
- Work only in the `spec/features/{FEATURE}/` directory: allowed to edit `spec.md`, `plan.md`, and `tasks.md`.
|
|
13
15
|
- Do not create new files in the feature folder (including `hotfix.md` and verification reports).
|
|
16
|
+
- Do not generate application code, configuration snippets, scripts, or patches while documenting the hotfix.
|
|
14
17
|
- Preserve the structure of existing documents: do not delete sections, do not leave empty headers and hints from templates.
|
|
15
18
|
- All changes should consider requirements from specification and plan, maintaining consistency of terms and references.
|
|
16
19
|
- Actual task state must be reflected in `tasks.md`: do not allow desynchronization between checkboxes and actual state.
|
package/spec/core/plan.md
CHANGED
|
@@ -9,7 +9,10 @@ Template helps format the feature implementation plan in the **spec-feature** pr
|
|
|
9
9
|
|
|
10
10
|
**General rules**
|
|
11
11
|
|
|
12
|
+
- Before doing anything, read and follow `spec/constitution/*`.
|
|
13
|
+
- If information is missing, write `No data — needs clarification: <what exactly>` and do not guess.
|
|
12
14
|
- Work only with specification files within `/spec` directory: automatically create necessary directories and files.
|
|
15
|
+
- Do not generate application code, configuration snippets, scripts, or patches while preparing the implementation plan.
|
|
13
16
|
- Use `spec/core/spec.md` as the specification source on which the plan is formed.
|
|
14
17
|
- Use `spec/features/{FEATURE}/spec.md` as additional context. If the file is unavailable, continue working based on **CONTEXT**.
|
|
15
18
|
- Substitute specific values instead of placeholders (`{FEATURE}`, `{CONTEXT}`, etc.). If a section is not applicable — explicitly write `Not required — reason: <explanation>`.
|
package/spec/core/spec.md
CHANGED
|
@@ -9,7 +9,10 @@ Template helps describe a feature before implementation in the **spec-feature**
|
|
|
9
9
|
|
|
10
10
|
**General rules**
|
|
11
11
|
|
|
12
|
+
- Before doing anything, read and follow `spec/constitution/*`.
|
|
13
|
+
- If information is missing, write `No data — needs clarification: <what exactly>` and do not guess.
|
|
12
14
|
- Work only with specification files within `/spec` directory: automatically create necessary directories and files.
|
|
15
|
+
- Do not generate application code, configuration snippets, scripts, or patches while preparing the specification.
|
|
13
16
|
- Substitute specific values instead of placeholders (`{FEATURE}`, `{CONTEXT}`, etc.). The final document should not contain hints, examples, or `...` markers.
|
|
14
17
|
- The specification header should contain a clear feature name (adapt the **FEATURE** value if necessary).
|
|
15
18
|
- The structure from the template below needs to be filled with content: theses, lists, and tables are allowed, empty sections are not.
|
package/spec/core/tasks.md
CHANGED
|
@@ -9,13 +9,17 @@ Template helps form a task list for feature implementation in the **spec-feature
|
|
|
9
9
|
|
|
10
10
|
**General rules**
|
|
11
11
|
|
|
12
|
+
- Before doing anything, read and follow `spec/constitution/*`.
|
|
13
|
+
- If information is missing, write `No data — needs clarification: <what exactly>` and do not guess.
|
|
12
14
|
- Work only with specification files within `/spec` directory: automatically create necessary directories and files.
|
|
15
|
+
- Do not generate application code, configuration snippets, scripts, or patches while preparing the task list.
|
|
13
16
|
- Use `spec/core/spec.md` and `spec/core/plan.md` as base sources of specification and plan when preparing tasks.
|
|
14
17
|
- Use `spec/features/{FEATURE}/spec.md` and `spec/features/{FEATURE}/plan.md` as additional context. If any file is missing, continue working based on available materials and **CONTEXT**.
|
|
15
18
|
- Substitute specific values instead of placeholders (`{FEATURE}`, `{CONTEXT}`, etc.). The final document should not contain hints, examples, or `...` markers.
|
|
16
19
|
- Each task is a checkbox with result formulation and description of mandatory checks/tests.
|
|
17
20
|
- If a direction is not required, explicitly indicate under the corresponding subheading `Not required — reason: <explanation>`.
|
|
18
21
|
- After filling the document, mark self-check checkboxes in the "Instruction execution control" section.
|
|
22
|
+
- Do not start executing tasks until a separate user request explicitly references `spec/features/{FEATURE}/tasks.md`; ignore execution requests without that reference.
|
|
19
23
|
|
|
20
24
|
**What needs to be revealed in tasks**
|
|
21
25
|
|
|
@@ -44,6 +48,7 @@ Template helps form a task list for feature implementation in the **spec-feature
|
|
|
44
48
|
## Supporting tasks
|
|
45
49
|
|
|
46
50
|
- [ ] Documentation: update relevant instructions and descriptions.
|
|
51
|
+
- [ ] Constitution: update `spec/constitution/*` if this feature introduced a new invariant, workflow constraint, or quality gate. If not required — reason: <explanation>.
|
|
47
52
|
- [ ] Observability: add or clarify metrics, alerts, and/or logging.
|
|
48
53
|
- [ ] Code review and PR: prepare changes for review and accompanying information.
|
|
49
54
|
|
|
@@ -52,6 +57,7 @@ Template helps form a task list for feature implementation in the **spec-feature
|
|
|
52
57
|
- [ ] All tasks are completed and tested.
|
|
53
58
|
- [ ] Relevant unit/e2e/integration tests pass successfully.
|
|
54
59
|
- [ ] Documentation and operational instructions are updated.
|
|
60
|
+
- [ ] Constitution compliance is checked and `spec/constitution/*` is updated if required (otherwise explicitly marked as not required with a reason).
|
|
55
61
|
- [ ] `/spec/core/verify.md` is executed after completing all tasks to verify the task list.
|
|
56
62
|
|
|
57
63
|
```
|
package/spec/core/verify.md
CHANGED
|
@@ -9,7 +9,10 @@ Template helps format the results of automatic task execution verification and m
|
|
|
9
9
|
|
|
10
10
|
**General rules**
|
|
11
11
|
|
|
12
|
+
- Before doing anything, read and follow `spec/constitution/*`.
|
|
13
|
+
- If information is missing, write `No data — needs clarification: <what exactly>` and do not guess.
|
|
12
14
|
- Work only with specification files: do not create code and new directories.
|
|
15
|
+
- Do not generate application code, configuration snippets, scripts, or patches during verification.
|
|
13
16
|
- **REQUIRED:** Always create `spec/features/{FEATURE}/verify-report.md` file as the main output of verification process.
|
|
14
17
|
- Use `spec/features/{FEATURE}/spec.md`, `plan.md`, and `tasks.md` as source data for verification.
|
|
15
18
|
- Check tasks sequentially: after successful verification, mark the corresponding checkbox in `spec/features/{FEATURE}/tasks.md` as `[x]`; when discrepancies are found, leave `[ ]` and record details in the report file.
|
|
@@ -22,6 +25,7 @@ Template helps format the results of automatic task execution verification and m
|
|
|
22
25
|
- `## Task verification results` — list of verified tasks with final status and links to supporting artifacts/proofs.
|
|
23
26
|
- `## Discrepancy log` — brief summary of new entries added to `verify-report.md`, with steps to resolve problems.
|
|
24
27
|
- `## Archiving decision` — final status of verify launch: moving feature to `spec/archived/{FEATURE}` or list of actions for re-verification.
|
|
28
|
+
- Constitution compliance — verify that `tasks.md` includes the Constitution checkbox, and that its status matches the changes introduced by the feature. If it should be updated but was not, record a discrepancy.
|
|
25
29
|
|
|
26
30
|
**Steps**
|
|
27
31
|
|
package/spec/feature.md
CHANGED
|
@@ -11,12 +11,16 @@ Parameters are passed in one line in the format `#<feature># <context>` without
|
|
|
11
11
|
|
|
12
12
|
**General rules**
|
|
13
13
|
|
|
14
|
+
- Before doing anything, read and follow `spec/constitution/*`.
|
|
15
|
+
- If information is missing, write `No data — needs clarification: <what exactly>` and do not guess.
|
|
14
16
|
- Work only with specification files in the `spec/features/{FEATURE}` directory: automatically create necessary directories and files within `/spec` folder only.
|
|
17
|
+
- Do not generate application code, configuration snippets, scripts, or patches while preparing specification artifacts.
|
|
15
18
|
- If the **FEATURE** value matches an already existing feature, update its current materials instead of creating a new folder and use the `spec/core/hotfix.md` template when making changes.
|
|
16
19
|
- Within one request, create/update three separate Markdown documents: `spec.md`, `plan.md`, and `tasks.md` in the appropriate directory structure.
|
|
17
20
|
- Automatically create the directory structure `spec/features/{FEATURE}/` if it doesn't exist.
|
|
18
21
|
- All sections from templates must be filled with content: do not leave empty headers, placeholders, or hint comments.
|
|
19
22
|
- Use sequence: first specification, then plan (based on specification), then task list (based on specification and plan).
|
|
23
|
+
- Implementation work starts only after an explicit user request that references `spec/features/{FEATURE}/tasks.md`; ignore requests to execute tasks if they do not contain that reference.
|
|
20
24
|
- Follow KISS, DRY, and YAGNI requirements: solutions should be implementable without excessive complexity and duplication.
|
|
21
25
|
|
|
22
26
|
**Steps**
|