浏览代码

Add proactive design-by-contract workflow guidance

main
Nano 2 小时前
父节点
当前提交
77bfa962b1
共有 2 个文件被更改,包括 34 次插入8 次删除
  1. +1
    -1
      .ai/AGENTS.md
  2. +33
    -7
      .ai/workflows/new-feature.md

+ 1
- 1
.ai/AGENTS.md 查看文件

@@ -102,7 +102,7 @@ These files are for transient notes and local experimentation and should not nor

1. Do not jump straight to code when requirements are unclear.
2. Convert ideas into user stories and acceptance criteria.
3. Define the design-by-contract boundary before implementation:
3. When a feature, command, or data object benefits from explicit boundaries, proactively lead a design-by-contract pass with the development team before implementation:
- Preconditions
- Inputs and outputs
- Postconditions


+ 33
- 7
.ai/workflows/new-feature.md 查看文件

@@ -9,36 +9,62 @@ From idea to accepted feature.
- Product Owner has requested work.
- Relevant project context is available or assumptions are stated.
- Correct agents and skills are selected.
- The agent has decided whether the work benefits from a design-by-contract pass.

## Steps

1. Restate the goal.
2. Identify the primary agent.
3. Load needed skills.
4. Define the contract first:
4. If the work benefits from explicit boundaries, gather the development team around a design-by-contract pass before implementation.
5. Define the contract first:
- Preconditions
- Inputs and outputs
- Postconditions
- Invariants
- Failure modes
- Side effects
5. Define the expected output.
6. Break work into small steps.
7. Produce the result.
8. Validate against the relevant checklist and contract.
9. Record important decisions.
10. Propose file evolution when a durable lesson was learned.
6. Define the expected output.
7. Break work into small steps.
8. Produce the result.
9. Validate against the relevant checklist and contract.
10. Record important decisions.
11. Propose file evolution when a durable lesson was learned.

## Outputs

- Markdown summary
- Contract or contract notes, when relevant
- Example story/contract/test-plan pairing, when it helps clarify the pattern
- Decisions
- Risks
- Tasks
- Test or validation notes
- Improvement proposals, when needed

## Example Flow

Use this pattern when the feature benefits from explicit boundaries.

```text
Story: As a user, I want to export a territory, so that I can download the generated files.

Contract:
- Preconditions: The territory exists and the user is authorized.
- Inputs: Territory ID.
- Outputs: A downloadable ZIP file.
- Postconditions: The ZIP contains the generated XLSX and PDFs.
- Invariants: The exported files are named consistently.
- Failure modes: Missing territory, file write failure, or export timeout.
- Side effects: Temporary export files may be created and cleaned up after download.

Test plan:
- Verify the export is rejected when the territory is missing.
- Verify the ZIP contains both the spreadsheet and the PDFs.
- Verify failed file writes are reported as errors.
- Verify cleanup happens after download.
```

## Exit Criteria

- Product Owner can review or act.


正在加载...
取消
保存

Powered by TurnKey Linux.