specly 0.1.0__tar.gz

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.
Files changed (32) hide show
  1. specly-0.1.0/PKG-INFO +72 -0
  2. specly-0.1.0/README.md +57 -0
  3. specly-0.1.0/pyproject.toml +33 -0
  4. specly-0.1.0/setup.cfg +4 -0
  5. specly-0.1.0/src/specly.egg-info/PKG-INFO +72 -0
  6. specly-0.1.0/src/specly.egg-info/SOURCES.txt +30 -0
  7. specly-0.1.0/src/specly.egg-info/dependency_links.txt +1 -0
  8. specly-0.1.0/src/specly.egg-info/entry_points.txt +2 -0
  9. specly-0.1.0/src/specly.egg-info/requires.txt +5 -0
  10. specly-0.1.0/src/specly.egg-info/top_level.txt +1 -0
  11. specly-0.1.0/src/specly_cli/__init__.py +3 -0
  12. specly-0.1.0/src/specly_cli/__main__.py +7 -0
  13. specly-0.1.0/src/specly_cli/assets/artifact-contract-v1.json +76 -0
  14. specly-0.1.0/src/specly_cli/assets/how-to-use.md +226 -0
  15. specly-0.1.0/src/specly_cli/assets/templates/design.md +51 -0
  16. specly-0.1.0/src/specly_cli/assets/templates/requirements.md +49 -0
  17. specly-0.1.0/src/specly_cli/assets/templates/steering.md +91 -0
  18. specly-0.1.0/src/specly_cli/assets/templates/tasks.md +40 -0
  19. specly-0.1.0/src/specly_cli/assets/templates/verification.md +44 -0
  20. specly-0.1.0/src/specly_cli/cli.py +269 -0
  21. specly-0.1.0/src/specly_cli/contract.py +100 -0
  22. specly-0.1.0/src/specly_cli/layout.py +106 -0
  23. specly-0.1.0/src/specly_cli/optional/__init__.py +1 -0
  24. specly-0.1.0/src/specly_cli/optional/ax_adapter.py +160 -0
  25. specly-0.1.0/src/specly_cli/optional/strands_adapter.py +147 -0
  26. specly-0.1.0/tests/test_ax_adapter.py +119 -0
  27. specly-0.1.0/tests/test_cli.py +74 -0
  28. specly-0.1.0/tests/test_conformance.py +157 -0
  29. specly-0.1.0/tests/test_contract.py +73 -0
  30. specly-0.1.0/tests/test_strands_adapter.py +219 -0
  31. specly-0.1.0/tests/test_sync_assets.py +53 -0
  32. specly-0.1.0/tests/test_wheel_smoke.py +137 -0
specly-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,72 @@
1
+ Metadata-Version: 2.4
2
+ Name: specly
3
+ Version: 0.1.0
4
+ Summary: Spec-Driven Development scaffolding in Python
5
+ Author: davidops
6
+ License: MIT
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.10
11
+ Description-Content-Type: text/markdown
12
+ Provides-Extra: strands
13
+ Requires-Dist: strands-agents>=1.0.0; extra == "strands"
14
+ Provides-Extra: ax
15
+
16
+ # Specly Python CLI (Local Preview)
17
+
18
+ Standalone Python distribution for **Specly** — Spec-Driven Development scaffolding without requiring Node.js.
19
+
20
+ > **Status:** Local development and testing only. This package is **not published** to PyPI or any public registry. The package name and public command identities remain provisional.
21
+
22
+ ## Supported Commands
23
+
24
+ - `specly init [options]`: Generate SDD files conforming to canonical artifact contract v1.
25
+ - `specly doctor`: Read-only readiness check for Python runtime (>=3.10), agent markers, and packaged template fingerprints.
26
+ - `specly plan <feature>`: Read-only preview of proposed local file writes and effects.
27
+ - `specly verify <feature>`: Read-only verification of local specification files and checklist progress.
28
+
29
+ *Note: `specly run` and `specly recover` are not supported in the Python CLI and remain available via the Node CLI.*
30
+
31
+ ## Interruption & Overwrite Safety
32
+
33
+ - Running `init` on existing files checks their SHA-256 against canonical templates.
34
+ - Files matching canonical template bytes are reported as already complete and skipped.
35
+ - Modified or partial files trigger a warning requiring review; they are never overwritten without explicit `--force`.
36
+
37
+ ## Optional Strands Task Execution Adapter
38
+
39
+ The optional module `specly_cli.optional.strands_adapter` provides a strictly bounded task-execution boundary using the Strands Agents SDK:
40
+
41
+ - **Disabled by default:** Default commands (`init`, `doctor`, `plan`, `verify`) never import Strands or inspect ambient credentials.
42
+ - **Explicit authorization:** Execution requires an `ExecutionRequest` bound to an affirmative `approval_digest`, explicit provider configuration, and task ID.
43
+ - **Strict safety boundary:**
44
+ - Allowed tools are restricted to structured, data-only local operations (`write-file`). Shell, subprocess, VCS, PR, and network tools are prohibited.
45
+ - Writable roots are confined to the project root; directory traversal, symlink escapes, and reserved paths (`.git`, `.specly`) fail closed.
46
+ - Resource limits (`budget_calls`, `timeout_seconds`) halt execution with a `limited` status and claim no success.
47
+ - **Evidence distinction:** An `ExecutionRecord` documents tool outcomes and status, but **never** marks tasks checked or implies requirements acceptance. Local unit tests run against local mock fixtures and contact no external providers.
48
+ - **Installation:** Optional extra: `pip install "specly[strands]"`.
49
+
50
+ ## Optional Google AX Cluster Adapter
51
+
52
+ The optional module `specly_cli.optional.ax_adapter` provides read-only prerequisite diagnostics and effect previews for Google AX / Agent Substrate:
53
+
54
+ - **Disabled by default:** Default commands never import AX or inspect `KUBECONFIG` / ambient cluster credentials.
55
+ - **Offline diagnostics:** Local inspection checks required binaries (`kubectl`, `ko`, `go`) without probing remote clusters or networks.
56
+ - **Immutable effect preview:** Previews bind context, namespace, operation, resource targets, and proposed effects to an immutable SHA-256 approval digest.
57
+ - **Distinct mutation approval:** Submitting a cluster operation requires affirmative approval matching the preview digest and explicit destination authorization (destination, operation, credential/session). Changing targets or effects invalidates approval and fails closed.
58
+ - **Evidence status:** Labeled `unverified` (Google AX prerelease). No live cluster was contacted during local tests.
59
+ - **Installation:** Optional extra: `pip install "specly[ax]"`.
60
+
61
+ ## Development & Testing
62
+
63
+ ```bash
64
+ # Verify asset synchronization against canonical repository sources
65
+ python3 python/scripts/sync_assets.py --check
66
+
67
+ # Run test suite
68
+ PYTHONPATH=python/src python3 -m unittest discover -s python/tests
69
+
70
+ # Build isolated wheel
71
+ uv build --wheel --no-sources
72
+ ```
specly-0.1.0/README.md ADDED
@@ -0,0 +1,57 @@
1
+ # Specly Python CLI (Local Preview)
2
+
3
+ Standalone Python distribution for **Specly** — Spec-Driven Development scaffolding without requiring Node.js.
4
+
5
+ > **Status:** Local development and testing only. This package is **not published** to PyPI or any public registry. The package name and public command identities remain provisional.
6
+
7
+ ## Supported Commands
8
+
9
+ - `specly init [options]`: Generate SDD files conforming to canonical artifact contract v1.
10
+ - `specly doctor`: Read-only readiness check for Python runtime (>=3.10), agent markers, and packaged template fingerprints.
11
+ - `specly plan <feature>`: Read-only preview of proposed local file writes and effects.
12
+ - `specly verify <feature>`: Read-only verification of local specification files and checklist progress.
13
+
14
+ *Note: `specly run` and `specly recover` are not supported in the Python CLI and remain available via the Node CLI.*
15
+
16
+ ## Interruption & Overwrite Safety
17
+
18
+ - Running `init` on existing files checks their SHA-256 against canonical templates.
19
+ - Files matching canonical template bytes are reported as already complete and skipped.
20
+ - Modified or partial files trigger a warning requiring review; they are never overwritten without explicit `--force`.
21
+
22
+ ## Optional Strands Task Execution Adapter
23
+
24
+ The optional module `specly_cli.optional.strands_adapter` provides a strictly bounded task-execution boundary using the Strands Agents SDK:
25
+
26
+ - **Disabled by default:** Default commands (`init`, `doctor`, `plan`, `verify`) never import Strands or inspect ambient credentials.
27
+ - **Explicit authorization:** Execution requires an `ExecutionRequest` bound to an affirmative `approval_digest`, explicit provider configuration, and task ID.
28
+ - **Strict safety boundary:**
29
+ - Allowed tools are restricted to structured, data-only local operations (`write-file`). Shell, subprocess, VCS, PR, and network tools are prohibited.
30
+ - Writable roots are confined to the project root; directory traversal, symlink escapes, and reserved paths (`.git`, `.specly`) fail closed.
31
+ - Resource limits (`budget_calls`, `timeout_seconds`) halt execution with a `limited` status and claim no success.
32
+ - **Evidence distinction:** An `ExecutionRecord` documents tool outcomes and status, but **never** marks tasks checked or implies requirements acceptance. Local unit tests run against local mock fixtures and contact no external providers.
33
+ - **Installation:** Optional extra: `pip install "specly[strands]"`.
34
+
35
+ ## Optional Google AX Cluster Adapter
36
+
37
+ The optional module `specly_cli.optional.ax_adapter` provides read-only prerequisite diagnostics and effect previews for Google AX / Agent Substrate:
38
+
39
+ - **Disabled by default:** Default commands never import AX or inspect `KUBECONFIG` / ambient cluster credentials.
40
+ - **Offline diagnostics:** Local inspection checks required binaries (`kubectl`, `ko`, `go`) without probing remote clusters or networks.
41
+ - **Immutable effect preview:** Previews bind context, namespace, operation, resource targets, and proposed effects to an immutable SHA-256 approval digest.
42
+ - **Distinct mutation approval:** Submitting a cluster operation requires affirmative approval matching the preview digest and explicit destination authorization (destination, operation, credential/session). Changing targets or effects invalidates approval and fails closed.
43
+ - **Evidence status:** Labeled `unverified` (Google AX prerelease). No live cluster was contacted during local tests.
44
+ - **Installation:** Optional extra: `pip install "specly[ax]"`.
45
+
46
+ ## Development & Testing
47
+
48
+ ```bash
49
+ # Verify asset synchronization against canonical repository sources
50
+ python3 python/scripts/sync_assets.py --check
51
+
52
+ # Run test suite
53
+ PYTHONPATH=python/src python3 -m unittest discover -s python/tests
54
+
55
+ # Build isolated wheel
56
+ uv build --wheel --no-sources
57
+ ```
@@ -0,0 +1,33 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "specly"
7
+ version = "0.1.0"
8
+ description = "Spec-Driven Development scaffolding in Python"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = { text = "MIT" }
12
+ authors = [
13
+ { name = "davidops" }
14
+ ]
15
+ classifiers = [
16
+ "Programming Language :: Python :: 3",
17
+ "License :: OSI Approved :: MIT License",
18
+ "Operating System :: OS Independent",
19
+ ]
20
+ dependencies = []
21
+
22
+ [project.optional-dependencies]
23
+ strands = ["strands-agents>=1.0.0"]
24
+ ax = []
25
+
26
+ [project.scripts]
27
+ specly = "specly_cli.cli:main"
28
+
29
+ [tool.setuptools.packages.find]
30
+ where = ["src"]
31
+
32
+ [tool.setuptools.package-data]
33
+ specly_cli = ["assets/*", "assets/templates/*"]
specly-0.1.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,72 @@
1
+ Metadata-Version: 2.4
2
+ Name: specly
3
+ Version: 0.1.0
4
+ Summary: Spec-Driven Development scaffolding in Python
5
+ Author: davidops
6
+ License: MIT
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.10
11
+ Description-Content-Type: text/markdown
12
+ Provides-Extra: strands
13
+ Requires-Dist: strands-agents>=1.0.0; extra == "strands"
14
+ Provides-Extra: ax
15
+
16
+ # Specly Python CLI (Local Preview)
17
+
18
+ Standalone Python distribution for **Specly** — Spec-Driven Development scaffolding without requiring Node.js.
19
+
20
+ > **Status:** Local development and testing only. This package is **not published** to PyPI or any public registry. The package name and public command identities remain provisional.
21
+
22
+ ## Supported Commands
23
+
24
+ - `specly init [options]`: Generate SDD files conforming to canonical artifact contract v1.
25
+ - `specly doctor`: Read-only readiness check for Python runtime (>=3.10), agent markers, and packaged template fingerprints.
26
+ - `specly plan <feature>`: Read-only preview of proposed local file writes and effects.
27
+ - `specly verify <feature>`: Read-only verification of local specification files and checklist progress.
28
+
29
+ *Note: `specly run` and `specly recover` are not supported in the Python CLI and remain available via the Node CLI.*
30
+
31
+ ## Interruption & Overwrite Safety
32
+
33
+ - Running `init` on existing files checks their SHA-256 against canonical templates.
34
+ - Files matching canonical template bytes are reported as already complete and skipped.
35
+ - Modified or partial files trigger a warning requiring review; they are never overwritten without explicit `--force`.
36
+
37
+ ## Optional Strands Task Execution Adapter
38
+
39
+ The optional module `specly_cli.optional.strands_adapter` provides a strictly bounded task-execution boundary using the Strands Agents SDK:
40
+
41
+ - **Disabled by default:** Default commands (`init`, `doctor`, `plan`, `verify`) never import Strands or inspect ambient credentials.
42
+ - **Explicit authorization:** Execution requires an `ExecutionRequest` bound to an affirmative `approval_digest`, explicit provider configuration, and task ID.
43
+ - **Strict safety boundary:**
44
+ - Allowed tools are restricted to structured, data-only local operations (`write-file`). Shell, subprocess, VCS, PR, and network tools are prohibited.
45
+ - Writable roots are confined to the project root; directory traversal, symlink escapes, and reserved paths (`.git`, `.specly`) fail closed.
46
+ - Resource limits (`budget_calls`, `timeout_seconds`) halt execution with a `limited` status and claim no success.
47
+ - **Evidence distinction:** An `ExecutionRecord` documents tool outcomes and status, but **never** marks tasks checked or implies requirements acceptance. Local unit tests run against local mock fixtures and contact no external providers.
48
+ - **Installation:** Optional extra: `pip install "specly[strands]"`.
49
+
50
+ ## Optional Google AX Cluster Adapter
51
+
52
+ The optional module `specly_cli.optional.ax_adapter` provides read-only prerequisite diagnostics and effect previews for Google AX / Agent Substrate:
53
+
54
+ - **Disabled by default:** Default commands never import AX or inspect `KUBECONFIG` / ambient cluster credentials.
55
+ - **Offline diagnostics:** Local inspection checks required binaries (`kubectl`, `ko`, `go`) without probing remote clusters or networks.
56
+ - **Immutable effect preview:** Previews bind context, namespace, operation, resource targets, and proposed effects to an immutable SHA-256 approval digest.
57
+ - **Distinct mutation approval:** Submitting a cluster operation requires affirmative approval matching the preview digest and explicit destination authorization (destination, operation, credential/session). Changing targets or effects invalidates approval and fails closed.
58
+ - **Evidence status:** Labeled `unverified` (Google AX prerelease). No live cluster was contacted during local tests.
59
+ - **Installation:** Optional extra: `pip install "specly[ax]"`.
60
+
61
+ ## Development & Testing
62
+
63
+ ```bash
64
+ # Verify asset synchronization against canonical repository sources
65
+ python3 python/scripts/sync_assets.py --check
66
+
67
+ # Run test suite
68
+ PYTHONPATH=python/src python3 -m unittest discover -s python/tests
69
+
70
+ # Build isolated wheel
71
+ uv build --wheel --no-sources
72
+ ```
@@ -0,0 +1,30 @@
1
+ README.md
2
+ pyproject.toml
3
+ src/specly.egg-info/PKG-INFO
4
+ src/specly.egg-info/SOURCES.txt
5
+ src/specly.egg-info/dependency_links.txt
6
+ src/specly.egg-info/entry_points.txt
7
+ src/specly.egg-info/requires.txt
8
+ src/specly.egg-info/top_level.txt
9
+ src/specly_cli/__init__.py
10
+ src/specly_cli/__main__.py
11
+ src/specly_cli/cli.py
12
+ src/specly_cli/contract.py
13
+ src/specly_cli/layout.py
14
+ src/specly_cli/assets/artifact-contract-v1.json
15
+ src/specly_cli/assets/how-to-use.md
16
+ src/specly_cli/assets/templates/design.md
17
+ src/specly_cli/assets/templates/requirements.md
18
+ src/specly_cli/assets/templates/steering.md
19
+ src/specly_cli/assets/templates/tasks.md
20
+ src/specly_cli/assets/templates/verification.md
21
+ src/specly_cli/optional/__init__.py
22
+ src/specly_cli/optional/ax_adapter.py
23
+ src/specly_cli/optional/strands_adapter.py
24
+ tests/test_ax_adapter.py
25
+ tests/test_cli.py
26
+ tests/test_conformance.py
27
+ tests/test_contract.py
28
+ tests/test_strands_adapter.py
29
+ tests/test_sync_assets.py
30
+ tests/test_wheel_smoke.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ specly = specly_cli.cli:main
@@ -0,0 +1,5 @@
1
+
2
+ [ax]
3
+
4
+ [strands]
5
+ strands-agents>=1.0.0
@@ -0,0 +1 @@
1
+ specly_cli
@@ -0,0 +1,3 @@
1
+ """Specly CLI - Spec-Driven Development scaffolding in Python."""
2
+
3
+ __version__ = "0.1.0"
@@ -0,0 +1,7 @@
1
+ """Entry point for python -m specly_cli."""
2
+
3
+ import sys
4
+ from specly_cli.cli import main
5
+
6
+ if __name__ == "__main__":
7
+ sys.exit(main())
@@ -0,0 +1,76 @@
1
+ {
2
+ "contract": "specly-generated-artifacts",
3
+ "contractVersion": "1.0.0",
4
+ "schemaVersion": 1,
5
+ "featurePlaceholder": "{feature}",
6
+ "artifacts": [
7
+ {
8
+ "id": "requirements",
9
+ "role": "feature specification",
10
+ "directory": "specsDir",
11
+ "file": "requirements.md",
12
+ "template": "src/templates/requirements.md",
13
+ "sha256": "e94b31549542afa380a0814e4b53e67f77393f6949fbc7addbdacec99f213365",
14
+ "ownership": "user"
15
+ },
16
+ {
17
+ "id": "design",
18
+ "role": "technical design",
19
+ "directory": "specsDir",
20
+ "file": "design.md",
21
+ "template": "src/templates/design.md",
22
+ "sha256": "e27dc44a125652c728674637be6da821355f48027cad76a1d5d88bbe9869bd87",
23
+ "ownership": "user"
24
+ },
25
+ {
26
+ "id": "tasks",
27
+ "role": "implementation tasks",
28
+ "directory": "specsDir",
29
+ "file": "tasks.md",
30
+ "template": "src/templates/tasks.md",
31
+ "sha256": "4566c01228d85a4c93f0b3a3e71ee36b46ae8e408434f0a38ac55cf644db3c4d",
32
+ "ownership": "user"
33
+ },
34
+ {
35
+ "id": "verification",
36
+ "role": "verification checklist",
37
+ "directory": "specsDir",
38
+ "file": "verification.md",
39
+ "template": "src/templates/verification.md",
40
+ "sha256": "eb17232f8316d97fae36432600adbbfedc1b2808bb68a052951b69f5164a23ef",
41
+ "ownership": "user"
42
+ },
43
+ {
44
+ "id": "steering",
45
+ "role": "persistent project context",
46
+ "directory": "steeringDir",
47
+ "file": "steering.md",
48
+ "template": "src/templates/steering.md",
49
+ "sha256": "4607049ab708123603c0fc627eab4bf7d4eaf3eea2e524f1b8c68178cf6ac2b1",
50
+ "ownership": "user"
51
+ },
52
+ {
53
+ "id": "guide",
54
+ "role": "usage documentation",
55
+ "directory": "agentDir",
56
+ "file": "how-to-use.md",
57
+ "template": "how-to-use.md",
58
+ "sha256": "0d09f70b6f6965509589b6a424c7d3f14a42cf3df134b1b4ed2061d5a77956e5",
59
+ "ownership": "user"
60
+ }
61
+ ],
62
+ "layouts": {
63
+ "generic": { "specsDir": "specs", "steeringDir": "specs", "agentDir": "specs" },
64
+ "cursor": { "specsDir": ".cursor/specs/{feature}", "steeringDir": ".cursor", "agentDir": ".cursor" },
65
+ "kiro": { "specsDir": ".kiro/specs/{feature}", "steeringDir": ".kiro", "agentDir": ".kiro" },
66
+ "vscode": { "specsDir": ".vscode/specs/{feature}", "steeringDir": ".vscode", "agentDir": ".vscode" },
67
+ "antigravity": { "specsDir": ".agent/specs/{feature}", "steeringDir": ".agent", "agentDir": ".agent" },
68
+ "windsurf": { "specsDir": ".windsurf/specs/{feature}", "steeringDir": ".windsurf", "agentDir": ".windsurf" },
69
+ "claude": { "specsDir": ".claude/specs/{feature}", "steeringDir": ".claude", "agentDir": ".claude" }
70
+ },
71
+ "overwritePolicy": {
72
+ "default": "skip-existing",
73
+ "explicitForce": "replace-existing",
74
+ "migration": "never-overwrite-user-owned-artifacts-without-explicit-force"
75
+ }
76
+ }
@@ -0,0 +1,226 @@
1
+ # How to Use SDD (Spec-Driven Development)
2
+
3
+ **Author:** [davidops](https://www.npmjs.com/~davidops)
4
+
5
+ This package scaffolds the minimum structure for **Spec-Driven Development**: specifications that guide the AI agent before writing code.
6
+
7
+ ## Quick Start
8
+
9
+ From any project root:
10
+
11
+ ```bash
12
+ npx specly
13
+ ```
14
+
15
+ This creates the 5 base spec files adapted to the agent detected in your project, plus a copy of this guide inside your IDE workspace.
16
+
17
+ ## The 5 Generated Files
18
+
19
+ | File | Role | Contents |
20
+ |--------------------|-------------------|---------------------------------------------------------|
21
+ | `requirements.md` | The **what** | User stories + testable EARS criteria + ambiguity hunt |
22
+ | `design.md` | The **how** | 7 fixed sections (architecture, components, data, error handling, security, testing) + Mermaid diagrams |
23
+ | `tasks.md` | The **order** | Checklist with max 2 hierarchy levels + slicing rules + atomic commit guidance |
24
+ | `verification.md` | The **done** | Post-implementation validation checklist against requirements, design, and code quality |
25
+ | `steering.md` | **Context** | Stack, rules, hooks, MCP servers, skills, and project conventions |
26
+
27
+ ## Workflow
28
+
29
+ ```
30
+ Idea → Requirements → Design → Tasks → Build → Validate
31
+ ```
32
+
33
+ 1. Write `requirements.md` with user stories and EARS criteria. Hunt for ambiguities before moving on.
34
+ 2. Design the solution in `design.md` (7 sections — architecture, components, data, error handling, security, testing).
35
+ 3. Break work into tasks in `tasks.md` (checkboxes). Slice until each task is small and focused.
36
+ 4. Keep `steering.md` updated with project context, hooks, MCP servers, and conventions.
37
+ 5. Ask the agent to execute tasks one by one, validating against EARS criteria.
38
+ 6. Run `verification.md` after implementation — check every box before closing the feature.
39
+
40
+ **Golden rule:** when something changes, fix the spec first — do not patch code. Validate before merging.
41
+
42
+ ## Hooks (Automations)
43
+
44
+ Hooks are scripts that run automatically on events (pre-commit, pre-push, etc.).
45
+ They catch errors before they reach the repo.
46
+
47
+ ### Example: pre-commit hook that runs tests
48
+
49
+ For Kiro (`.kiro/hooks/`):
50
+
51
+ ```bash
52
+ #!/bin/sh
53
+ npm test
54
+ ```
55
+
56
+ For generic projects (`.githooks/`), enable with:
57
+
58
+ ```bash
59
+ git config core.hooksPath .githooks
60
+ ```
61
+
62
+ ### Recommended hook pipeline
63
+
64
+ 1. **Pre-commit**: lint + format + secret scanner
65
+ 2. **Pre-push**: full test suite
66
+ 3. **Post-merge**: update dependencies or deploy
67
+
68
+ ## MCP / NCP Servers (External Context)
69
+
70
+ MCP servers connect the agent to live documentation, APIs, or databases.
71
+ They reduce hallucinations by providing current data instead of relying on training cutoffs.
72
+
73
+ ### Examples
74
+
75
+ | Server | Purpose | When to use |
76
+ |--------------------|--------------------------------|------------------------------------------|
77
+ | `aws-documentation` | Search and read AWS docs | Building on AWS |
78
+ | `aws-pricing` | Live pricing lookups | Cost estimation |
79
+ | `aws-iac` | CloudFormation validation + CDK | Infrastructure as Code |
80
+ | `context7` | Library docs (React, Next.js, Prisma, etc.) | Using third-party libraries |
81
+ | `websearch` | General web search | Latest information not in training data |
82
+
83
+ Configure MCP servers in your agent's settings (e.g., `opencode.json` for OpenCode, `.cursor/mcp.json` for Cursor).
84
+
85
+ ## Skills (On-Demand Instructions)
86
+
87
+ Skills are markdown files activated by keywords. They teach the agent how to do specific tasks without repeating instructions.
88
+
89
+ ### Quick setup
90
+
91
+ Create `.kiro/skills/review-pr.md` (for Kiro) or `skills/review-pr.md` (generic) with:
92
+
93
+ ```markdown
94
+ # Skill: Review PR
95
+
96
+ Activate when the user says "review this PR" or uses `/review-pr`.
97
+
98
+ ## Steps
99
+ 1. Read the diff against the base branch
100
+ 2. Check every file for:
101
+ - Secrets or credentials in code
102
+ - Debug artifacts (console.log, TODO, commented code)
103
+ - Missing error handling
104
+ 3. Verify EARS criteria from requirements.md are met
105
+ 4. Report findings as a checklist
106
+ ```
107
+
108
+ The agent loads the skill automatically when the keyword is mentioned.
109
+
110
+ ## Supported Agents
111
+
112
+ The CLI auto-detects the agent from existing project folders:
113
+
114
+ | Agent | Flag | Specs path | Steering | Hooks path |
115
+ |-------------|-----------------------|--------------------------------|-----------------------|------------------|
116
+ | Generic | `--agent generic` | `specs/` | `specs/steering.md` | `.githooks/` |
117
+ | Cursor | `--agent cursor` | `.cursor/specs/<feature>/` | `.cursor/steering.md` | — |
118
+ | Kiro | `--agent kiro` | `.kiro/specs/<feature>/` | `.kiro/steering.md` | `.kiro/hooks/` |
119
+ | VS Code | `--agent vscode` | `.vscode/specs/<feature>/` | `.vscode/steering.md` | — |
120
+ | Antigravity | `--agent antigravity` | `.agent/specs/<feature>/` | `.agent/steering.md` | — |
121
+ | Windsurf | `--agent windsurf` | `.windsurf/specs/<feature>/` | `.windsurf/steering.md` | — |
122
+ | Claude Code | `--agent claude` | `.claude/specs/<feature>/` | `.claude/steering.md` | — |
123
+
124
+ ### Examples
125
+
126
+ ```bash
127
+ # Auto-detect
128
+ npx specly
129
+
130
+ # Cursor with feature "auth"
131
+ npx specly --agent cursor --feature auth
132
+
133
+ # Kiro with feature "payments"
134
+ npx specly --agent kiro -n payments
135
+
136
+ # Generic structure (works in any editor)
137
+ npx specly --agent generic
138
+
139
+ # List all agents
140
+ npx specly --list
141
+ ```
142
+
143
+ ## CLI Options
144
+
145
+ ```
146
+ npx specly [options]
147
+
148
+ -a, --agent <name> Force target agent
149
+ -n, --feature <name> Feature name (default: starter)
150
+ -f, --force Overwrite existing files
151
+ -l, --list List supported agents
152
+ -h, --help Show help
153
+ ```
154
+
155
+ ## EARS Criteria (Templates)
156
+
157
+ Use these keywords in `requirements.md` for testable criteria:
158
+
159
+ | Keyword | Use case | Example |
160
+ |---------------|----------------------------------|------------------------------------------------------------------|
161
+ | `WHEN` | Trigger event | WHEN the user saves THE SYSTEM SHALL persist the data |
162
+ | `IF...THEN` | Undesired condition / error | IF the title is empty THEN THE SYSTEM SHALL show an error |
163
+ | `WHILE` | Continuous state | WHILE filters are active THE SYSTEM SHALL filter results |
164
+ | `WHERE` | Location context | WHERE the user is admin THE SYSTEM SHALL show the panel |
165
+ | `AS SOON AS` | Time-sensitive response | AS SOON AS the payment completes THE SYSTEM SHALL send a receipt |
166
+
167
+ ### Ambiguity Hunting
168
+
169
+ Before accepting requirements, ask:
170
+
171
+ - What happens when the input is empty? Malformed? Too large?
172
+ - Who exactly is "the user"? Anonymous? Authenticated? Admin?
173
+ - What does "fast" mean in milliseconds? What does "a few" mean in numbers?
174
+ - What happens if an external service is down?
175
+
176
+ ## Prompting Your Agent
177
+
178
+ Once files are generated, use prompts like:
179
+
180
+ ```
181
+ Read specs/requirements.md and specs/design.md.
182
+ Execute task 1.1 from tasks.md.
183
+ Validate the result against the EARS criteria.
184
+ ```
185
+
186
+ For agents with per-feature folders:
187
+
188
+ ```
189
+ Read .cursor/specs/auth/requirements.md and execute task 2.1 from tasks.md.
190
+ ```
191
+
192
+ For validation after implementation:
193
+
194
+ ```
195
+ Read specs/verification.md and run each check against the implementation.
196
+ ```
197
+
198
+ ## Task Slicing Guidelines
199
+
200
+ - If a task has more than 5 sub-steps, split it.
201
+ - One task = one logical change.
202
+ - Each task should feel like "I know exactly what to do here."
203
+ - One commit per checked task when possible.
204
+ - Mark a task complete only after it is tested and reviewed.
205
+
206
+ ## Security
207
+
208
+ - AI-generated code is a **draft**, not a deliverable.
209
+ - Verify: does it compile? do tests pass? does it meet EARS criteria?
210
+ - Never commit secrets. Use environment variables or Secrets Manager.
211
+ - Review diffs before accepting agent changes.
212
+ - Enable secret scanning in CI (e.g., GitGuardian, truffleHog).
213
+ - Use `.gitignore` (and `.kiroignore` for Kiro) to exclude sensitive files.
214
+
215
+ ## Global Install (Optional)
216
+
217
+ ```bash
218
+ npm install -g specly
219
+ specly --agent cursor --feature my-feature
220
+ ```
221
+
222
+ On install, this guide is copied into your project and opened in your IDE.
223
+
224
+ ---
225
+
226
+ **First time?** Open `requirements.md` and replace the placeholders with your real feature. Then run through the workflow: Requirements → Design → Tasks → Build → Validate.
@@ -0,0 +1,51 @@
1
+ # Design
2
+
3
+ > Describe **how** to implement technically. Keep the 6 fixed sections.
4
+
5
+ ## 1. Overview
6
+
7
+ [Brief summary of the feature, goal, and scope.]
8
+
9
+ ## 2. Architecture
10
+
11
+ [High-level decisions: patterns, layers, integrations.]
12
+
13
+ - [Component or layer 1]
14
+ - [Component or layer 2]
15
+
16
+ ## 3. Components
17
+
18
+ | Component | Responsibility |
19
+ |-----------|----------------|
20
+ | [Name] | [What it does] |
21
+
22
+ ## 4. Data Models
23
+
24
+ [Entities, relationships, and data flows. Use Mermaid when helpful.]
25
+
26
+ ```mermaid
27
+ flowchart LR
28
+ A[Input] --> B[Process]
29
+ B --> C[Output]
30
+ ```
31
+
32
+ ## 5. Error Handling
33
+
34
+ - [Error scenario 1] → [Expected response]
35
+ - [Error scenario 2] → [Expected response]
36
+ - [Error scenario 3 (external dependency failure)] → [Fallback / retry strategy]
37
+
38
+ ## 6. Security
39
+
40
+ - **Authentication**: [How the user/system identity is verified]
41
+ - **Authorization**: [Permission model — who can do what]
42
+ - **Secrets**: [Where credentials live — env vars, secrets manager; never in code]
43
+ - **Data protection**: [Encryption at rest and in transit, PII handling]
44
+ - **Audit**: [Logging sensitive operations]
45
+
46
+ ## 7. Testing
47
+
48
+ - [ ] Unit test: [EARS criterion it validates]
49
+ - [ ] Integration test: [end-to-end flow]
50
+ - [ ] Regression test: [edge case]
51
+ - [ ] Security test: [auth, injection, or permission scenario]