|
| 1 | +--- |
| 2 | +name: feat |
| 3 | +description: Build a feature or enhancement end-to-end (GitHub issue or free-text description → plan → implement → test → PR). Use anytime you need to add functionality to a package in this workspace. |
| 4 | +argument-hint: [issue-number-or-description] |
| 5 | +--- |
| 6 | + |
| 7 | +# Feature Workflow |
| 8 | + |
| 9 | +Conventions this workflow depends on (read the ones your change touches before writing code): |
| 10 | + |
| 11 | +- [CorePlatformModules.md](./references/CorePlatformModules.md) — required before touching `packages/core` (platform-split files, handwritten `.d.ts`). |
| 12 | +- [CodeComments.md](./references/CodeComments.md) — comment rules for all TypeScript edits. |
| 13 | +- [WritingUnitTests.md](./references/WritingUnitTests.md) — test expectations and environment constraints. |
| 14 | +- [CONTRIBUTING.md](./references/CONTRIBUTING.md) — commit message format. |
| 15 | + |
| 16 | +## Phase 1: Understand |
| 17 | + |
| 18 | +- If given a GitHub issue number, fetch it: `gh issue view <number> --json title,body,labels,comments`. Otherwise treat the input as a free-text description; if empty, ask for one. |
| 19 | +- Summarize the user-facing goal, acceptance criteria, and edge cases before touching code. |
| 20 | + |
| 21 | +## Phase 2: Ground in the codebase |
| 22 | + |
| 23 | +- Find an existing module or feature similar to what you are building and use it as the pattern to follow — reference it by path in your plan. |
| 24 | +- Map the touch surface: which package, which modules, and for `packages/core` whether the change lands in `-common.ts`, both platform files, or all three — plus the neighboring `.d.ts`. |
| 25 | + |
| 26 | +## Phase 3: Plan |
| 27 | + |
| 28 | +Present a short plan before implementing: files to create/edit with a one-liner each, the test strategy, and any public API changes (these require `.d.ts` updates). Prefer the simplest solution that reuses existing patterns. |
| 29 | + |
| 30 | +## Phase 4: Implement |
| 31 | + |
| 32 | +- Follow the referenced conventions. Keep `.ios.ts` / `.android.ts` in parity; never leave one side diverged. |
| 33 | +- Public API changes update the neighboring `.d.ts` in the same change, with JSDoc in the `.d.ts`. |
| 34 | + |
| 35 | +## Phase 5: Test |
| 36 | + |
| 37 | +- Add or extend colocated `*.spec.ts` specs for shared-logic changes. |
| 38 | +- Run the focused tests first (`npx nx run core:test -t 'Name'`), then the full package target (`npx nx run core:test`) — it must be green. |
| 39 | +- Behavior that needs the real native runtime is covered in `apps/automated`, not unit tests; note it for the PR's manual test scenarios instead. |
| 40 | + |
| 41 | +## Phase 6: Finish |
| 42 | + |
| 43 | +- Format: `npx nx format:write`. |
| 44 | +- Commit with the conventional format, e.g. `feat(core): <subject>`. |
| 45 | +- Open the PR with `gh`, following [the PR template](../../../.github/PULL_REQUEST_TEMPLATE.md): reference the issue and include tests for the change. |
0 commit comments