ai-dev-setup 1.0.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 +21 -0
- package/README.md +338 -0
- package/bin/ai-dev-setup.js +7 -0
- package/package.json +35 -0
- package/src/cli/index.js +142 -0
- package/src/cli/logger.js +29 -0
- package/src/cli/prompts.js +267 -0
- package/src/commands/init.js +321 -0
- package/src/commands/update.js +6 -0
- package/src/constants.js +34 -0
- package/src/core/detector.js +164 -0
- package/src/core/git-ref.js +28 -0
- package/src/core/gitignore-vendor.js +126 -0
- package/src/core/renderer.js +97 -0
- package/src/core/vendors.js +354 -0
- package/src/core/writer.js +67 -0
- package/src/platforms/claude-code.js +33 -0
- package/src/platforms/cursor.js +33 -0
- package/src/platforms/platform.js +18 -0
- package/src/platforms/registry.js +56 -0
- package/src/templates/claude-code/claude.md.tmpl +58 -0
- package/src/templates/claude-code/commands/kickoff.md.tmpl +18 -0
- package/src/templates/claude-code/commands/review.md.tmpl +20 -0
- package/src/templates/claude-code/commands/ship.md.tmpl +19 -0
- package/src/templates/claude-code/settings.json.tmpl +17 -0
- package/src/templates/cursor/cursorrules.tmpl +36 -0
- package/src/templates/cursor/rules/agents.mdc.tmpl +12 -0
- package/src/templates/cursor/rules/core-rules.mdc.tmpl +14 -0
- package/src/templates/cursor/rules/review.mdc.tmpl +13 -0
- package/src/templates/cursor/rules/workflow.mdc.tmpl +12 -0
- package/src/templates/ignore/claudeignore.tmpl +25 -0
- package/src/templates/ignore/cursorignore.tmpl +25 -0
- package/src/templates/shared/agents.md.tmpl +41 -0
- package/src/templates/shared/docs/api-patterns.md.tmpl +39 -0
- package/src/templates/shared/docs/architecture.md.tmpl +41 -0
- package/src/templates/shared/docs/conventions.md.tmpl +50 -0
- package/src/templates/shared/docs/error-handling.md.tmpl +32 -0
- package/src/templates/shared/docs/security.md.tmpl +37 -0
- package/src/templates/shared/docs/testing.md.tmpl +34 -0
- package/src/templates/shared/rules.md.tmpl +65 -0
- package/src/templates/shared/workflow.md.tmpl +42 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"permissions": {
|
|
3
|
+
"allow": [
|
|
4
|
+
"Read(**)",
|
|
5
|
+
"Edit(**)",
|
|
6
|
+
"Bash(npm:*)",
|
|
7
|
+
"Bash(npx:*)",
|
|
8
|
+
"Bash(pnpm:*)",
|
|
9
|
+
"Bash(yarn:*)",
|
|
10
|
+
"Bash(node:*)"
|
|
11
|
+
]
|
|
12
|
+
},
|
|
13
|
+
"meta": {
|
|
14
|
+
"projectName": "{{PROJECT_NAME}}",
|
|
15
|
+
"generatedBy": "ai-dev-setup"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# {{PROJECT_NAME}} — Cursor
|
|
2
|
+
|
|
3
|
+
## Core stack (required)
|
|
4
|
+
|
|
5
|
+
| System | Location | Role |
|
|
6
|
+
|--------|----------|------|
|
|
7
|
+
| Superpowers | `vendor/superpowers/`, `.cursor-plugin/plugin.json` | Workflow engine — use bundled skills for planning, TDD, review |
|
|
8
|
+
| Agency Agents | `vendor/agency-agents/`, rules `agency-*.mdc` in `.cursor/rules/` | Specialist agents — select per `.ai/agents.md` |
|
|
9
|
+
|
|
10
|
+
If `vendor/` or `.cursor-plugin/` is missing, run `npx ai-dev-setup init` without `--skip-vendor`.
|
|
11
|
+
|
|
12
|
+
## Pointers (do not duplicate)
|
|
13
|
+
|
|
14
|
+
| File | Purpose |
|
|
15
|
+
|------|---------|
|
|
16
|
+
| `.ai/rules.md` | Coding standards, anti-patterns, doc index |
|
|
17
|
+
| `.ai/workflow.md` | Lifecycle, TDD, review checklist |
|
|
18
|
+
| `.ai/agents.md` | Specialist activation |
|
|
19
|
+
| `docs/*` | Deep references—load only when relevant |
|
|
20
|
+
|
|
21
|
+
## Project facts
|
|
22
|
+
|
|
23
|
+
- Language: {{LANGUAGE}} — Framework: {{FRAMEWORK}} — DB: {{DATABASE}}
|
|
24
|
+
- Commands: `{{TEST_CMD}}` · `{{LINT_CMD}}` · `{{BUILD_CMD}}`
|
|
25
|
+
|
|
26
|
+
## Behavior
|
|
27
|
+
|
|
28
|
+
- Answer briefly; cite paths instead of pasting large files
|
|
29
|
+
- Prefer existing patterns in-repo over generic tutorials
|
|
30
|
+
- After architectural change, update `docs/ARCHITECTURE.md` in the same change when behavior crosses modules
|
|
31
|
+
|
|
32
|
+
## Rules layout
|
|
33
|
+
|
|
34
|
+
- `core-rules.mdc` — always on (keep lean)
|
|
35
|
+
- `workflow.mdc`, `review.mdc`, `agents.mdc` — load when matching the task
|
|
36
|
+
- `agency-*.mdc` — Agency specialist rules (on demand)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Specialist agent usage for {{PROJECT_NAME}} (Agency + .ai/agents.md)
|
|
3
|
+
globs: ""
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Agents
|
|
8
|
+
|
|
9
|
+
- Primary source: **Agency Agents** in `vendor/agency-agents/` — project rules under `.cursor/rules/agency-*.mdc`
|
|
10
|
+
- Use `.ai/agents.md` tables to map task → specialist (planning, architecture, implementation, test, perf, review, security, docs)
|
|
11
|
+
- Default: **one** primary agent per task; parallelize only independent workstreams
|
|
12
|
+
- Superpowers (`vendor/superpowers/`) owns workflow phases; Agency owns role-specific execution
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Core coding constraints for {{PROJECT_NAME}} (token-lean; details in .ai/rules.md)
|
|
3
|
+
globs: "**/*"
|
|
4
|
+
alwaysApply: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Core rules
|
|
8
|
+
|
|
9
|
+
- Read `.ai/rules.md` for full standards; obey stack row for {{LANGUAGE}} / {{FRAMEWORK}}
|
|
10
|
+
- Max **200** lines/file, **50** lines/function; early returns; no commented-out code in commits
|
|
11
|
+
- Run `{{LINT_CMD}}` before hand-off; fix or explain waivers
|
|
12
|
+
- Do not commit secrets or log tokens/PII
|
|
13
|
+
- Touch tests when behavior changes (`{{TEST_CMD}}`) or document the gap
|
|
14
|
+
- Use `docs/CONVENTIONS.md` for stack-specific style; load other `docs/*` only when needed
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Pre-merge review checklist for {{PROJECT_NAME}}
|
|
3
|
+
globs: ""
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Review
|
|
8
|
+
|
|
9
|
+
- Acceptance checks satisfied; no accidental scope creep
|
|
10
|
+
- Lint/test/build scripts clean (`{{LINT_CMD}}`, `{{TEST_CMD}}`, `{{BUILD_CMD}}`)
|
|
11
|
+
- Security: input validation, authz, secrets, injection risks per `docs/SECURITY.md`
|
|
12
|
+
- Docs updated when public behavior or architecture changes
|
|
13
|
+
- Merge risks + rollback noted for risky changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Feature workflow and TDD expectations for {{PROJECT_NAME}}
|
|
3
|
+
globs: ""
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Workflow
|
|
8
|
+
|
|
9
|
+
- Follow `.ai/workflow.md` phases: understand → design → plan → implement → review → ship
|
|
10
|
+
- TDD when harness exists: red → green → refactor; add minimal harness if missing and user agrees
|
|
11
|
+
- Each plan task lists **path**, **intent**, and **verification** (command or observable outcome)
|
|
12
|
+
- Map errors per `docs/ERROR-HANDLING.md`; API shape per `docs/API-PATTERNS.md` when touching HTTP
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Generated by ai-dev-setup — Claude Code ignore
|
|
2
|
+
node_modules/
|
|
3
|
+
.git/
|
|
4
|
+
dist/
|
|
5
|
+
build/
|
|
6
|
+
coverage/
|
|
7
|
+
*.lock
|
|
8
|
+
package-lock.json
|
|
9
|
+
yarn.lock
|
|
10
|
+
pnpm-lock.yaml
|
|
11
|
+
*.map
|
|
12
|
+
.env
|
|
13
|
+
.env.*
|
|
14
|
+
*.log
|
|
15
|
+
__pycache__/
|
|
16
|
+
.venv/
|
|
17
|
+
vendor/superpowers/tests/
|
|
18
|
+
vendor/agency-agents/.git/
|
|
19
|
+
.next/
|
|
20
|
+
.nuxt/
|
|
21
|
+
.output/
|
|
22
|
+
*.min.js
|
|
23
|
+
*.min.css
|
|
24
|
+
.cursor/
|
|
25
|
+
.cursorrules
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Generated by ai-dev-setup — Cursor ignore
|
|
2
|
+
node_modules/
|
|
3
|
+
.git/
|
|
4
|
+
dist/
|
|
5
|
+
build/
|
|
6
|
+
coverage/
|
|
7
|
+
*.lock
|
|
8
|
+
package-lock.json
|
|
9
|
+
yarn.lock
|
|
10
|
+
pnpm-lock.yaml
|
|
11
|
+
*.map
|
|
12
|
+
.env
|
|
13
|
+
.env.*
|
|
14
|
+
*.log
|
|
15
|
+
__pycache__/
|
|
16
|
+
.venv/
|
|
17
|
+
vendor/superpowers/tests/
|
|
18
|
+
vendor/agency-agents/.git/
|
|
19
|
+
.next/
|
|
20
|
+
.nuxt/
|
|
21
|
+
.output/
|
|
22
|
+
*.min.js
|
|
23
|
+
*.min.css
|
|
24
|
+
.claude/
|
|
25
|
+
CLAUDE.md
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Agent activation — {{PROJECT_NAME}}
|
|
2
|
+
|
|
3
|
+
**Agency Agents** (vendored in `vendor/agency-agents/`) are the default specialist system. **Superpowers** (vendored in `vendor/superpowers/`) is the default workflow engine. Use both together: Superpowers for phase discipline, Agency for role fit.
|
|
4
|
+
|
|
5
|
+
## Layout
|
|
6
|
+
|
|
7
|
+
| Piece | Claude Code | Cursor |
|
|
8
|
+
|-------|-------------|--------|
|
|
9
|
+
| Agency | `.claude/agents/*.md` | `.cursor/rules/agency-*.mdc` |
|
|
10
|
+
| Superpowers skills | `.claude/skills/` | `.cursor-plugin` → `vendor/superpowers` |
|
|
11
|
+
|
|
12
|
+
## Engineering agents
|
|
13
|
+
|
|
14
|
+
| Task focus | Agent role |
|
|
15
|
+
|------------|------------|
|
|
16
|
+
| Requirements → plan | Product/planning: clarify scope, acceptance, risks |
|
|
17
|
+
| Architecture / structure | System design: boundaries, modules, data flow |
|
|
18
|
+
| Implementation | Feature dev: code changes following `.ai/rules.md` |
|
|
19
|
+
| Tests | QA test: coverage gaps, edge cases, fixtures |
|
|
20
|
+
| Performance | Perf: hot paths, allocations, I/O, caching |
|
|
21
|
+
| Tooling / CI | Platform: scripts, pipelines, developer ergonomics |
|
|
22
|
+
|
|
23
|
+
## Quality agents
|
|
24
|
+
|
|
25
|
+
| Task focus | Agent role |
|
|
26
|
+
|------------|------------|
|
|
27
|
+
| Review | Code review: correctness, safety, maintainability |
|
|
28
|
+
| Security review | Threats: authz, input validation, secrets, supply chain |
|
|
29
|
+
| Docs | Technical writing: clarity, examples, diagrams |
|
|
30
|
+
|
|
31
|
+
## Claude Code
|
|
32
|
+
|
|
33
|
+
- Invoke slash commands from `.claude/commands/` when they match the phase (`/kickoff`, `/review`, `/ship`)
|
|
34
|
+
- Load Agency agent definitions from `.claude/agents/`; match filename/topic to task
|
|
35
|
+
- Keep long guidance in `docs/`; keep messages short with pointers
|
|
36
|
+
|
|
37
|
+
## Cursor
|
|
38
|
+
|
|
39
|
+
- Load `.cursor/rules/workflow.mdc`, `review.mdc`, `agents.mdc` when the task matches
|
|
40
|
+
- Load relevant `agency-*.mdc` when using a named Agency specialist
|
|
41
|
+
- Keep `.cursorrules` as the index; do not duplicate `.ai/rules.md`
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# API patterns — {{PROJECT_NAME}}
|
|
2
|
+
|
|
3
|
+
## REST shape
|
|
4
|
+
|
|
5
|
+
| Concern | Rule |
|
|
6
|
+
|---------|------|
|
|
7
|
+
| URLs | Plural nouns; stable versioning (`/v1/...`) |
|
|
8
|
+
| Methods | `GET` safe/idempotent; `POST` create; `PUT`/`PATCH` update; `DELETE` remove |
|
|
9
|
+
| Status | Use correct 2xx/4xx/5xx; avoid 200 with error payloads |
|
|
10
|
+
|
|
11
|
+
## Request validation
|
|
12
|
+
|
|
13
|
+
- Reject unknown fields when schema is strict
|
|
14
|
+
- Normalize types at the boundary; domain receives validated models
|
|
15
|
+
|
|
16
|
+
## Pagination
|
|
17
|
+
|
|
18
|
+
| Style | When |
|
|
19
|
+
|-------|------|
|
|
20
|
+
| Cursor-based | Large, stable feeds |
|
|
21
|
+
| Offset/limit | Admin tools with small datasets |
|
|
22
|
+
|
|
23
|
+
Include `next_cursor` or `page`/`page_size` consistently.
|
|
24
|
+
|
|
25
|
+
## Errors
|
|
26
|
+
|
|
27
|
+
| Field | Purpose |
|
|
28
|
+
|-------|---------|
|
|
29
|
+
| `code` | Machine-stable identifier |
|
|
30
|
+
| `message` | Human readable, safe for clients |
|
|
31
|
+
| `details` | Optional structured context (no secrets) |
|
|
32
|
+
|
|
33
|
+
## Idempotency
|
|
34
|
+
|
|
35
|
+
- Use idempotency keys for `POST` that create billable or side-effectful resources
|
|
36
|
+
|
|
37
|
+
## Versioning
|
|
38
|
+
|
|
39
|
+
- Breaking changes: new major version path or explicit deprecation window documented
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Architecture — {{PROJECT_NAME}}
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Describe what the system does for users and the main runtime boundaries.
|
|
6
|
+
|
|
7
|
+
## Context diagram
|
|
8
|
+
|
|
9
|
+
- **Actors**: (users, admins, other services)
|
|
10
|
+
- **External systems**: (payments, email, identity)
|
|
11
|
+
- **This repo**: (apps, packages, workers)
|
|
12
|
+
|
|
13
|
+
## Logical structure
|
|
14
|
+
|
|
15
|
+
| Area | Responsibility | Key modules |
|
|
16
|
+
|------|------------------|-------------|
|
|
17
|
+
| UI / API edge | Transport, validation at boundary | _TBD_ |
|
|
18
|
+
| Application | Use cases, orchestration | _TBD_ |
|
|
19
|
+
| Domain | Entities, invariants, policies | _TBD_ |
|
|
20
|
+
| Infrastructure | DB, queues, object storage, 3rd-party SDKs | _TBD_ |
|
|
21
|
+
|
|
22
|
+
## Data flow
|
|
23
|
+
|
|
24
|
+
1. Request/event enters at: _TBD_
|
|
25
|
+
2. Authoritative state lives in: _TBD_
|
|
26
|
+
3. Async work is handled by: _TBD_
|
|
27
|
+
|
|
28
|
+
## Key decisions
|
|
29
|
+
|
|
30
|
+
| Decision | Why | Tradeoff |
|
|
31
|
+
|----------|-----|----------|
|
|
32
|
+
| _TBD_ | _TBD_ | _TBD_ |
|
|
33
|
+
|
|
34
|
+
## Non-goals
|
|
35
|
+
|
|
36
|
+
- _List explicit out-of-scope items to prevent accidental coupling_
|
|
37
|
+
|
|
38
|
+
## Evolution
|
|
39
|
+
|
|
40
|
+
- Next likely split: _TBD_
|
|
41
|
+
- Deprecations: _TBD_
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Conventions — {{PROJECT_NAME}}
|
|
2
|
+
|
|
3
|
+
{{#IF_TYPESCRIPT}}
|
|
4
|
+
## TypeScript
|
|
5
|
+
|
|
6
|
+
- Enable `strict`; avoid `any`; prefer `unknown` + narrowing
|
|
7
|
+
- Explicit return types on exported functions and public class methods
|
|
8
|
+
- Use discriminated unions for variant results instead of loose strings
|
|
9
|
+
- Prefer `import type` for type-only imports
|
|
10
|
+
- Co-locate tests as `*.test.ts` or `__tests__/` per repo standard
|
|
11
|
+
{{/IF_TYPESCRIPT}}
|
|
12
|
+
|
|
13
|
+
{{#IF_JAVASCRIPT}}
|
|
14
|
+
## JavaScript
|
|
15
|
+
|
|
16
|
+
- Prefer ES modules; avoid default exports for shared utilities
|
|
17
|
+
- Add JSDoc types where the codebase has not migrated to TypeScript
|
|
18
|
+
- Run the project's formatter and linter before PR
|
|
19
|
+
{{/IF_JAVASCRIPT}}
|
|
20
|
+
|
|
21
|
+
{{#IF_PYTHON}}
|
|
22
|
+
## Python
|
|
23
|
+
|
|
24
|
+
- Follow PEP 8; use a formatter (e.g. Ruff) consistently
|
|
25
|
+
- Type hints on public functions; avoid mutable default arguments
|
|
26
|
+
- Prefer `pathlib` over string paths
|
|
27
|
+
- Tests alongside `tests/` layout already in repo
|
|
28
|
+
{{/IF_PYTHON}}
|
|
29
|
+
|
|
30
|
+
{{#IF_GO}}
|
|
31
|
+
## Go
|
|
32
|
+
|
|
33
|
+
- Handle `error` values explicitly; wrap with `%w` for traceability
|
|
34
|
+
- Keep `context.Context` on I/O boundaries
|
|
35
|
+
- Prefer small packages; avoid `util` catch-alls
|
|
36
|
+
- Run `go fmt` and `go vet` before PR
|
|
37
|
+
{{/IF_GO}}
|
|
38
|
+
|
|
39
|
+
{{#IF_FLUTTER}}
|
|
40
|
+
## Flutter / Dart
|
|
41
|
+
|
|
42
|
+
- Keep widgets small; extract `StatelessWidget` for reusable UI
|
|
43
|
+
- Avoid logic in `build`; use controllers/notifiers per project pattern
|
|
44
|
+
- Prefer immutable models; document serialization boundaries
|
|
45
|
+
{{/IF_FLUTTER}}
|
|
46
|
+
|
|
47
|
+
## Cross-cutting
|
|
48
|
+
|
|
49
|
+
- One logical change per commit when possible
|
|
50
|
+
- Update public docs when behavior visible to users changes
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Error handling — {{PROJECT_NAME}}
|
|
2
|
+
|
|
3
|
+
## Philosophy
|
|
4
|
+
|
|
5
|
+
- Fail loudly at boundaries; convert to stable user-facing errors at the edge
|
|
6
|
+
- Preserve cause chain for operators; strip internals for clients
|
|
7
|
+
|
|
8
|
+
## Custom errors
|
|
9
|
+
|
|
10
|
+
| Field | Use |
|
|
11
|
+
|-------|-----|
|
|
12
|
+
| `name` / `code` | Stable identifier for logs and metrics |
|
|
13
|
+
| `message` | Operator-safe detail |
|
|
14
|
+
| `cause` | Wrapped lower-level error |
|
|
15
|
+
|
|
16
|
+
## Boundaries
|
|
17
|
+
|
|
18
|
+
| Layer | Behavior |
|
|
19
|
+
|-------|----------|
|
|
20
|
+
| HTTP/API | Map domain failures to status + error body per `docs/API-PATTERNS.md` |
|
|
21
|
+
| UI | Show actionable copy; log correlation id |
|
|
22
|
+
| Jobs/queues | Retry only transient failures; dead-letter poison messages |
|
|
23
|
+
|
|
24
|
+
## Logging
|
|
25
|
+
|
|
26
|
+
- Structured logs: include request/job id, feature, outcome
|
|
27
|
+
- Never log secrets, tokens, full payloads with PII
|
|
28
|
+
|
|
29
|
+
## Assertions vs errors
|
|
30
|
+
|
|
31
|
+
- Use assertions for programmer mistakes in dev/test
|
|
32
|
+
- Use typed errors for expected business failures (e.g. not found, conflict)
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Security — {{PROJECT_NAME}}
|
|
2
|
+
|
|
3
|
+
## Input
|
|
4
|
+
|
|
5
|
+
- Validate all untrusted input at the boundary with explicit schemas
|
|
6
|
+
- Enforce size limits on payloads and uploads
|
|
7
|
+
|
|
8
|
+
## AuthN / AuthZ
|
|
9
|
+
|
|
10
|
+
- Authenticate callers before authorization checks
|
|
11
|
+
- Default deny; document each public route's required role/scope
|
|
12
|
+
- Re-verify authorization on every request—do not trust client-side flags alone
|
|
13
|
+
|
|
14
|
+
## Secrets
|
|
15
|
+
|
|
16
|
+
- Load from environment or a secret manager—never commit secrets
|
|
17
|
+
- Rotate credentials with a documented process
|
|
18
|
+
|
|
19
|
+
## Web (if applicable)
|
|
20
|
+
|
|
21
|
+
- Set secure cookie flags; prefer HttpOnly for session tokens
|
|
22
|
+
- Encode output contextually to mitigate XSS
|
|
23
|
+
- Use CSRF protections for cookie-based sessions on mutating routes
|
|
24
|
+
|
|
25
|
+
## Injection
|
|
26
|
+
|
|
27
|
+
- Parameterize SQL; avoid string-concatenated queries
|
|
28
|
+
- Sanitize or allow-list any dynamic file paths
|
|
29
|
+
|
|
30
|
+
## Dependencies
|
|
31
|
+
|
|
32
|
+
- Pin versions; review changelogs for security fixes
|
|
33
|
+
- Run `npm audit` / ecosystem equivalent in CI where practical
|
|
34
|
+
|
|
35
|
+
## Data
|
|
36
|
+
|
|
37
|
+
- Minimize PII collection; define retention and deletion expectations
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Testing strategy — {{PROJECT_NAME}}
|
|
2
|
+
|
|
3
|
+
## Goals
|
|
4
|
+
|
|
5
|
+
- Prove behavior the team relies on—not implementation trivia
|
|
6
|
+
- Fail fast in CI on regressions touching covered behavior
|
|
7
|
+
|
|
8
|
+
## Layout
|
|
9
|
+
|
|
10
|
+
| Layer | Where | Notes |
|
|
11
|
+
|-------|-------|-------|
|
|
12
|
+
| Unit | Colocated or `tests/unit` | Pure logic, fast |
|
|
13
|
+
| Integration | `tests/integration` | DB, HTTP, queues with test doubles where needed |
|
|
14
|
+
| E2E | `tests/e2e` | Few, high-value user paths |
|
|
15
|
+
|
|
16
|
+
## Coverage expectations
|
|
17
|
+
|
|
18
|
+
- New bug fixes include a regression test unless truly impossible—then document why
|
|
19
|
+
- Critical domain rules: aim for direct unit tests on invariants
|
|
20
|
+
|
|
21
|
+
## Do not test
|
|
22
|
+
|
|
23
|
+
- Third-party library internals
|
|
24
|
+
- Generated code without business rules
|
|
25
|
+
- Exact log message wording unless contractually required
|
|
26
|
+
|
|
27
|
+
## Mocking
|
|
28
|
+
|
|
29
|
+
- Mock I/O boundaries (HTTP, DB client, clock), not domain logic
|
|
30
|
+
- Prefer fakes over deep mocks when behavior matters
|
|
31
|
+
|
|
32
|
+
## Commands
|
|
33
|
+
|
|
34
|
+
- Default test entry: `{{TEST_CMD}}`
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Coding rules — {{PROJECT_NAME}}
|
|
2
|
+
|
|
3
|
+
## Stack
|
|
4
|
+
|
|
5
|
+
| Field | Value |
|
|
6
|
+
|-------|-------|
|
|
7
|
+
| Language | {{LANGUAGE}} |
|
|
8
|
+
| Framework | {{FRAMEWORK}} |
|
|
9
|
+
| Database | {{DATABASE}} |
|
|
10
|
+
| Test | `{{TEST_CMD}}` |
|
|
11
|
+
| Lint | `{{LINT_CMD}}` |
|
|
12
|
+
| Build | `{{BUILD_CMD}}` |
|
|
13
|
+
|
|
14
|
+
## Token efficiency (assistant)
|
|
15
|
+
|
|
16
|
+
| # | Rule |
|
|
17
|
+
|---|------|
|
|
18
|
+
| 1 | Read only files needed for the current task; prefer ripgrep over opening whole trees |
|
|
19
|
+
| 2 | Summarize long outputs; paste minimal excerpts with path:line |
|
|
20
|
+
| 3 | Do not repeat `.ai/` or `docs/` content in chat—cite paths |
|
|
21
|
+
| 4 | Propose edits in small batches; one concern per patch where possible |
|
|
22
|
+
| 5 | Stop when success criteria are met; avoid scope creep |
|
|
23
|
+
| 6 | Ask one clarifying question only when blocked |
|
|
24
|
+
|
|
25
|
+
## Style
|
|
26
|
+
|
|
27
|
+
- Prefer pure functions, early returns, shallow nesting (max 3 levels)
|
|
28
|
+
- Max **200** lines per file; split when exceeded
|
|
29
|
+
- Max **50** lines per function; extract helpers
|
|
30
|
+
- Name booleans `is/has/should`; avoid `data`/`info` without context
|
|
31
|
+
- No commented-out code in commits
|
|
32
|
+
|
|
33
|
+
## Architecture
|
|
34
|
+
|
|
35
|
+
- Feature-based folders: `features/<name>/{api,ui,lib,types}`
|
|
36
|
+
- Dependencies point inward: UI → application → domain → infrastructure
|
|
37
|
+
- Keep framework adapters at the edges; core logic framework-agnostic
|
|
38
|
+
|
|
39
|
+
## Load these docs on demand
|
|
40
|
+
|
|
41
|
+
| Topic | File |
|
|
42
|
+
|-------|------|
|
|
43
|
+
| System shape | `docs/ARCHITECTURE.md` |
|
|
44
|
+
| Stack conventions | `docs/CONVENTIONS.md` |
|
|
45
|
+
| Tests | `docs/TESTING-STRATEGY.md` |
|
|
46
|
+
| HTTP API | `docs/API-PATTERNS.md` |
|
|
47
|
+
| Errors | `docs/ERROR-HANDLING.md` |
|
|
48
|
+
| Security | `docs/SECURITY.md` |
|
|
49
|
+
|
|
50
|
+
## Git
|
|
51
|
+
|
|
52
|
+
- Conventional commits: `type(scope): summary` (types: feat, fix, docs, refactor, test, chore)
|
|
53
|
+
- Branch names: `type/short-description` or `issue-123-short-description`
|
|
54
|
+
- PRs: purpose, risk, test plan, rollback
|
|
55
|
+
|
|
56
|
+
## Anti-patterns
|
|
57
|
+
|
|
58
|
+
1. Do not add global mutable singletons for domain state
|
|
59
|
+
2. Do not catch errors without handling or rethrow with context
|
|
60
|
+
3. Do not commit secrets, tokens, or `.env*` contents
|
|
61
|
+
4. Do not skip tests for new behavior unless explicitly out of scope
|
|
62
|
+
5. Do not widen public API surface without a documented need
|
|
63
|
+
6. Do not mix formatting-only changes with functional changes
|
|
64
|
+
7. Do not depend on unspecified order where the domain requires stability
|
|
65
|
+
8. Do not silence linter rules project-wide to land a change
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Development workflow — {{PROJECT_NAME}}
|
|
2
|
+
|
|
3
|
+
## Lifecycle
|
|
4
|
+
|
|
5
|
+
1. **Understand** — restate goal, constraints, acceptance checks (3–7 bullets)
|
|
6
|
+
2. **Design** — data flow, boundaries, failure modes; link to `docs/ARCHITECTURE.md` updates if structure changes
|
|
7
|
+
3. **Plan** — ordered tasks with file paths and verification per task
|
|
8
|
+
4. **Implement** — smallest vertical slice first; keep diffs reviewable
|
|
9
|
+
5. **Review** — run `{{LINT_CMD}}` and `{{TEST_CMD}}`; fix or document exceptions
|
|
10
|
+
6. **Ship** — conventional commit; PR notes include risk + rollback
|
|
11
|
+
|
|
12
|
+
## TDD (when tests exist)
|
|
13
|
+
|
|
14
|
+
- **Red** — write a failing test that encodes the requirement
|
|
15
|
+
- **Green** — minimal code to pass
|
|
16
|
+
- **Refactor** — structure and names; keep tests green
|
|
17
|
+
|
|
18
|
+
Skip TDD only when user explicitly opts out or project has no harness yet—then add the smallest harness first.
|
|
19
|
+
|
|
20
|
+
## Planning standards
|
|
21
|
+
|
|
22
|
+
| Rule | Target |
|
|
23
|
+
|------|--------|
|
|
24
|
+
| Task size | Completable in one focused session |
|
|
25
|
+
| Task description | Verb + object + location (path or module) |
|
|
26
|
+
| Verification | Command or observable outcome per task |
|
|
27
|
+
|
|
28
|
+
## Review checklist (self)
|
|
29
|
+
|
|
30
|
+
- [ ] Behavior matches acceptance checks
|
|
31
|
+
- [ ] Errors surfaced with actionable messages
|
|
32
|
+
- [ ] New logic covered by tests or documented gap
|
|
33
|
+
- [ ] No new secrets or sensitive logs
|
|
34
|
+
- [ ] Docs updated when public behavior or architecture changed
|
|
35
|
+
|
|
36
|
+
## Commands (local)
|
|
37
|
+
|
|
38
|
+
| Step | Command |
|
|
39
|
+
|------|---------|
|
|
40
|
+
| Lint | `{{LINT_CMD}}` |
|
|
41
|
+
| Test | `{{TEST_CMD}}` |
|
|
42
|
+
| Build | `{{BUILD_CMD}}` |
|