scaffold-agent-specs 0.0.0-stage → 0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 rob-pasc
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,114 @@
1
- # Temporary Holding Version
1
+ # scaffold-agent-specs
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A deliberately small, dependency-free CLI for **spec-driven agentic coding**. It installs reusable Markdown instructions and templates into an existing repository, then creates numbered feature folders only after scope approval.
4
+
5
+ ## Requirements
6
+
7
+ Node.js 20 or newer and npm (for installation or `npx`). The scaffolded repository itself can use **any** programming language or framework.
8
+
9
+ ## Use locally before publishing
10
+
11
+ Download and extract this project, then run:
12
+
13
+ ```sh
14
+ cd scaffold-agent-specs
15
+ npm test
16
+ node bin/scaffold-agent-specs.js --help
17
+
18
+ # Preview what will be created in any repo:
19
+ node bin/scaffold-agent-specs.js init --dir /path/to/your/repo --dry-run
20
+
21
+ # Actually initialize the repo:
22
+ node bin/scaffold-agent-specs.js init --dir /path/to/your/repo
23
+ ```
24
+
25
+ Or use `npm link` from this package directory to install the development command into your PATH:
26
+
27
+ ```sh
28
+ npm link
29
+ cd /path/to/your/repo
30
+ scaffold-agent-specs init
31
+ ```
32
+
33
+ Unlink later with `npm unlink -g scaffold-agent-specs`.
34
+
35
+ ## After publishing to npm
36
+
37
+ From the root of any project:
38
+
39
+ ```sh
40
+ npx scaffold-agent-specs init
41
+ ```
42
+
43
+ When the user and agent have discussed a feature and the user **explicitly accepts its scope**:
44
+
45
+ ```sh
46
+ npx scaffold-agent-specs feature "User statistics page" --approved
47
+ ```
48
+
49
+ This would create `docs/features/feature-001-user-statistics-page/` with these files:
50
+
51
+ - `PLAN.md` for the approved scope, constraints, requirements and proposed approach.
52
+ - `ACCEPTANCE_MATRIX.md` for objective acceptance criteria and verification evidence.
53
+ - `TASKS.md` for the implementation checklist.
54
+
55
+ Optional files can be requested explicitly:
56
+
57
+ ```sh
58
+ npx scaffold-agent-specs feature "Account dashboard" --approved --design --research
59
+ ```
60
+
61
+ `--handoff` additionally creates the optional short-lived `HANDOFF.md`.
62
+
63
+ **Important:** The CLI copies and personalizes headings, IDs, titles, and dates. It **does not invent a feature spec**. Your coding agent must populate the remaining placeholders from the approved conversation, then **stop** until you separately authorize implementation. The `--approved` flag is an acknowledgment; the CLI cannot verify the conversation itself.
64
+
65
+ ## `init` installs
66
+
67
+ ```text
68
+ AGENTS.md
69
+ CLAUDE.md
70
+ .agent-specs/
71
+ templates/
72
+ adr/ADR.md
73
+ conventions/CONVENTION.md
74
+ feature/{PLAN,ACCEPTANCE_MATRIX,TASKS,DESIGN,RESEARCH,HANDOFF}.md
75
+ project/{ARCHITECTURE,GLOSSARY}.md
76
+ docs/
77
+ WORKFLOW.md
78
+ adr/README.md
79
+ features/README.md
80
+ ```
81
+
82
+ No speculative feature, ADR, architecture document, glossary, or convention document is created. Those appear only when needed. The templates in `.agent-specs/` are yours to edit; **the `feature` command reads your repository's copy**, including your customizations, not the package's default templates.
83
+
84
+ ## Commands and safety
85
+
86
+ | Command | Behavior |
87
+ | --- | --- |
88
+ | `init` | Copy the initial scaffold into the current directory. Never overwrite existing files. |
89
+ | `init --dry-run` | Preview which files would be created or skipped. |
90
+ | `feature "Title" --approved` | Create the next `feature-NNN-title/` and its three required docs. |
91
+ | `feature "Title" --approved --design` | Include optional detailed design. |
92
+ | `feature "Title" --approved --research` | Include optional research. |
93
+ | `feature "Title" --approved --handoff` | Include optional handoff. |
94
+ | `feature "Title" --dry-run` | Preview feature creation without confirming approval or writing files. |
95
+ | `--dir PATH` | Work in a specified repository root instead of the current directory. |
96
+ | `--help` / `--version` | Show help or the CLI version. |
97
+
98
+ Feature IDs are allocated above the **largest existing** feature ID, starting at `001`. Running `init` again adds newly missing files but never replaces modified ones. Before updating the scaffold in a future release, review the changes and merge into customized files manually. `init` refuses to write through symlinked paths under the chosen root.
99
+
100
+ There is intentionally no `implement` command: an agent should follow `AGENTS.md` and `docs/WORKFLOW.md` and wait for a separate implementation instruction. ADRs can be created from `.agent-specs/templates/adr/ADR.md` once architectural decisions are adopted.
101
+
102
+ ## Develop
103
+
104
+ ```sh
105
+ npm test # Built-in Node.js test runner
106
+ npm run pack:check # Preview npm-published file manifest
107
+ npm pack # Produce local npm tarball for testing
108
+ ```
109
+
110
+ For publication instructions, see [`PUBLISHING.md`](PUBLISHING.md).
111
+
112
+ ## License
113
+
114
+ MIT
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env node
2
+ import { run } from '../lib/cli.js';
3
+
4
+ try {
5
+ run(process.argv.slice(2));
6
+ } catch (error) {
7
+ console.error(`Error: ${error.message}`);
8
+ process.exitCode = 1;
9
+ }
package/lib/cli.js ADDED
@@ -0,0 +1,73 @@
1
+ import fs from 'node:fs';
2
+ import { fileURLToPath } from 'node:url';
3
+ import { initProject, createFeature } from './scaffold.js';
4
+
5
+ const help = `scaffold-agent-specs: spec-driven scaffolding for coding agents
6
+
7
+ Usage:
8
+ scaffold-agent-specs init [--dir PATH] [--dry-run]
9
+ scaffold-agent-specs feature "Feature title" --approved [options]
10
+ scaffold-agent-specs --version
11
+ scaffold-agent-specs --help
12
+
13
+ Options for feature:
14
+ --approved Confirm the user explicitly approved the feature's scope
15
+ --design Include optional DESIGN.md
16
+ --research Include optional RESEARCH.md
17
+ --handoff Include optional HANDOFF.md
18
+ --dry-run Preview without writing; approval not required for a preview
19
+ --dir PATH Target repository root (default: current directory)
20
+
21
+ The CLI copies templates, but does not generate a specification or implement code.
22
+ Your agent must fill the documents from the approved discussion and stop before implementation.
23
+ Existing files are never overwritten by init.
24
+ `;
25
+
26
+ export function run(args) {
27
+ if (!args.length || args.includes('--help') || args.includes('-h') || args[0] === 'help') {
28
+ console.log(help);
29
+ return;
30
+ }
31
+ if (args.length === 1 && (args[0] === '--version' || args[0] === '-v')) {
32
+ const pkg = JSON.parse(fs.readFileSync(fileURLToPath(new URL('../package.json', import.meta.url)), 'utf8'));
33
+ console.log(pkg.version);
34
+ return;
35
+ }
36
+ const [command, ...rest] = args;
37
+ if (!['init', 'feature'].includes(command)) throw new Error(`Unknown command: ${command}. Try --help.`);
38
+
39
+ const flags = new Set();
40
+ const positionals = [];
41
+ let dir = process.cwd();
42
+ const allowed = command === 'init' ? new Set(['--dry-run']) : new Set(['--dry-run', '--approved', '--design', '--research', '--handoff']);
43
+
44
+ for (let i = 0; i < rest.length; i++) {
45
+ const argument = rest[i];
46
+ if (argument === '--dir') {
47
+ if (i + 1 >= rest.length || rest[i + 1].startsWith('--')) throw new Error('Missing path after --dir.');
48
+ dir = rest[++i];
49
+ } else if (argument.startsWith('--dir=')) {
50
+ dir = argument.slice('--dir='.length);
51
+ if (!dir) throw new Error('Missing path after --dir=.');
52
+ } else if (allowed.has(argument)) {
53
+ flags.add(argument);
54
+ } else if (argument.startsWith('-')) {
55
+ throw new Error(`Unknown option: ${argument}`);
56
+ } else {
57
+ positionals.push(argument);
58
+ }
59
+ }
60
+ if (command === 'init') {
61
+ if (positionals.length) throw new Error('init takes no positional arguments.');
62
+ initProject(dir, { dryRun: flags.has('--dry-run') });
63
+ return;
64
+ }
65
+ if (!positionals.length) throw new Error('Missing feature title. Try `feature "User statistics page" --approved`.');
66
+ createFeature(dir, positionals.join(' '), {
67
+ approved: flags.has('--approved'),
68
+ design: flags.has('--design'),
69
+ research: flags.has('--research'),
70
+ handoff: flags.has('--handoff'),
71
+ dryRun: flags.has('--dry-run'),
72
+ });
73
+ }
@@ -0,0 +1,175 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+
5
+ export const bundledScaffold = fileURLToPath(new URL('../scaffold/', import.meta.url));
6
+ const requiredFeatureFiles = ['PLAN.md', 'ACCEPTANCE_MATRIX.md', 'TASKS.md'];
7
+ const optionalFeatureFiles = ['DESIGN.md', 'RESEARCH.md', 'HANDOFF.md'];
8
+
9
+ function assertDirectory(dir) {
10
+ let stats;
11
+ try {
12
+ stats = fs.statSync(dir);
13
+ } catch {
14
+ throw new Error(`Target directory does not exist: ${dir}`);
15
+ }
16
+ if (!stats.isDirectory()) throw new Error(`Not a directory: ${dir}`);
17
+ }
18
+
19
+ function pathExists(p) {
20
+ try {
21
+ fs.lstatSync(p);
22
+ return true;
23
+ } catch (error) {
24
+ if (error.code === 'ENOENT') return false;
25
+ throw error;
26
+ }
27
+ }
28
+
29
+ // Refuse to write through existing symlinked descendants of the chosen root.
30
+ // This also prevents accidentally writing through a symlink under docs/.
31
+ function assertSafePath(root, destination) {
32
+ const relative = path.relative(root, destination);
33
+ if (relative === '..' || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative)) {
34
+ throw new Error(`Refusing to write outside target directory: ${destination}`);
35
+ }
36
+ let current = root;
37
+ for (const component of relative.split(path.sep)) {
38
+ if (!component) continue;
39
+ current = path.join(current, component);
40
+ if (pathExists(current) && fs.lstatSync(current).isSymbolicLink()) {
41
+ throw new Error(`Refusing to write through symlink: ${current}`);
42
+ }
43
+ }
44
+ }
45
+
46
+ function getBundledFiles(dir, base = dir) {
47
+ return fs.readdirSync(dir, { withFileTypes: true }).flatMap((item) => {
48
+ const full = path.join(dir, item.name);
49
+ if (item.isDirectory()) return getBundledFiles(full, base);
50
+ if (!item.isFile()) throw new Error(`Unsupported scaffold entry: ${full}`);
51
+ return [path.relative(base, full)];
52
+ }).sort();
53
+ }
54
+
55
+ export function initProject(target, { dryRun = false, log = console.log } = {}) {
56
+ const root = path.resolve(target);
57
+ assertDirectory(root);
58
+ const files = getBundledFiles(bundledScaffold);
59
+ const created = [];
60
+ const skipped = [];
61
+
62
+ // Preflight before writing anything.
63
+ for (const rel of files) {
64
+ assertSafePath(root, path.join(root, rel));
65
+ }
66
+
67
+ for (const rel of files) {
68
+ const destination = path.join(root, rel);
69
+ if (pathExists(destination)) {
70
+ skipped.push(rel);
71
+ log(`skip ${rel} (already exists)`);
72
+ continue;
73
+ }
74
+ if (!dryRun) {
75
+ fs.mkdirSync(path.dirname(destination), { recursive: true });
76
+ // Atomic no-clobber creation; existing work must never be overwritten.
77
+ fs.copyFileSync(path.join(bundledScaffold, rel), destination, fs.constants.COPYFILE_EXCL);
78
+ }
79
+ created.push(rel);
80
+ log(`${dryRun ? 'would create' : 'create'} ${rel}`);
81
+ }
82
+
83
+ log(`${dryRun ? 'Preview:' : 'Initialized:'} ${created.length} ${dryRun ? 'to create' : 'created'}, ${skipped.length} skipped.`);
84
+ return { created, skipped };
85
+ }
86
+
87
+ export function slugify(value) {
88
+ const slug = value.normalize('NFKD').replace(/[\u0300-\u036f]/g, '')
89
+ .toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '');
90
+ if (!slug) throw new Error('Feature title must include letters or numbers.');
91
+ if (slug.length > 80) throw new Error('Feature title is too long after conversion to a slug (max 80 characters).');
92
+ return slug;
93
+ }
94
+
95
+ function nextFeatureNumber(featuresDir) {
96
+ const existing = fs.readdirSync(featuresDir, { withFileTypes: true });
97
+ const ids = existing.filter((item) => item.isDirectory())
98
+ .map((item) => /^feature-(\d+)-/.exec(item.name))
99
+ .filter(Boolean).map((match) => Number(match[1]));
100
+ return (ids.length ? Math.max(...ids) : 0) + 1;
101
+ }
102
+
103
+ function localDate() {
104
+ const d = new Date();
105
+ const year = d.getFullYear();
106
+ const month = String(d.getMonth() + 1).padStart(2, '0');
107
+ const day = String(d.getDate()).padStart(2, '0');
108
+ return `${year}-${month}-${day}`;
109
+ }
110
+
111
+ function fillFeatureTemplate(contents, { title, id, slug, date }) {
112
+ return contents.replaceAll('feature-NNN-kebab-case', `feature-${id}-${slug}`)
113
+ .replaceAll('[Feature title]', title)
114
+ .replaceAll('Feature NNN:', `Feature ${id}:`)
115
+ .replaceAll('[YYYY-MM-DD]', date);
116
+ }
117
+
118
+ export function createFeature(target, title, {
119
+ approved = false, design = false, research = false, handoff = false,
120
+ dryRun = false, log = console.log,
121
+ } = {}) {
122
+ const root = path.resolve(target);
123
+ assertDirectory(root);
124
+ if (!title || !title.trim()) throw new Error('Provide a feature title.');
125
+ if (!approved && !dryRun) {
126
+ throw new Error('Feature scope must be approved first. Re-run with --approved after explicit user approval.');
127
+ }
128
+ const slug = slugify(title.trim());
129
+ const templateDir = path.join(root, '.agent-specs', 'templates', 'feature');
130
+ const featuresDir = path.join(root, 'docs', 'features');
131
+ const files = [...requiredFeatureFiles, ...optionalFeatureFiles.filter((file) => (
132
+ (file === 'DESIGN.md' && design) ||
133
+ (file === 'RESEARCH.md' && research) ||
134
+ (file === 'HANDOFF.md' && handoff)
135
+ ))];
136
+ // Ensure initialization and templates exist before changing the repository.
137
+ if (!fs.existsSync(featuresDir) || !fs.statSync(featuresDir).isDirectory()) {
138
+ throw new Error('docs/features/ is missing. Run `scaffold-agent-specs init` first.');
139
+ }
140
+ for (const filename of files) {
141
+ const template = path.join(templateDir, filename);
142
+ assertSafePath(root, template);
143
+ if (!fs.existsSync(template) || !fs.statSync(template).isFile()) {
144
+ throw new Error(`Feature template missing: ${path.relative(root, template)}. Run init or restore the template.`);
145
+ }
146
+ }
147
+ const number = nextFeatureNumber(featuresDir);
148
+ const id = String(number).padStart(3, '0');
149
+ const name = `feature-${id}-${slug}`;
150
+ const featureDir = path.join(featuresDir, name);
151
+ assertSafePath(root, featureDir);
152
+ if (pathExists(featureDir)) throw new Error(`Feature directory already exists: ${featureDir}`);
153
+ const date = localDate();
154
+ const created = files.map((file) => path.join('docs', 'features', name, file));
155
+ if (!dryRun) {
156
+ // Exclusive mkdir prevents two concurrent calls from sharing the same feature ID.
157
+ fs.mkdirSync(featureDir);
158
+ try {
159
+ for (const file of files) {
160
+ const content = fs.readFileSync(path.join(templateDir, file), 'utf8');
161
+ fs.writeFileSync(path.join(featureDir, file), fillFeatureTemplate(content, { title: title.trim(), id, slug, date }), { flag: 'wx' });
162
+ }
163
+ } catch (error) {
164
+ // A failed scaffold must not leave a half-created feature.
165
+ fs.rmSync(featureDir, { recursive: true, force: true });
166
+ throw error;
167
+ }
168
+ }
169
+ for (const file of created) log(`${dryRun ? 'would create' : 'create'} ${file}`);
170
+ log(`${dryRun ? 'Preview:' : 'Scaffolded:'} ${name} (${files.length} file${files.length === 1 ? '' : 's'}).`);
171
+ if (!dryRun) {
172
+ log('Next: fill the files with the approved feature scope, then stop before implementation.');
173
+ }
174
+ return { featureDir, created };
175
+ }
package/package.json CHANGED
@@ -1,6 +1,32 @@
1
1
  {
2
2
  "name": "scaffold-agent-specs",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "A tiny, spec-driven workflow scaffold for AI coding agents",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "bin": {
8
+ "scaffold-agent-specs": "./bin/scaffold-agent-specs.js"
9
+ },
10
+ "files": [
11
+ "bin/",
12
+ "lib/",
13
+ "scaffold/",
14
+ "README.md"
15
+ ],
16
+ "engines": {
17
+ "node": ">=20"
18
+ },
19
+ "scripts": {
20
+ "test": "node --test",
21
+ "pack:check": "npm pack --dry-run"
22
+ },
23
+ "keywords": [
24
+ "agents",
25
+ "agentic-coding",
26
+ "spec-driven-development",
27
+ "scaffolding",
28
+ "claude-code",
29
+ "codex"
30
+ ],
31
+ "author": "rob-pasc"
32
+ }
@@ -0,0 +1,35 @@
1
+ # ADR-NNN: [Decision title]
2
+
3
+ - **Status:** Accepted
4
+ - **Date adopted:** [YYYY-MM-DD]
5
+ - **Related feature(s):** [Link(s), if any]
6
+ - **Supersedes:** [ADR link or None]
7
+
8
+ > Create this record only after a significant architectural decision is actually adopted. A proposal is not an accepted decision. Name the file `adr-NNN-kebab-case.md` using the next unused number.
9
+
10
+ ## Context
11
+
12
+ [What circumstances and constraints made a durable decision necessary? What forces or tradeoffs mattered?]
13
+
14
+ ## Decision
15
+
16
+ [State the decision *actually adopted*, its boundaries, and the principal rationale.]
17
+
18
+ ## Alternatives considered
19
+
20
+ | Alternative | Benefits | Why not chosen |
21
+ | --- | --- | --- |
22
+ | [Option A] | [Benefits] | [Tradeoffs] |
23
+ | [Option B] | [Benefits] | [Tradeoffs] |
24
+
25
+ ## Consequences
26
+
27
+ [Positive and negative effects, risks, operational obligations, and follow-ups.]
28
+
29
+ ## Implementation / validation references
30
+
31
+ [Links to related code, tests, feature docs, or PRs showing how the decision was adopted.]
32
+
33
+ ## Supersession notes (if applicable)
34
+
35
+ [When a new ADR supersedes this decision, link it here; preserve the original decision as history.]
@@ -0,0 +1,19 @@
1
+ # [Topic] Conventions
2
+
3
+ > **Optional project document.** When a stable convention applies across multiple features, copy this template to `docs/conventions/[topic].md`. Keep concrete rules here, not generic agent-process instructions. Prefer existing formatters, linters, and tooling as the source of truth for mechanically enforced rules.
4
+
5
+ ## Scope
6
+
7
+ [Which parts of the repository or kinds of changes follow this convention?]
8
+
9
+ ## Rules
10
+
11
+ - [Specific actionable rule and rationale, when it would otherwise be unclear]
12
+
13
+ ## Examples (if useful)
14
+
15
+ [Short preferred and discouraged examples, or links to representative code.]
16
+
17
+ ## Exceptions and evolution
18
+
19
+ [Known exceptions, how to propose changes, and links to relevant ADRs or tooling.]
@@ -0,0 +1,24 @@
1
+ # Acceptance Matrix: [Feature title]
2
+
3
+ - **Feature ID:** `feature-NNN-kebab-case`
4
+ - **Verification status:** Not started
5
+
6
+ Each row must specify **observable behavior**, a verification method, and actual evidence. Write criteria when specifying the feature; update result and evidence during implementation. Do not mark `Pass` based solely on code inspection or optimism.
7
+
8
+ | ID | Requirement | Scenario / expected outcome | Verification method | Result | Evidence |
9
+ | --- | --- | --- | --- | --- | --- |
10
+ | AC-001 | FR-001 | [Given/when/then or clear expected result] | [Test name or manual procedure] | Not run | [Add evidence when verified] |
11
+ | AC-002 | FR-002 | [Expected result, including important edge case] | [Test name or manual procedure] | Not run | [Add evidence when verified] |
12
+
13
+ ## Result legend
14
+
15
+ - **Not run:** Not verified yet.
16
+ - **Pass:** Verified with evidence recorded above.
17
+ - **Fail:** Verified behavior does not meet the criterion.
18
+ - **Blocked:** Verification cannot proceed; explain why.
19
+
20
+ If the user approves changing or waiving a criterion, update the approved scope in `PLAN.md` and document that decision explicitly. Do not silently convert a failing criterion into a pass.
21
+
22
+ ## Verification notes
23
+
24
+ [Commands, test environment, observations, limitations, and links to test reports. Leave as 'Not yet verified' during initial specification.]
@@ -0,0 +1,40 @@
1
+ # Feature Design: [Feature title]
2
+
3
+ - **Feature ID:** `feature-NNN-kebab-case`
4
+ - **Design status:** Proposed (not automatically approved with feature scope)
5
+
6
+ > **Optional.** Create when technical or interaction design needs more detail than `PLAN.md`. Keep approved user-visible scope in `PLAN.md`; use this document for the implementation design. Omit irrelevant sections rather than filling them with boilerplate.
7
+
8
+ ## Design goals and constraints
9
+
10
+ [The technical/UX qualities and constraints that shape the approach. Refer to requirement IDs, rather than repeating the full feature specification.]
11
+
12
+ ## Proposed solution
13
+
14
+ [Concise architecture and principal components. Include a small diagram when it clarifies relationships.]
15
+
16
+ ## User experience and states (if relevant)
17
+
18
+ [UI structure, interactions, loading/empty/error states, permissions, accessibility, and responsive behavior.]
19
+
20
+ ## Data flow and interfaces (if relevant)
21
+
22
+ [Data ownership, schemas, API boundaries, integration points, migration or compatibility needs. Refer to machine-readable contracts if they exist.]
23
+
24
+ ## Failure modes and operational considerations (if relevant)
25
+
26
+ [Security/privacy, performance, error recovery, observability, deployment, or rollout concerns.]
27
+
28
+ ## Alternatives and tradeoffs
29
+
30
+ [Material design options and reasons for preferring the proposed one. Significant project-wide *adopted* choices should be recorded later as ADRs.]
31
+
32
+ ## Open technical decisions
33
+
34
+ - [Open question, whether it blocks implementation, and who needs to decide]
35
+
36
+ ## References
37
+
38
+ - Approved scope: [`PLAN.md`](./PLAN.md)
39
+ - Requirements and checks: [`ACCEPTANCE_MATRIX.md`](./ACCEPTANCE_MATRIX.md)
40
+ - [Any relevant convention, architecture documentation, or adopted ADR]
@@ -0,0 +1,27 @@
1
+ # Handoff: [Feature title]
2
+
3
+ - **Feature ID:** `feature-NNN-kebab-case`
4
+ - **Updated:** [YYYY-MM-DD HH:MM and time zone, if useful]
5
+ - **Current state:** [In progress / Blocked / Ready for verification / Other]
6
+
7
+ > **Optional, short-lived file.** Create when an agent or session needs a resumption snapshot. `TASKS.md` remains authoritative for progress; the plan and acceptance matrix remain authoritative for scope and verification.
8
+
9
+ ## Where work stands
10
+
11
+ [Brief summary of the current implementation state and the specific active task ID.]
12
+
13
+ ## Recent changes
14
+
15
+ [Relevant files, commits, and decisions made since the previous handoff.]
16
+
17
+ ## Checks performed
18
+
19
+ [Exact commands and outcomes, including failures and checks not run.]
20
+
21
+ ## Blockers and cautions
22
+
23
+ [Unanswered questions, risks, brittle parts, local setup requirements, or 'None'.]
24
+
25
+ ## Next action
26
+
27
+ [One concrete next step, with any commands/files needed to resume.]
@@ -0,0 +1,67 @@
1
+ # Feature NNN: [Feature title]
2
+
3
+ - **Feature ID:** `feature-NNN-kebab-case`
4
+ - **Scope status:** Approved by user
5
+ - **Scope approval date:** [YYYY-MM-DD]
6
+ - **Implementation status:** Not started
7
+ - **Technical readiness:** To be assessed before implementation
8
+
9
+ > Replace bracketed prompts with specifics from the approved discussion. This file records *scope and intent*, not a claim that a technical design has been accepted.
10
+
11
+ ## Summary
12
+
13
+ [One or two paragraphs explaining what this feature does and why it matters.]
14
+
15
+ ## Problem and desired outcome
16
+
17
+ - **Problem:** [What is difficult or impossible today?]
18
+ - **Desired outcome:** [What should be different for users?]
19
+ - **Target users / stakeholders:** [Who benefits?]
20
+
21
+ ## Approved scope
22
+
23
+ ### In scope
24
+
25
+ - [Behavior or capability explicitly agreed with the user]
26
+
27
+ ### Out of scope
28
+
29
+ - [Explicit exclusion or intentionally deferred capability]
30
+
31
+ ## Functional requirements
32
+
33
+ - **FR-001:** [Observable behavior, with important edge cases where relevant]
34
+ - **FR-002:** [Additional requirement, if needed]
35
+
36
+ ## Non-functional requirements and constraints
37
+
38
+ [Performance, accessibility, security, privacy, compatibility, operational or design constraints *actually relevant* to this feature. State 'None identified' if appropriate.]
39
+
40
+ ## User journeys and edge cases
41
+
42
+ [Key flows, empty/error states, permissions, failure modes, or representative examples.]
43
+
44
+ ## Proposed technical approach
45
+
46
+ [Initial implementation direction based on repository inspection. Clearly mark unresolved choices and significant tradeoffs. The user approved feature scope, not automatically this approach.]
47
+
48
+ ## Dependencies and risks
49
+
50
+ - [Dependency, prerequisite, migration risk, or 'None identified']
51
+
52
+ ## Assumptions and open questions
53
+
54
+ - [Question or assumption; mark **Blocking** when implementation cannot responsibly proceed without an answer]
55
+
56
+ ## Scope change log
57
+
58
+ | Date | Change | User approval |
59
+ | --- | --- | --- |
60
+ | [YYYY-MM-DD] | Initial approved scope | [Explicit approval reference / conversation] |
61
+
62
+ ## References
63
+
64
+ - Acceptance criteria: [`ACCEPTANCE_MATRIX.md`](./ACCEPTANCE_MATRIX.md)
65
+ - Implementation tasks: [`TASKS.md`](./TASKS.md)
66
+ - Related ADRs: [Links added only after decisions are adopted]
67
+ - Optional detailed design/research: [Link to `DESIGN.md` and/or `RESEARCH.md` only when created]
@@ -0,0 +1,32 @@
1
+ # Feature Research: [Feature title]
2
+
3
+ - **Feature ID:** `feature-NNN-kebab-case`
4
+ - **Research status:** Exploratory
5
+
6
+ > **Optional.** Use only when investigation produces findings worth preserving. Research is evidence for planning, not approval of a feature scope or technical decision. Distinguish observations from assumptions.
7
+
8
+ ## Question / motivation
9
+
10
+ [What needed investigation, and what decision or requirement could the findings inform?]
11
+
12
+ ## Findings
13
+
14
+ [Concise, supported observations; include links, versions, dates, and repository evidence where useful.]
15
+
16
+ ## Alternatives evaluated
17
+
18
+ | Option | Evidence / strengths | Limitations / risks |
19
+ | --- | --- | --- |
20
+ | [Option A] | [Evidence] | [Risks] |
21
+
22
+ ## Recommendation and confidence
23
+
24
+ [If appropriate, recommend an approach, explain remaining uncertainty, and say what would validate it. Do not present it as adopted.]
25
+
26
+ ## Open questions / follow-up
27
+
28
+ - [Question or next experiment, if any]
29
+
30
+ ## Sources and references
31
+
32
+ [Links to relevant code, documentation, prototypes, measurements, or external resources.]
@@ -0,0 +1,20 @@
1
+ # Implementation Tasks: [Feature title]
2
+
3
+ - **Feature ID:** `feature-NNN-kebab-case`
4
+ - **Status:** Not started
5
+
6
+ This is the **authoritative progress checklist**. Draft ordered, independently verifiable tasks after scope approval. Map tasks to acceptance criteria where practical. Check a task only after its work is actually complete.
7
+
8
+ ## Tasks
9
+
10
+ - [ ] **T-001:** [First actionable implementation step] (supports `AC-001`)
11
+ - [ ] **T-002:** [Next actionable implementation step] (supports `AC-001`, `AC-002`)
12
+ - [ ] **T-003:** [Tests, verification, and relevant docs updates] (supports `AC-001`, `AC-002`)
13
+
14
+ ## Dependencies and blockers
15
+
16
+ - [None identified, or list blocking task IDs / questions and responsible next steps]
17
+
18
+ ## Progress notes
19
+
20
+ [Only durable information needed to interpret task state. Put architecture rationale in `PLAN.md` or adopted ADRs, and test results in `ACCEPTANCE_MATRIX.md`.]
@@ -0,0 +1,33 @@
1
+ # Architecture Overview
2
+
3
+ > **Optional project document.** Create under `docs/ARCHITECTURE.md` when the system is complex enough to benefit from a maintained overview. Describe the *current implemented system*, not hypothetical future architecture. Refer to ADRs for the reasons behind lasting choices.
4
+
5
+ ## System at a glance
6
+
7
+ [What the system does and which major parts it comprises.]
8
+
9
+ ## Components and responsibilities
10
+
11
+ | Component | Responsibility | Key dependencies |
12
+ | --- | --- | --- |
13
+ | [Component] | [Responsibility] | [Dependencies] |
14
+
15
+ ## Important data and request flows
16
+
17
+ [Key runtime interactions, integrations, and data ownership. Add a diagram only if it improves clarity.]
18
+
19
+ ## Boundaries and cross-cutting concerns
20
+
21
+ [Deployment, trust boundaries, security, data persistence, observability, failure handling, or other topics relevant to this system.]
22
+
23
+ ## Architecture decisions and conventions
24
+
25
+ [Link to relevant ADRs and applicable docs/conventions files, without duplicating their contents.]
26
+
27
+ ## Known limitations and evolution
28
+
29
+ [Current constraints and intentional technical debt; distinguish proposed work from implemented behavior.]
30
+
31
+ ## Last reviewed
32
+
33
+ [YYYY-MM-DD and relevant change/commit, if useful]
@@ -0,0 +1,11 @@
1
+ # Project Glossary
2
+
3
+ > **Optional project document.** Create under `docs/GLOSSARY.md` when the domain has terms whose precise meaning matters across features. Prefer a short, authoritative definition over repeated explanations in feature plans.
4
+
5
+ | Term | Meaning in this project | Notes / related terms |
6
+ | --- | --- | --- |
7
+ | [Domain term] | [Precise definition] | [Distinctions, links, examples if useful] |
8
+
9
+ ## Usage notes (if needed)
10
+
11
+ [Ambiguous, deprecated, or easily confused terms, with preferred wording.]
@@ -0,0 +1,87 @@
1
+ # Repository Agent Instructions
2
+
3
+ These are the shared instructions for AI coding agents working in this repository. Keep tool-specific instructions (for example, Claude Code instructions) in their own thin adapter files rather than duplicating this document.
4
+
5
+ ## Working principles
6
+
7
+ - Read this file before working, and read [`docs/WORKFLOW.md`](docs/WORKFLOW.md) when discussing, specifying, implementing, or completing a feature.
8
+ - Inspect relevant code, tests, and existing documentation before asking questions or proposing an approach. Don't ask for information the repository already answers.
9
+ - Prefer the smallest coherent change. Follow existing project conventions and avoid unrelated refactors. Consult relevant documents in `docs/conventions/` when that directory exists.
10
+ - Be transparent about assumptions, uncertainty, incomplete work, and failed or unrun checks. Never present unverified behavior as tested.
11
+ - Use interactive question tools when available; otherwise ask in chat. Ask focused questions that materially affect scope, behavior, UX, data, security, or architecture. Propose sensible defaults for minor details.
12
+ - Keep the human in control of scope and significant architectural tradeoffs.
13
+
14
+ ## Feature workflow and approval gates
15
+
16
+ For **new features**, follow this sequence:
17
+
18
+ 1. **Discover:** Discuss the idea with the user. Understand the problem, users, expected behavior, constraints, boundaries, and unresolved questions. Do not implement the feature or create its feature directory during discovery.
19
+ 2. **Propose:** Present a concise scope summary covering the goal, in-scope and out-of-scope behavior, important acceptance outcomes, assumptions, and consequential open questions. Explicitly offer **accept / revise / discard**.
20
+ 3. **Get approval:** Treat only a clear, affirmative user response as scope approval. If the user revises the proposal, summarize the revised scope and seek approval again. If discarded, do not create feature artifacts.
21
+ 4. **Specify:** After approval, create `docs/features/feature-NNN-kebab-case/` and populate `PLAN.md`, `ACCEPTANCE_MATRIX.md`, and `TASKS.md` from `.agent-specs/templates/feature/`. You may run `scaffold-agent-specs feature "Title" --approved` (or its `npx` equivalent) to create files; the CLI does not write the approved requirements for you. Add `DESIGN.md` for substantial UX/technical design and `RESEARCH.md` for findings worth preserving, only when needed. Create `HANDOFF.md` when a real session handoff is useful. Record the approved scope faithfully. Mark proposed technical choices as proposed, not approved.
22
+ 5. **Stop at the spec boundary:** After writing the feature documents, summarize what was created and stop. **Do not start implementation** until the user explicitly requests it, possibly in a later session.
23
+ 6. **Implement and verify:** On an explicit implementation request, review the feature documents and relevant code. Resolve blockers, surface consequential technical choices, then execute tasks, validate acceptance criteria, and keep the documents current.
24
+ 7. **Finish:** Update related documentation, capture architectural decisions actually adopted, report verification evidence and remaining limitations, and mark the feature complete only when acceptance criteria are satisfied or exceptions explicitly accepted by the user.
25
+
26
+ Existing-feature work and ordinary fixes should follow the user's requested scope; do not force a new feature directory for every small change.
27
+
28
+ ### Scope changes and technical decisions
29
+
30
+ - An approved feature scope is the baseline. Ask for renewed approval before materially changing promised behavior, exclusions, or acceptance criteria.
31
+ - Technical implementation details can evolve within that scope. Surface decisions that introduce major dependencies, migrations, security implications, substantial complexity, or broad architectural consequences before committing to them.
32
+ - Keep proposed decisions in the feature `PLAN.md`. Add a project-wide ADR **when a significant architectural decision has actually been adopted**, typically after implementation. For consequential decisions adopted earlier, record the ADR at adoption rather than losing the rationale. Never turn an unimplemented proposal into an accepted ADR.
33
+
34
+ ## Feature documentation contracts
35
+
36
+ - **`PLAN.md`** explains *why and what*, including approved scope, requirements, constraints, risks, and the proposed technical direction.
37
+ - **`ACCEPTANCE_MATRIX.md`** defines objectively verifiable outcomes and records methods, results, and evidence. Do not claim a pass without evidence.
38
+ - **`TASKS.md`** is the authoritative checklist for implementation progress. Keep items small and link them to acceptance IDs where practical.
39
+ - **`DESIGN.md`** is optional detailed technical/interaction design, not a second feature specification.
40
+ - **`RESEARCH.md`** is optional durable investigative findings, not an approved decision.
41
+ - **`HANDOFF.md`** is optional, temporary context for a session or agent transition. It must never supersede the plan, acceptance matrix, or task checklist.
42
+ - Feature directories use `feature-NNN-kebab-case`, with three-digit IDs starting at `001`. Choose the next number above the highest existing feature ID; never reuse a retired ID.
43
+ - Use stable IDs such as `FR-001` (requirement), `AC-001` (acceptance), and `T-001` (task) so documents can cross-reference each other.
44
+
45
+ ## Documentation and architecture decisions
46
+
47
+ - Update relevant documentation **in the same change** when code changes behavior, architecture, configuration, developer setup, or public interfaces. Documentation is part of done, not an optional follow-up.
48
+ - Record durable, cross-cutting architectural decisions in `docs/adr/`. Use `.agent-specs/templates/adr/ADR.md` for the format; real ADRs start at `adr-001-...`.
49
+ - An ADR records context, the adopted decision, alternatives and tradeoffs, consequences, and references. Avoid ADRs for routine local implementation details.
50
+ - Do not write speculative ADRs during feature discovery or initial specification. Capture proposed approaches and uncertainties in `PLAN.md` instead.
51
+ - Keep docs concise and accurate; remove stale claims rather than merely appending new text.
52
+ - Practice **progressive documentation**: create an optional document only to solve a concrete problem. Prefer updating an existing source of truth over producing redundant or empty files.
53
+ - If maintained, keep `docs/ARCHITECTURE.md` aligned with the *implemented* system, `docs/GLOSSARY.md` aligned with shared domain language, and `docs/conventions/` aligned with stable project-specific practices. Create them only when useful, from `.agent-specs/templates/project/` or `.agent-specs/templates/conventions/`. An adopted architecture decision still belongs in an ADR.
54
+
55
+ ## Verification and completion
56
+
57
+ - Before claiming completion, run relevant tests, linters, type checks, and build checks supported by the repository, or explain precisely why they were not run.
58
+ - Update acceptance results with concrete evidence (test name, command, output summary, or a reproducible manual check). Never infer a pass from implementation alone.
59
+ - Keep `TASKS.md` synchronized with actual progress. Do not mark blocked or incomplete work as done.
60
+ - Call out unresolved failures, missing coverage, migrations, and follow-up work explicitly.
61
+
62
+ ## Git commit conventions
63
+
64
+ Use **Conventional Commit-style** subjects with a meaningful scope:
65
+
66
+ ```text
67
+ <type>(<scope>): <imperative summary>
68
+
69
+ <Prose describing what changed and why it matters.>
70
+ ```
71
+
72
+ - Example subjects: `feat(web): introduce user statistics page`, `fix(api): reject invalid date ranges`, `docs(adr): record reporting storage decision`.
73
+ - Common types: `feat`, `fix`, `refactor`, `test`, `docs`, `chore`, `perf`, `build`, `ci`.
74
+ - Use a lowercase type and a short, recognizable scope (app, package, or subsystem). Write an imperative, descriptive subject; aim to stay within 72 characters.
75
+ - For nontrivial changes, write a **prose body** explaining the substance and rationale, not a dump of filenames or generic boilerplate. Separate the subject and body with a blank line, and wrap prose at roughly 72–80 columns.
76
+ - Keep commits focused and truthful. Note breaking changes explicitly when applicable.
77
+ - Do not create a commit unless the user requests it or has explicitly authorized committing as part of the current task.
78
+
79
+ Example:
80
+
81
+ ```text
82
+ feat(web): introduce user statistics page
83
+
84
+ Add a date-range filter and daily activity chart so users can inspect
85
+ engagement without exporting raw events. Reuse the existing reporting
86
+ endpoint to keep the change within the current data architecture.
87
+ ```
@@ -0,0 +1,6 @@
1
+ # Claude Code Instructions
2
+
3
+ 1. **Always read and follow `AGENTS.md` before doing any work.** For feature work, also read `docs/WORKFLOW.md` and the relevant files in `docs/features/`.
4
+ 2. Treat `AGENTS.md` as the shared source of truth for repository workflow, documentation, verification, and commit style. Do not duplicate or override its instructions here.
5
+ 3. **Do not add AI attribution to Git commits.** In particular, do not add `Co-Authored-By: Claude` (or similar AI co-author trailers), `Generated with Claude Code`, or other AI attribution lines to commit messages. Do not append such trailers automatically when generating commits.
6
+ 4. Follow the human approval gates in `AGENTS.md`: approval of feature scope authorizes writing specs, **not** beginning implementation.
@@ -0,0 +1,75 @@
1
+ # Spec-driven Feature Workflow
2
+
3
+ This document expands the feature lifecycle required by [`AGENTS.md`](../AGENTS.md). Feature specifications live in `docs/features/`; reusable templates live in `.agent-specs/templates/`.
4
+
5
+ ## Phase 1: Discover (conversation only)
6
+
7
+ - Read existing code and documentation when relevant, then explore the user's idea collaboratively.
8
+ - Ask focused clarifying questions, using the agent's interactive question interface where available or normal chat otherwise. Prefer small, purposeful batches over long questionnaires.
9
+ - Establish the problem, target users, expected behaviors, important edge cases, constraints, dependencies, and exclusions.
10
+ - Offer sensible defaults and surface tradeoffs; do not silently make consequential product decisions.
11
+ - Do **not** create a feature directory, commit a spec, or implement the feature yet.
12
+
13
+ ## Phase 2: Propose and decide (human gate)
14
+
15
+ Present a readable summary with:
16
+
17
+ 1. **Goal and motivation**: what problem the feature solves.
18
+ 2. **Expected behavior**: key user journeys and observable outcomes.
19
+ 3. **Scope**: clearly distinguished in-scope and out-of-scope work.
20
+ 4. **Acceptance expectations**: how success will be recognized.
21
+ 5. **Assumptions, risks, and open questions**: especially choices that affect cost or design.
22
+
23
+ Ask the user to **accept, revise, or discard**.
24
+
25
+ - **Accept:** proceed to specification.
26
+ - **Revise:** discuss, re-propose, and seek explicit approval again.
27
+ - **Discard:** stop without creating feature artifacts.
28
+ - Silence, vague assent, or approval of a different subject does not count as approval.
29
+
30
+ ## Phase 3: Specify (after accepted scope)
31
+
32
+ Choose `feature-NNN-kebab-case`, using the next available ID above the current maximum (starting with `001`). Once the user approves, optionally use `scaffold-agent-specs feature "Title" --approved` (or its `npx` equivalent) to create the directory from templates. The flag acknowledges explicit approval; the CLI does not verify the conversation or write the actual scope. Create the directory and populate:
33
+
34
+ | File | Purpose | Required? |
35
+ | --- | --- | --- |
36
+ | `PLAN.md` | Approved product scope, requirements, constraints, proposed technical approach | Yes |
37
+ | `ACCEPTANCE_MATRIX.md` | Testable criteria plus verification methods, results, and evidence | Yes |
38
+ | `TASKS.md` | Ordered, actionable implementation checklist, mapped to criteria | Yes |
39
+ | `DESIGN.md` | Detailed technical/UX design when complexity warrants it | Optional |
40
+ | `RESEARCH.md` | Durable findings from meaningful investigation | Optional |
41
+ | `HANDOFF.md` | Short-lived context for work that will resume elsewhere | Only if useful |
42
+
43
+ Write the approved scope into `PLAN.md`. Draft acceptance criteria and tasks that correspond to that scope. Cross-reference IDs where practical. Put unresolved technical questions in the plan, rather than inventing answers. Add `DESIGN.md` only for substantial design detail, and `RESEARCH.md` only when research findings are worth retaining. Do not write an ADR for an unimplemented option.
44
+
45
+ **Then stop.** Tell the user what was scaffolded, identify open decisions or blockers, and wait for an explicit implementation request. Feature approval is **not** implementation authorization.
46
+
47
+ ## Phase 4: Implement (separate explicit request)
48
+
49
+ - Re-read the active feature's plan, acceptance matrix, and tasks, plus any optional design/research documents; inspect relevant code and applicable `docs/conventions/` documentation.
50
+ - Check readiness: requirements coherent, blockers identified, implementation direction sensible, verification approach practical.
51
+ - Seek human input before significant new dependencies, migrations, security-sensitive choices, or changes to approved behavior. Technical refinement that stays within scope usually needs no additional approval.
52
+ - Work through `TASKS.md`, updating checked items to reflect reality. Keep plan notes synchronized when implementation choices change.
53
+ - Add or update tests and record concrete results in `ACCEPTANCE_MATRIX.md`.
54
+ - If interrupted, add or refresh `HANDOFF.md` with the current task, blockers, commands run, and the next actionable step.
55
+
56
+ ## Phase 5: Verify and close
57
+
58
+ - Review each acceptance criterion against observable evidence. Use `Pass`, `Fail`, `Blocked`, or `Not run`; never invent a result. If a criterion is waived or removed, record the user's approval and update scope accordingly.
59
+ - Run applicable checks and document anything not run.
60
+ - Update affected user/developer/project documentation in the same change. Maintain `docs/ARCHITECTURE.md`, `docs/GLOSSARY.md`, and `docs/conventions/` when they exist and are affected by the change.
61
+ - Create ADRs for meaningful architectural decisions **actually adopted**. Normally do this after the implementation is known; for a consequential choice adopted earlier, record it at that point.
62
+ - Report what shipped, what was validated, any limitations, and whether the feature is complete. A feature is not complete while required acceptance criteria remain failing, blocked, or unverified.
63
+
64
+ ## Maintaining the source of truth
65
+
66
+ - `PLAN.md` owns agreed scope, not task completion.
67
+ - `ACCEPTANCE_MATRIX.md` owns acceptance and verification evidence, not general project notes.
68
+ - `TASKS.md` owns implementation progress, not architectural rationale.
69
+ - `DESIGN.md`, if present, owns detailed technical and UX design, not user-approved scope.
70
+ - `RESEARCH.md`, if present, preserves meaningful investigation and uncertainty, not decisions.
71
+ - `HANDOFF.md`, if present, is a snapshot for resumption and may be deleted once unnecessary.
72
+ - ADRs document *adopted*, broadly relevant architecture decisions; feature plans retain proposals and feature-local tradeoffs.
73
+ - `docs/ARCHITECTURE.md` describes the implemented system; `docs/GLOSSARY.md` defines shared domain terminology; `docs/conventions/` records reusable project practices. Create these documents only when they provide value. Templates are under `.agent-specs/templates/`.
74
+
75
+ Approved scope changes must be brought back to the user before being incorporated as commitments. Keep artifacts understandable to someone resuming the project without the original chat history. **Progressive documentation:** do not create an optional document just because a template exists; prefer updating a single authoritative source over duplicating content.
@@ -0,0 +1,8 @@
1
+ # Architecture Decision Records
2
+
3
+ Record **significant architectural decisions actually adopted** by this project here. Do not create speculative ADRs during feature discovery or initial specification; capture proposals in the relevant `PLAN.md` instead. If a consequential decision is adopted before the feature is fully implemented, write its ADR at the point of adoption.
4
+
5
+ - The reusable format lives in `.agent-specs/templates/adr/ADR.md`; keep templates out of this directory.
6
+ - Number real ADRs `adr-001-short-description.md`, `adr-002-short-description.md`, and so on. Never renumber an existing ADR.
7
+ - Describe context, the adopted decision, alternatives, consequences, and relevant feature/code references.
8
+ - If a decision is replaced later, preserve the original historical record and link to its superseding ADR rather than rewriting history.
@@ -0,0 +1,17 @@
1
+ # Feature Specifications
2
+
3
+ Create a directory here **only after the user explicitly accepts the feature scope**. Do not create speculative feature directories during discovery.
4
+
5
+ After approval, an agent may use `scaffold-agent-specs feature "Feature title" --approved` (or its `npx` equivalent), then fill all required documents from the accepted discussion. The CLI only creates templated files and replaces identifiers, titles, and dates.
6
+
7
+ Each feature is named `feature-NNN-kebab-case`, for example `feature-007-user-statistics-page`. Start at `001` and choose the next number above the highest existing feature ID; do not reuse numbers.
8
+
9
+ Required documents (copied from `.agent-specs/templates/feature/`):
10
+
11
+ - `PLAN.md`: approved scope and proposed approach.
12
+ - `ACCEPTANCE_MATRIX.md`: testable outcomes and verification evidence.
13
+ - `TASKS.md`: implementation checklist.
14
+
15
+ `DESIGN.md` is optional for substantial technical or interaction design. `RESEARCH.md` is optional for reusable investigation findings. `HANDOFF.md` is optional and should be created when an agent or session needs to transfer working context. Do not create empty optional documents just to satisfy a checklist.
16
+
17
+ After creating and populating the specs, **stop** and await a separate implementation request. See [`docs/WORKFLOW.md`](../WORKFLOW.md) for the full lifecycle.