@rasensio/aidlc 0.4.0 → 0.6.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.
Files changed (59) hide show
  1. package/LICENSE +21 -0
  2. package/dist/cli.js +0 -0
  3. package/dist/commands/continue.d.ts.map +1 -1
  4. package/dist/commands/continue.js +11 -15
  5. package/dist/commands/continue.js.map +1 -1
  6. package/dist/commands/docs.d.ts.map +1 -1
  7. package/dist/commands/docs.js +35 -42
  8. package/dist/commands/docs.js.map +1 -1
  9. package/dist/commands/gate.d.ts.map +1 -1
  10. package/dist/commands/gate.js +11 -15
  11. package/dist/commands/gate.js.map +1 -1
  12. package/dist/commands/init.d.ts.map +1 -1
  13. package/dist/commands/init.js +23 -35
  14. package/dist/commands/init.js.map +1 -1
  15. package/dist/commands/start.d.ts.map +1 -1
  16. package/dist/commands/start.js +14 -16
  17. package/dist/commands/start.js.map +1 -1
  18. package/dist/commands/status.d.ts.map +1 -1
  19. package/dist/commands/status.js +11 -15
  20. package/dist/commands/status.js.map +1 -1
  21. package/dist/commands/transition.d.ts.map +1 -1
  22. package/dist/commands/transition.js +11 -15
  23. package/dist/commands/transition.js.map +1 -1
  24. package/dist/commands/update.d.ts.map +1 -1
  25. package/dist/commands/update.js +30 -29
  26. package/dist/commands/update.js.map +1 -1
  27. package/package.json +14 -21
  28. package/README.md +0 -299
  29. package/capabilities/claude-code.yaml +0 -9
  30. package/capabilities/codex.yaml +0 -8
  31. package/capabilities/cursor.yaml +0 -8
  32. package/capabilities/kiro.yaml +0 -9
  33. package/capabilities/windsurf.yaml +0 -8
  34. package/ci/aidlc-gate.yml +0 -100
  35. package/examples/.gitkeep +0 -0
  36. package/guidance/accessibility.md +0 -67
  37. package/guidance/api-conventions.md +0 -124
  38. package/guidance/index.yaml +0 -7
  39. package/guidance/secure-defaults.md +0 -71
  40. package/phases/.gitkeep +0 -0
  41. package/skills/00-overview.md +0 -74
  42. package/skills/01-getting-started.md +0 -131
  43. package/skills/02-first-activation.md +0 -158
  44. package/skills/10-ideation.md +0 -45
  45. package/skills/20-requirements.md +0 -54
  46. package/skills/30-design.md +0 -57
  47. package/skills/40-implementation.md +0 -64
  48. package/skills/50-testing.md +0 -60
  49. package/skills/60-deployment.md +0 -63
  50. package/skills/70-maintenance.md +0 -56
  51. package/skills/80-review.md +0 -85
  52. package/skills/81-continue.md +0 -57
  53. package/skills/82-add-action.md +0 -71
  54. package/templates/.gitkeep +0 -0
  55. package/templates/bugfix.yaml +0 -14
  56. package/templates/full-feature.yaml +0 -44
  57. package/templates/micro-task.yaml +0 -11
  58. package/templates/quick-feature.yaml +0 -20
  59. package/templates/spike.yaml +0 -15
package/README.md DELETED
@@ -1,299 +0,0 @@
1
- # AIDLC — AI Development Lifecycle Framework
2
-
3
- Structured lifecycle guidance for AI coding agents across platforms. One set of skills, every major AI coding tool.
4
-
5
- ## Prerequisites
6
-
7
- ```bash
8
- # Verify Node.js >= 18
9
- node --version
10
- ```
11
-
12
- ```bash
13
- # Verify npm
14
- npm --version
15
- ```
16
-
17
- ## Quick Start
18
-
19
- ### Install and initialize
20
-
21
- ```bash
22
- # Install globally (or use npx without installing)
23
- npm install -g @rasensio/aidlc
24
- ```
25
-
26
- ```bash
27
- # platform: claude-code
28
- npx @rasensio/aidlc init --platform claude-code
29
- ```
30
-
31
- ```bash
32
- # platform: kiro
33
- npx @rasensio/aidlc init --platform kiro
34
- ```
35
-
36
- ```bash
37
- # platform: cursor
38
- npx @rasensio/aidlc init --platform cursor
39
- ```
40
-
41
- ```bash
42
- # platform: windsurf
43
- npx @rasensio/aidlc init --platform windsurf
44
- ```
45
-
46
- ```bash
47
- # platform: codex
48
- npx @rasensio/aidlc init --platform codex
49
- ```
50
-
51
- ### Start, check, and continue
52
-
53
- ```bash
54
- npx @rasensio/aidlc start
55
- npx @rasensio/aidlc status
56
- npx @rasensio/aidlc continue
57
- ```
58
-
59
- ### Verification
60
-
61
- ```bash
62
- npx @rasensio/aidlc status
63
- ```
64
-
65
- A successful run outputs lifecycle status and exits with code 0.
66
-
67
- ## Non-Interactive Setup
68
-
69
- The `aidlc setup` command supports fully non-interactive operation for AI agents. All wizard options are available as CLI flags:
70
-
71
- ```bash
72
- npx @rasensio/aidlc setup \
73
- --project-type existing \
74
- --complexity full \
75
- --actions git-branch \
76
- --platforms claude-code,kiro \
77
- --yes
78
- ```
79
-
80
- | Flag | Accepted Values | Description |
81
- |------|----------------|-------------|
82
- | `--project-type` | `new`, `existing` | Whether this is a new or existing project |
83
- | `--complexity` | `simple`, `full` | Simple = Micro-Task template; Full = Full Feature template |
84
- | `--actions` | `git-branch`, `github-issue`, `doc-update` (comma-separated) | Built-in lifecycle actions to enable |
85
- | `--platforms` | `claude-code`, `kiro`, `cursor`, `windsurf`, `codex` (comma-separated) | Target AI platforms to configure |
86
- | `--guidance` | `secure-defaults`, `accessibility`, `api-conventions` (comma-separated) | Guidance layers to install |
87
- | `--yes` | (flag, no value) | Skip all confirmation prompts |
88
-
89
- When `--yes` is provided, setup completes without interactive prompts or manual file editing.
90
-
91
- ## Post-Install: Discovery (Brownfield Projects)
92
-
93
- For existing codebases, run discovery to generate project context:
94
-
95
- ```bash
96
- npx @rasensio/aidlc discover
97
- ```
98
-
99
- This scans the codebase and generates context documents in `.aidlc/context/` covering coding style and architecture. AI agents reference these docs during all lifecycle phases.
100
-
101
- Non-interactive mode (overwrites existing docs without prompting):
102
-
103
- ```bash
104
- npx @rasensio/aidlc discover --yes
105
- ```
106
-
107
- Expected outputs: `.aidlc/context/style-guide.md` and `.aidlc/context/architecture.md`.
108
-
109
- ## Architecture
110
-
111
- ### Directory Layout
112
-
113
- ```
114
- aidlc/ # npm package
115
- ├── skills/ # Universal skill definitions (platform-agnostic)
116
- ├── capabilities/ # Per-platform capability maps (YAML)
117
- ├── templates/ # Built-in workflow templates
118
- ├── guidance/ # Built-in guidance layers
119
- ├── src/
120
- │ ├── cli.ts # CLI entry (commander wiring)
121
- │ ├── commands/ # One module per CLI verb
122
- │ ├── core/ # Lifecycle engine (pure functions)
123
- │ ├── state/ # State store, atomic writes, transition log
124
- │ ├── compile/ # Skill parser, adapters, install plans
125
- │ ├── discover/ # Codebase scanner
126
- │ ├── events/ # Event bus, action runner
127
- │ ├── orchestrator/ # Bare-endpoint orchestration
128
- │ └── setup/ # Setup wizard
129
- └── test/ # vitest + fast-check tests
130
- ```
131
-
132
- ### Key Modules
133
-
134
- | Module | Responsibility |
135
- |--------|---------------|
136
- | `core/lifecycle.ts` | Pure functions: `evaluateTransition`, `nextStep`, `completionPercent`, `isStalled` |
137
- | `core/gate.ts` | Phase gate evaluation with exit-code semantics |
138
- | `state/snapshot-store.ts` | Atomic state persistence (tmp + rename) |
139
- | `state/transition-log.ts` | Append-only NDJSON transition log |
140
- | `compile/adapters/` | Platform-specific install plan generators |
141
- | `compile/merger.ts` | Managed-block merge (preserves surrounding content) |
142
- | `events/event-bus.ts` | Lifecycle event dispatch, action/hook runner |
143
-
144
- ### Installed Project Layout
145
-
146
- After `aidlc init`, the target project gains:
147
-
148
- ```
149
- project/
150
- ├── .aidlc/
151
- │ ├── config.yaml # Project configuration (optional)
152
- │ ├── actions.yaml # Lifecycle event actions (opt-in)
153
- │ ├── skills/ # Canonical skill bodies
154
- │ ├── context/ # style-guide.md, architecture.md
155
- │ ├── guidance/ # Active guidance layers + index.yaml
156
- │ ├── templates/ # Custom workflow templates
157
- │ ├── plugins/ # Extensions
158
- │ └── state/<instance>/ # Per-instance lifecycle state
159
- └── (platform configs: .claude/ .kiro/ .cursor/ .windsurf/ AGENTS.md)
160
- ```
161
-
162
- ## Supported Platforms
163
-
164
- | Platform | Config Location | Strategy |
165
- |----------|----------------|----------|
166
- | Claude Code | `.claude/skills/aidlc-*/SKILL.md` | Thin activation shims pointing to `.aidlc/skills/` |
167
- | Kiro | `.kiro/skills/aidlc-*/SKILL.md` + steering | Activation shims + always-included steering file |
168
- | Cursor | `.cursor/rules/aidlc-*.mdc` | Agent-requested rules with description-based activation |
169
- | Windsurf | `.windsurf/rules/aidlc-*.md` | Size-constrained pointer shims (under 6K/file) |
170
- | Codex | `AGENTS.md` (managed block) | Managed delimiter block within existing AGENTS.md |
171
-
172
- Each adapter installs canonical skill bodies into `.aidlc/skills/` and generates native platform shims that reference them. Existing non-AIDLC configuration is preserved.
173
-
174
- ## Lifecycle Phases
175
-
176
- | Phase | Purpose |
177
- |-------|---------|
178
- | Ideation | Explore and validate ideas, identify alternatives |
179
- | Requirements | Define acceptance criteria, scope, and constraints |
180
- | Design | Produce architecture and technical design documents |
181
- | Implementation | Write code following established conventions |
182
- | Testing | Validate correctness and coverage |
183
- | Deployment | Release to target environment |
184
- | Maintenance | Monitor, patch, and evolve |
185
-
186
- Phase applicability depends on the cycle scope: Full (all phases), Standard (Requirements through Deployment), Micro (Implementation + Testing only).
187
-
188
- ## CLI Commands
189
-
190
- | Command | Purpose |
191
- |---------|---------|
192
- | `aidlc update` | Update CLI and refresh project skills |
193
- | `aidlc setup` | Interactive setup or update of project configuration |
194
- | `aidlc discover` | Scan codebase, generate style and architecture context |
195
- | `aidlc init --platform <id>` | Install skills for a target AI platform |
196
- | `aidlc start [template]` | Begin a new lifecycle instance |
197
- | `aidlc continue [instance]` | Resume the active lifecycle instance |
198
- | `aidlc status [--json]` | Show progress across active instances |
199
- | `aidlc review <artifact\|phase>` | Adversarial review of a lifecycle artifact |
200
- | `aidlc gate <phase>` | CI gate check (exit 0 = complete, exit 1 = incomplete) |
201
- | `aidlc transition <instance>` | Evaluate gates and advance to the next phase |
202
- | `aidlc add action "<description>"` | Create a lifecycle action from natural language |
203
- | `aidlc run [--endpoint <url>]` | Drive a bare LLM endpoint through the lifecycle |
204
-
205
- ### Dry-Run Mode
206
-
207
- Preview what `init` would write without changing files:
208
-
209
- ```bash
210
- npx @rasensio/aidlc init --platform claude-code --dry-run
211
- ```
212
-
213
- ## Configuration
214
-
215
- Project configuration lives in `.aidlc/config.yaml`:
216
-
217
- ```yaml
218
- version: 1
219
- defaults: { scope: micro, template: micro-task }
220
- stalled_threshold_days: 7
221
- claim_timeout_minutes: 60
222
- summary_threshold_bytes: 16384
223
- orchestrator: # optional, only for bare-endpoint mode
224
- endpoint: http://localhost:11434
225
- model: qwen2.5-coder
226
- api_format: ollama # ollama | openai
227
- auto_advance: false
228
- context_budget_tokens: 8000
229
- ```
230
-
231
- Without this file, AIDLC defaults to Micro scope (Implementation + Testing only).
232
-
233
- ## Changelog
234
-
235
- ### 0.4.0 (2026-08-11)
236
-
237
- **Features**
238
-
239
- - add monorepo, service, and other project type options
240
-
241
- ### 0.3.3 (2026-08-11)
242
-
243
- **Other**
244
-
245
- - add dry-run mode feedback message
246
-
247
- ### 0.3.2 (2026-08-11)
248
-
249
- **Other**
250
-
251
- - add /release automation (conventional commits + changelog)
252
-
253
- ### 0.3.1
254
-
255
- **Improved setup wizard UX**
256
-
257
- - Every interactive prompt now includes a descriptive message explaining what it controls and why it matters.
258
- - All options display contextual hints: project types explain the category, complexity shows which phases activate, platforms list the config file they generate, templates show the full phase flow, and scopes enumerate included phases.
259
- - First-time users can now make informed choices without consulting external docs.
260
-
261
- ### 0.3.0
262
-
263
- **First Activation (brownfield auto-discovery)**
264
-
265
- - New skill: `02-first-activation.md` — when AIDLC is installed in an existing project, the AI now automatically scans the codebase on first chat interaction. It detects languages, frameworks, conventions, and directory structure, then asks the user about extra context folders (specs, roadmap, design docs, etc.) before writing context docs to `.aidlc/context/`. No terminal round-trip needed after `aidlc init`.
266
-
267
- **`aidlc update` command**
268
-
269
- - Self-update: detects which package manager installed AIDLC (npm, pnpm, yarn, bun), checks the npm registry for a newer version, and updates the global CLI.
270
- - Project refresh: re-runs the install plan for each configured platform, updating skill shims and steering files to match the latest CLI version. Only files whose content changed are rewritten.
271
- - `--self-only` — update just the CLI, skip project files
272
- - `--project-only` — refresh project files from the currently installed CLI
273
- - `--rediscover` — also regenerate `.aidlc/context/` docs (skipped by default to preserve manual edits)
274
- - `--dry-run` — preview all changes without writing
275
-
276
- **Getting-started skill update**
277
-
278
- - The getting-started skill now defers to first-activation when `.aidlc/context/` doesn't exist yet, ensuring discovery runs before lifecycle guidance kicks in.
279
-
280
- ## Contributing
281
-
282
- ### Build and Test
283
-
284
- ```bash
285
- npm install
286
- npm run build
287
- npm test
288
- npm run lint
289
- ```
290
-
291
- Tests use vitest (unit + integration) and fast-check (property-based, 14 correctness properties, 100+ iterations each).
292
-
293
- ### Project Conventions
294
-
295
- - TypeScript, ES modules, Node >= 18
296
- - Pure-function core (no I/O) with I/O pushed to edges
297
- - Exact-pinned dependencies (no ranges)
298
- - Property-based tests for core logic, golden-file tests for adapter output
299
- - Deterministic state serialization (stable key order, block YAML style)
@@ -1,9 +0,0 @@
1
- platform: claude-code
2
- capabilities:
3
- plan-mode:
4
- phases: [ideation, requirements, design]
5
- activation: >-
6
- Before producing this phase's artifact, enter plan mode to reason through
7
- the problem space, identify constraints, and outline the approach before
8
- committing to a structure. Exit plan mode only when you begin writing the
9
- artifact.
@@ -1,8 +0,0 @@
1
- platform: codex
2
- capabilities:
3
- code-generation:
4
- phases: [implementation, testing]
5
- activation: >-
6
- Leverage Codex sandboxed execution for this phase. Write implementation
7
- code and tests together, using the sandbox to validate that tests pass
8
- before proposing the final changeset.
@@ -1,8 +0,0 @@
1
- platform: cursor
2
- capabilities:
3
- composer:
4
- phases: [design, implementation]
5
- activation: >-
6
- Use Cursor Composer for this phase to coordinate multi-file edits in a
7
- single operation. Frame the design or implementation as a Composer prompt
8
- describing the desired end state across all affected files.
@@ -1,9 +0,0 @@
1
- platform: kiro
2
- capabilities:
3
- spec-driven-development:
4
- phases: [requirements, design, implementation]
5
- activation: >-
6
- Use Kiro spec sessions for this phase. Keep spec documents under
7
- .kiro/specs/ and let the spec workflow drive requirements, design
8
- decisions, and task breakdown. Reference the active spec when producing
9
- artifacts so that traceability is maintained.
@@ -1,8 +0,0 @@
1
- platform: windsurf
2
- capabilities:
3
- cascade:
4
- phases: [implementation]
5
- activation: >-
6
- Use Windsurf Cascade flows for implementation steps that span multiple
7
- files. Keep individual instructions concise due to context-size
8
- constraints; reference .aidlc/skills/ for full phase guidance when needed.
package/ci/aidlc-gate.yml DELETED
@@ -1,100 +0,0 @@
1
- # =============================================================================
2
- # AIDLC Gate Check — GitHub Actions Workflow (sample/reference)
3
- # =============================================================================
4
- #
5
- # This is a SAMPLE workflow demonstrating how to integrate `aidlc gate` into a
6
- # CI/CD pipeline. Customize it for your project's branching strategy, instance
7
- # naming, and phase requirements.
8
- #
9
- # Exit code semantics:
10
- # 0 = phase is complete (gate passes, deployment may proceed)
11
- # 1 = phase is incomplete (gate fails, deployment blocked)
12
- #
13
- # The --json flag outputs a structured GateCheckResult object:
14
- # { pass, phase, missingArtifacts, unsatisfiedCriteria }
15
- #
16
- # Requirements: 9.5
17
- # =============================================================================
18
-
19
- name: AIDLC Gate Check
20
-
21
- on:
22
- pull_request:
23
- branches: [main]
24
-
25
- # ---------------------------------------------------------------------------
26
- # Customization points:
27
- #
28
- # 1. AIDLC_INSTANCE — how you derive the lifecycle instance name.
29
- # Below we use the PR title, but you could use branch name, a label, etc.
30
- #
31
- # 2. AIDLC_PHASE — which phase must be complete before merging.
32
- # Common choices: "testing" (pre-merge), "deployment" (pre-deploy).
33
- #
34
- # 3. Node version — must be >= 18 (AIDLC prerequisite).
35
- # ---------------------------------------------------------------------------
36
-
37
- jobs:
38
- gate:
39
- runs-on: ubuntu-latest
40
- steps:
41
- - uses: actions/checkout@v4
42
-
43
- - uses: actions/setup-node@v4
44
- with:
45
- node-version: '20'
46
-
47
- - run: npm ci
48
-
49
- # -----------------------------------------------------------------------
50
- # Run the gate check.
51
- # Exit code 0 means the phase is complete; exit code 1 means it is not.
52
- # The --json flag produces structured output for downstream steps.
53
- # -----------------------------------------------------------------------
54
- - name: Check lifecycle gate
55
- id: gate
56
- run: |
57
- set +e
58
- OUTPUT=$(npx aidlc gate "$AIDLC_INSTANCE" "$AIDLC_PHASE" --json)
59
- EXIT_CODE=$?
60
- echo "$OUTPUT"
61
- echo "result<<EOF" >> "$GITHUB_OUTPUT"
62
- echo "$OUTPUT" >> "$GITHUB_OUTPUT"
63
- echo "EOF" >> "$GITHUB_OUTPUT"
64
- echo "exit_code=$EXIT_CODE" >> "$GITHUB_OUTPUT"
65
- exit $EXIT_CODE
66
- env:
67
- AIDLC_INSTANCE: ${{ github.event.pull_request.title }}
68
- AIDLC_PHASE: implementation
69
-
70
- # -----------------------------------------------------------------------
71
- # Optional: post gate results as a PR comment.
72
- # Requires the `pull-requests: write` permission on the workflow.
73
- # Uncomment and adapt as needed.
74
- # -----------------------------------------------------------------------
75
- # - name: Comment gate results on PR
76
- # if: always()
77
- # uses: actions/github-script@v7
78
- # with:
79
- # script: |
80
- # const result = JSON.parse(`${{ steps.gate.outputs.result }}`);
81
- # let body;
82
- # if (result.pass) {
83
- # body = `### ✓ AIDLC Gate Passed\n\nPhase **${result.phase}** is complete.`;
84
- # } else {
85
- # const missing = result.missingArtifacts.map(a => `- ${a}`).join('\n');
86
- # const criteria = result.unsatisfiedCriteria.map(c => `- ${c}`).join('\n');
87
- # body = [
88
- # `### ✗ AIDLC Gate Failed`,
89
- # ``,
90
- # `Phase **${result.phase}** is not complete.`,
91
- # missing ? `\n**Missing artifacts:**\n${missing}` : '',
92
- # criteria ? `\n**Unsatisfied criteria:**\n${criteria}` : '',
93
- # ].filter(Boolean).join('\n');
94
- # }
95
- # await github.rest.issues.createComment({
96
- # owner: context.repo.owner,
97
- # repo: context.repo.repo,
98
- # issue_number: context.issue.number,
99
- # body,
100
- # });
package/examples/.gitkeep DELETED
File without changes
@@ -1,67 +0,0 @@
1
- ---
2
- name: accessibility
3
- description: Web accessibility guidelines and inclusive design
4
- ---
5
- # Accessibility
6
-
7
- Follow these accessibility rules when building user interfaces. All interactive content must be usable by people with diverse abilities, including those using assistive technologies.
8
-
9
- ## Semantic HTML
10
-
11
- - Use semantic elements (`<nav>`, `<main>`, `<article>`, `<section>`, `<header>`, `<footer>`) for page structure.
12
- - Use heading elements (`<h1>`–`<h6>`) in logical hierarchy; never skip levels for styling.
13
- - Use `<button>` for actions and `<a>` for navigation; never use `<div>` or `<span>` as interactive elements without proper roles.
14
- - Use `<label>` elements explicitly associated with form inputs via `for`/`id` pairing.
15
- - Use lists (`<ul>`, `<ol>`, `<dl>`) for grouped items rather than styled `<div>` sequences.
16
-
17
- ## ARIA Usage
18
-
19
- - Prefer native HTML semantics over ARIA; add ARIA only when no native element provides the required semantics.
20
- - Use `aria-label` or `aria-labelledby` for interactive elements that lack visible text labels.
21
- - Set `aria-expanded`, `aria-selected`, `aria-checked` states dynamically to reflect current UI state.
22
- - Apply `role="alert"` or `aria-live="polite"` for dynamic content that must be announced to screen readers.
23
- - Never use `aria-hidden="true"` on focusable elements.
24
-
25
- ## Keyboard Navigation
26
-
27
- - All interactive elements must be reachable and operable via keyboard alone (Tab, Shift+Tab, Enter, Space, Arrow keys).
28
- - Maintain a logical tab order that follows the visual reading flow; avoid positive `tabindex` values.
29
- - Provide visible focus indicators on all focusable elements; never remove outline without a visible replacement.
30
- - Implement keyboard shortcuts for complex widgets (modals, dropdowns, tabs) per WAI-ARIA Authoring Practices.
31
- - Trap focus inside modal dialogs until dismissed; restore focus to the triggering element on close.
32
-
33
- ## Color and Contrast
34
-
35
- - Maintain a minimum contrast ratio of 4.5:1 for normal text and 3:1 for large text (WCAG AA).
36
- - Never use color as the sole means of conveying information; pair color with text, icons, or patterns.
37
- - Verify contrast in both light and dark modes if the application supports theme switching.
38
- - Ensure focus indicators have at least 3:1 contrast against adjacent colors.
39
-
40
- ## Images and Media
41
-
42
- - Provide meaningful `alt` text for informative images; use `alt=""` for decorative images.
43
- - Provide captions or transcripts for video and audio content.
44
- - Avoid auto-playing media; if unavoidable, provide an immediate mechanism to pause or stop.
45
- - Ensure animated content can be paused and does not flash more than 3 times per second.
46
-
47
- ## Forms and Errors
48
-
49
- - Associate error messages with their input fields using `aria-describedby` or `aria-errormessage`.
50
- - Display error summaries at the top of forms with links to the offending fields.
51
- - Do not rely solely on placeholder text as a label; placeholders disappear on input.
52
- - Group related form controls with `<fieldset>` and `<legend>`.
53
- - Provide clear instructions before the form and inline help where input format is constrained.
54
-
55
- ## Responsive and Adaptive Design
56
-
57
- - Support zoom up to 200% without loss of content or functionality.
58
- - Use relative units (rem, em, %) for text and spacing rather than fixed pixels.
59
- - Ensure touch targets are at least 44x44 CSS pixels for mobile interfaces.
60
- - Test layouts with different text sizes, languages, and reading directions (LTR/RTL).
61
-
62
- ## Testing and Verification
63
-
64
- - Run automated accessibility scans (axe-core, Lighthouse) in CI and fix all critical/serious issues.
65
- - Test with at least one screen reader (VoiceOver, NVDA, or JAWS) for major user flows.
66
- - Validate keyboard-only navigation for all primary workflows.
67
- - Note: full WCAG conformance requires manual testing with assistive technologies and expert review.
@@ -1,124 +0,0 @@
1
- ---
2
- name: api-conventions
3
- description: REST API naming, error format, and versioning conventions
4
- ---
5
- # API Conventions
6
-
7
- Follow these conventions when designing, implementing, or reviewing REST APIs. Consistency across endpoints reduces integration friction and simplifies documentation.
8
-
9
- ## URL Structure and Naming
10
-
11
- - Use lowercase, hyphen-separated path segments: `/user-profiles`, not `/userProfiles` or `/user_profiles`.
12
- - Use plural nouns for resource collections: `/orders`, `/products`, `/users`.
13
- - Use resource identifiers as path segments: `/users/{userId}/orders/{orderId}`.
14
- - Limit nesting to two levels; deeper relationships should use query parameters or links.
15
- - Use query parameters for filtering, sorting, and pagination: `?status=active&sort=-created_at&page=2`.
16
- - Avoid verbs in URLs; let HTTP methods convey the action.
17
-
18
- ## HTTP Methods
19
-
20
- - `GET` — Retrieve a resource or collection. Must be safe and idempotent. Never mutate state.
21
- - `POST` — Create a new resource or trigger a non-idempotent action. Return 201 with Location header for creates.
22
- - `PUT` — Replace an entire resource. Must be idempotent. Return 200 or 204.
23
- - `PATCH` — Partially update a resource. Use JSON Merge Patch or JSON Patch content types. Return 200.
24
- - `DELETE` — Remove a resource. Must be idempotent. Return 204 on success, 404 if already absent.
25
- - `OPTIONS` — Return allowed methods and CORS headers. Used for preflight requests.
26
-
27
- ## Status Codes
28
-
29
- Use the most specific applicable status code:
30
-
31
- | Range | Use for |
32
- |-------|---------|
33
- | 200 | Successful retrieval or update |
34
- | 201 | Resource created (include Location header) |
35
- | 204 | Success with no response body |
36
- | 400 | Malformed request (syntax or validation errors) |
37
- | 401 | Missing or invalid authentication credentials |
38
- | 403 | Authenticated but insufficient permissions |
39
- | 404 | Resource not found |
40
- | 409 | Conflict (e.g., duplicate key, version mismatch) |
41
- | 422 | Semantically invalid request (valid syntax but business rule violation) |
42
- | 429 | Rate limit exceeded (include Retry-After header) |
43
- | 500 | Unexpected server error (never expose internals) |
44
-
45
- ## Error Response Format
46
-
47
- Return a consistent JSON error body for all 4xx and 5xx responses:
48
-
49
- ```json
50
- {
51
- "error": {
52
- "code": "VALIDATION_FAILED",
53
- "message": "Human-readable summary of the problem",
54
- "details": [
55
- {
56
- "field": "email",
57
- "issue": "Must be a valid email address"
58
- }
59
- ],
60
- "request_id": "req_abc123"
61
- }
62
- }
63
- ```
64
-
65
- - `code` — Machine-readable error identifier (UPPER_SNAKE_CASE).
66
- - `message` — Brief, user-safe description. Never include stack traces or internal paths.
67
- - `details` — Optional array of field-level errors for validation failures.
68
- - `request_id` — Correlation identifier for debugging (matches server-side logs).
69
-
70
- ## Pagination
71
-
72
- - Use cursor-based pagination for large or frequently-changing collections.
73
- - Support limit/offset as a simpler alternative for smaller, stable datasets.
74
- - Return pagination metadata in the response body:
75
-
76
- ```json
77
- {
78
- "data": [...],
79
- "pagination": {
80
- "next_cursor": "eyJpZCI6MTAwfQ",
81
- "has_more": true,
82
- "total_count": 2340
83
- }
84
- }
85
- ```
86
-
87
- - Include `total_count` only when it can be computed efficiently.
88
-
89
- ## Versioning
90
-
91
- - Use URL prefix versioning for major breaking changes: `/v1/users`, `/v2/users`.
92
- - Increment the version number only on backward-incompatible changes.
93
- - Support the previous major version for at least 6 months after a new version ships.
94
- - Treat additive changes (new optional fields, new endpoints) as backward-compatible.
95
- - Document deprecation timelines in the Sunset response header and changelog.
96
-
97
- ## Request and Response Conventions
98
-
99
- - Use `snake_case` for JSON field names throughout request and response bodies.
100
- - Represent timestamps in ISO 8601 format with UTC timezone: `2025-06-15T10:30:00Z`.
101
- - Use envelope format for collections: `{ "data": [...], "pagination": {...} }`.
102
- - Return the full created or updated resource in response to POST, PUT, and PATCH.
103
- - Accept and return `Content-Type: application/json` by default.
104
- - Support `Accept` header negotiation where multiple formats are available.
105
-
106
- ## Rate Limiting and Throttling
107
-
108
- - Enforce rate limits per client or API key.
109
- - Return `429 Too Many Requests` with a `Retry-After` header (seconds until next allowed request).
110
- - Include rate limit headers on every response: `X-RateLimit-Limit`, `X-RateLimit-Remaining`, `X-RateLimit-Reset`.
111
-
112
- ## CORS and Security Headers
113
-
114
- - Configure CORS to allow only trusted origins; avoid wildcard `*` in production.
115
- - Return appropriate CORS headers: `Access-Control-Allow-Origin`, `Access-Control-Allow-Methods`, `Access-Control-Allow-Headers`.
116
- - Set `Cache-Control: no-store` on responses containing sensitive data.
117
- - Include `X-Content-Type-Options: nosniff` and `X-Request-Id` on all responses.
118
-
119
- ## Documentation and Discoverability
120
-
121
- - Provide an OpenAPI 3.x specification for every public API.
122
- - Include request/response examples for each endpoint.
123
- - Document authentication requirements, rate limits, and error codes.
124
- - Use consistent terminology across endpoint descriptions.
@@ -1,7 +0,0 @@
1
- layers:
2
- - name: secure-defaults
3
- file: secure-defaults.md
4
- - name: accessibility
5
- file: accessibility.md
6
- - name: api-conventions
7
- file: api-conventions.md