specly 0.1.0__py3-none-any.whl
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.
- specly-0.1.0.dist-info/METADATA +72 -0
- specly-0.1.0.dist-info/RECORD +20 -0
- specly-0.1.0.dist-info/WHEEL +5 -0
- specly-0.1.0.dist-info/entry_points.txt +2 -0
- specly-0.1.0.dist-info/top_level.txt +1 -0
- specly_cli/__init__.py +3 -0
- specly_cli/__main__.py +7 -0
- specly_cli/assets/artifact-contract-v1.json +76 -0
- specly_cli/assets/how-to-use.md +226 -0
- specly_cli/assets/templates/design.md +51 -0
- specly_cli/assets/templates/requirements.md +49 -0
- specly_cli/assets/templates/steering.md +91 -0
- specly_cli/assets/templates/tasks.md +40 -0
- specly_cli/assets/templates/verification.md +44 -0
- specly_cli/cli.py +269 -0
- specly_cli/contract.py +100 -0
- specly_cli/layout.py +106 -0
- specly_cli/optional/__init__.py +1 -0
- specly_cli/optional/ax_adapter.py +160 -0
- specly_cli/optional/strands_adapter.py +147 -0
|
@@ -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,20 @@
|
|
|
1
|
+
specly_cli/__init__.py,sha256=QDh0bhdjzfE8nh1sJhU2y8pFIy4F1wUAleWES3gSqhM,89
|
|
2
|
+
specly_cli/__main__.py,sha256=SkqPuBD1h6n4E0LFOspmdeiZ3b7H4QpikG4pK8tEeiE,137
|
|
3
|
+
specly_cli/cli.py,sha256=Gm7rS4ct5CDwjd7LSulWKtqdPmX_pBUEqE6BQkCs8D0,10225
|
|
4
|
+
specly_cli/contract.py,sha256=JYbrQtp073xIvrO7oQclvdCsDkcFc_6bt5OGtTjZlfY,3705
|
|
5
|
+
specly_cli/layout.py,sha256=GW3Rkzl5ZUdQ1nzKOfps7WeNF8d03NTXvtkcEw6Qi0Y,4348
|
|
6
|
+
specly_cli/assets/artifact-contract-v1.json,sha256=iTV5HK7mmS2BXJtjNYlPXxcdVxUW4lULC9yMSrjtgr0,2834
|
|
7
|
+
specly_cli/assets/how-to-use.md,sha256=DQn3C29pZVCVibakJMfT8UpCzz3xNLG07SBh1ad5VuU,8824
|
|
8
|
+
specly_cli/assets/templates/design.md,sha256=4n3EShJWUscoZ0Y3vm2oITVfSAJ8rXah1diLvphpvYc,1293
|
|
9
|
+
specly_cli/assets/templates/requirements.md,sha256=6UsxVJVCr6OAoIFOS1Pmf3c5P2lJ-8et29rOyZ8hM2U,2243
|
|
10
|
+
specly_cli/assets/templates/steering.md,sha256=RgcEmrcIEjYDwPxifqtL99Tq8-6i5STxuMaBeM9qwrE,3119
|
|
11
|
+
specly_cli/assets/templates/tasks.md,sha256=RWbAEijYWkyT8LOj5x7ja0aujkCENPCjisVc9kTbPE0,1425
|
|
12
|
+
specly_cli/assets/templates/verification.md,sha256=6xcjL4MW2X-uNkMmAK27_twbKAi7aKBSlRtp9RZKI-8,1381
|
|
13
|
+
specly_cli/optional/__init__.py,sha256=V4WeN0_dB1fsVlhtnEUWYBViaoQH8XSoNmh7_3Mhg3k,40
|
|
14
|
+
specly_cli/optional/ax_adapter.py,sha256=INHqwmWX0FChFrItUQ73d5pisCX5hZWdbBT9MU7zKBE,5263
|
|
15
|
+
specly_cli/optional/strands_adapter.py,sha256=mtU14-aFMXnKuvT1eicJNVg6nbQpyRsm32FGWMBJbtE,5432
|
|
16
|
+
specly-0.1.0.dist-info/METADATA,sha256=EEzxV8R9qO9YNXXWbEeqso0sQTjE4hL79nl3MVV7a58,4242
|
|
17
|
+
specly-0.1.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
18
|
+
specly-0.1.0.dist-info/entry_points.txt,sha256=Qa6YdwE5G-LLc3mQM0dxFPagB7wj86s64oblGWHXoew,47
|
|
19
|
+
specly-0.1.0.dist-info/top_level.txt,sha256=LACTfPYY1IIHWsvemDKpfu8FWGzj78qcs2isweSmRrg,11
|
|
20
|
+
specly-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
specly_cli
|
specly_cli/__init__.py
ADDED
specly_cli/__main__.py
ADDED
|
@@ -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]
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Requirements
|
|
2
|
+
|
|
3
|
+
> Define **what** to build and **why**. Use user stories and testable EARS criteria.
|
|
4
|
+
> Before writing code, hunt for ambiguities: vague terms, missing edge cases, undefined actors.
|
|
5
|
+
|
|
6
|
+
## Feature: [Feature Name]
|
|
7
|
+
|
|
8
|
+
### User Story 1
|
|
9
|
+
As a [role], I want [action] so that [benefit].
|
|
10
|
+
|
|
11
|
+
#### Acceptance Criteria (EARS)
|
|
12
|
+
- WHEN [trigger event] THE SYSTEM SHALL [expected behavior]
|
|
13
|
+
- IF [undesired condition] THEN THE SYSTEM SHALL [error handling or alternative]
|
|
14
|
+
- WHILE [continuous state] THE SYSTEM SHALL [keep reacting]
|
|
15
|
+
- WHERE [specific context or location] THE SYSTEM SHALL [contextual behavior]
|
|
16
|
+
- AS SOON AS [event] THE SYSTEM SHALL [time-sensitive response]
|
|
17
|
+
|
|
18
|
+
### User Story 2
|
|
19
|
+
As a [role], I want [action] so that [benefit].
|
|
20
|
+
|
|
21
|
+
#### Acceptance Criteria
|
|
22
|
+
- WHEN [event] THE SYSTEM SHALL [behavior]
|
|
23
|
+
- IF [error case] THEN THE SYSTEM SHALL [fallback]
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Ambiguity Checklist
|
|
28
|
+
|
|
29
|
+
Before approving requirements, verify:
|
|
30
|
+
|
|
31
|
+
- [ ] Every noun is clearly defined (no "user" when you mean "admin")
|
|
32
|
+
- [ ] Every condition has a negative case (what happens when it fails?)
|
|
33
|
+
- [ ] Numbers have explicit limits ("at most 5", not "a few")
|
|
34
|
+
- [ ] Temporal words are precise ("within 2 seconds", not "instantly")
|
|
35
|
+
- [ ] Actors are identified (who triggers? who receives?)
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## EARS Reference
|
|
40
|
+
|
|
41
|
+
| Keyword | Use case | Example |
|
|
42
|
+
|---------------|----------------------------------|------------------------------------------------------------------|
|
|
43
|
+
| `WHEN` | Trigger event (ubiquitous) | WHEN the user submits THE SYSTEM SHALL validate the form |
|
|
44
|
+
| `IF...THEN` | Undesired condition / error | IF the email is invalid THEN THE SYSTEM SHALL show an error |
|
|
45
|
+
| `WHILE` | Continuous state | WHILE the upload is in progress THE SYSTEM SHALL show a spinner |
|
|
46
|
+
| `WHERE` | Location or feature context | WHERE the user is admin THE SYSTEM SHALL show the panel |
|
|
47
|
+
| `AS SOON AS` | Time-sensitive response | AS SOON AS the payment completes THE SYSTEM SHALL send a receipt |
|
|
48
|
+
|
|
49
|
+
**Rule:** If you cannot test it, it is not clear enough yet. If a criterion does not have a clear pass/fail, rewrite it.
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# Steering
|
|
2
|
+
|
|
3
|
+
> Persistent project context. The agent should read this file every session.
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
|
|
7
|
+
[Why this project exists and what problem it solves.]
|
|
8
|
+
|
|
9
|
+
## Principles
|
|
10
|
+
|
|
11
|
+
- Prioritize clarity over speed.
|
|
12
|
+
- Avoid ambiguity in requirements and tasks.
|
|
13
|
+
- Treat generated code as a draft until review and tests pass.
|
|
14
|
+
- When something changes, fix the spec before patching code.
|
|
15
|
+
- Validate before merging: tests + EARS criteria + security review.
|
|
16
|
+
|
|
17
|
+
## Stack
|
|
18
|
+
|
|
19
|
+
- [Primary language / framework]
|
|
20
|
+
- [Database / services]
|
|
21
|
+
- [Build and test tools]
|
|
22
|
+
- [Cloud provider / deployment target]
|
|
23
|
+
|
|
24
|
+
## Project Structure
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
[Relevant folder tree]
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Agent Rules
|
|
31
|
+
|
|
32
|
+
- Read `requirements.md`, `design.md`, `tasks.md`, and `steering.md` before proposing changes.
|
|
33
|
+
- If context is missing, ask before inventing.
|
|
34
|
+
- Write acceptance criteria in testable format (EARS).
|
|
35
|
+
- Split work into small, verifiable tasks.
|
|
36
|
+
- Keep traceability between requirements, design, and tasks.
|
|
37
|
+
- Run the verification checklist after implementation.
|
|
38
|
+
|
|
39
|
+
## Conventions
|
|
40
|
+
|
|
41
|
+
- `requirements.md` → the **what**
|
|
42
|
+
- `design.md` → the **how**
|
|
43
|
+
- `tasks.md` → the **order**
|
|
44
|
+
- `verification.md` → the **done checklist**
|
|
45
|
+
- `steering.md` → **context** and rules
|
|
46
|
+
|
|
47
|
+
## Hooks (Automations)
|
|
48
|
+
|
|
49
|
+
> Hooks are scripts that run automatically on events (pre-commit, pre-push, post-merge).
|
|
50
|
+
|
|
51
|
+
- [ ] Pre-commit: lint + format + secret scanner
|
|
52
|
+
- [ ] Pre-push: run full test suite
|
|
53
|
+
- [ ] Post-merge: update changelog or deploy
|
|
54
|
+
|
|
55
|
+
Store hook scripts in:
|
|
56
|
+
- Kiro: `.kiro/hooks/`
|
|
57
|
+
- Generic: `.githooks/`
|
|
58
|
+
|
|
59
|
+
## MCP / NCP Servers (External Context)
|
|
60
|
+
|
|
61
|
+
> MCP servers connect the agent to live documentation, APIs, or databases.
|
|
62
|
+
> They reduce hallucinations by providing current data instead of relying on training cutoffs.
|
|
63
|
+
|
|
64
|
+
| Server | Purpose | Source |
|
|
65
|
+
|-------------|--------------------------|-----------------------------|
|
|
66
|
+
| [name] | [what it provides] | [URL or package] |
|
|
67
|
+
|
|
68
|
+
Example MCP servers from the AWS ecosystem:
|
|
69
|
+
- `aws-documentation` — search and read AWS docs
|
|
70
|
+
- `aws-pricing` — live pricing lookups
|
|
71
|
+
- `aws-iac` — CloudFormation validation + CDK patterns
|
|
72
|
+
|
|
73
|
+
## Skills (On-Demand Instructions)
|
|
74
|
+
|
|
75
|
+
> Skills are markdown files activated by keywords. They teach the agent how to do specific tasks.
|
|
76
|
+
|
|
77
|
+
| Keyword | Skill file | What it does |
|
|
78
|
+
|-----------------------------|-----------------------------|-------------------------------|
|
|
79
|
+
| `review-pr` | `skills/review-pr.md` | PR template + review steps |
|
|
80
|
+
| [your-keyword] | `skills/[name].md` | [description] |
|
|
81
|
+
|
|
82
|
+
Store skills in `.kiro/skills/` (Kiro) or `skills/` (generic).
|
|
83
|
+
|
|
84
|
+
## Security
|
|
85
|
+
|
|
86
|
+
- Do not commit secrets to the repository.
|
|
87
|
+
- Store credentials in environment variables or secrets manager, never in code.
|
|
88
|
+
- Always review the diff before accepting changes.
|
|
89
|
+
- Use `.gitignore` (and `.kiroignore` for Kiro) to exclude sensitive files.
|
|
90
|
+
- Follow the principle of least privilege for all tokens and roles.
|
|
91
|
+
- Enable secret scanning in CI (e.g., GitGuardian, truffleHog).
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Tasks
|
|
2
|
+
|
|
3
|
+
> Define the **order** of implementation. Max 2 hierarchy levels. Each task references its Requirements.
|
|
4
|
+
|
|
5
|
+
- [ ] 1. [Main task — references User Story 1]
|
|
6
|
+
- [ ] 1.1 [Verifiable sub-task — small enough to review in one pass]
|
|
7
|
+
- [ ] 1.2 [Verifiable sub-task]
|
|
8
|
+
|
|
9
|
+
- [ ] 2. [Main task — references User Story 2]
|
|
10
|
+
- [ ] 2.1 [Verifiable sub-task]
|
|
11
|
+
- [ ] 2.2 [Verifiable sub-task]
|
|
12
|
+
|
|
13
|
+
- [ ] 3. Validation and wrap-up
|
|
14
|
+
- [ ] 3.1 Verify EARS criteria from requirements.md
|
|
15
|
+
- [ ] 3.2 Run tests defined in design.md
|
|
16
|
+
- [ ] 3.3 Security review: no secrets leaked, proper auth checks
|
|
17
|
+
- [ ] 3.4 Update steering.md if new conventions emerged
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Rules
|
|
22
|
+
|
|
23
|
+
### Task Slicing
|
|
24
|
+
- If a task has more than 5 sub-steps, split it into smaller tasks.
|
|
25
|
+
- One task = one logical change. If it does two unrelated things, split it.
|
|
26
|
+
- Each task should feel like "I know exactly what to do here."
|
|
27
|
+
|
|
28
|
+
### Atomic Commits
|
|
29
|
+
- One commit per checked task (when possible).
|
|
30
|
+
```
|
|
31
|
+
feat(auth): implement login validation
|
|
32
|
+
```
|
|
33
|
+
- If a task spans multiple files but is one logical change, it is still one commit.
|
|
34
|
+
- Mark `[x]` only when the task is verified (tested + reviewed).
|
|
35
|
+
- Never commit secrets, API keys, or credentials.
|
|
36
|
+
|
|
37
|
+
### Traceability
|
|
38
|
+
- Every task references a requirement or design section.
|
|
39
|
+
- If a task does not trace back to a requirement, does it belong here?
|
|
40
|
+
- After all tasks are done, run verification.md against the implementation.
|