hero-mmt-kit 1.1.6 → 1.3.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/CHANGELOG.md +33 -0
- package/README.md +19 -13
- package/package.json +2 -2
- package/skills.manifest.json +8 -9
- package/src/integrations.cjs +9 -7
- package/src/skills.cjs +17 -6
- package/templates/CLAUDE.md.tmpl +30 -42
- package/templates/skills/NOTICE +26 -8
- package/templates/skills/brainstorming/SKILL.md +9 -9
- package/templates/skills/executing-plans/SKILL.md +1 -1
- package/templates/skills/hero-coding/SKILL.md +148 -69
- package/templates/skills/hero-gitflow/SKILL.md +61 -0
- package/templates/skills/hero-mr-review/SKILL.md +3 -3
- package/templates/skills/hero-node/SKILL.md +177 -0
- package/templates/skills/hero-planning/SKILL.md +281 -59
- package/templates/skills/hero-report/SKILL.md +5 -2
- package/templates/skills/hero-reviewing/SKILL.md +322 -69
- package/templates/skills/hero-strict/SKILL.md +4 -4
- package/templates/skills/hero-unit-test/SKILL.md +128 -78
- package/templates/skills/subagent-driven-development/SKILL.md +22 -9
- package/templates/skills/subagent-driven-development/code-quality-reviewer-prompt.md +34 -34
- package/templates/skills/subagent-driven-development/implementer-prompt.md +4 -5
- package/templates/skills/subagent-driven-development/scripts/sdd-workspace.sh +9 -10
- package/templates/skills/subagent-driven-development/scripts/task-brief.sh +1 -1
- package/templates/skills/using-git-worktrees/SKILL.md +7 -5
- package/templates/skills/using-hero/SKILL.md +27 -19
- package/templates/skills/receiving-code-review/SKILL.md +0 -213
- package/templates/skills/requesting-code-review/SKILL.md +0 -108
- package/templates/skills/requesting-code-review/code-reviewer.md +0 -168
- package/templates/skills/writing-plans/SKILL.md +0 -173
- package/templates/skills/writing-plans/plan-document-reviewer-prompt.md +0 -49
|
@@ -1,69 +1,148 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: hero-coding
|
|
3
|
-
description: Use
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Hero Coding
|
|
7
|
-
|
|
8
|
-
## Overview
|
|
9
|
-
|
|
10
|
-
hero-coding is the implementation stage
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
1.
|
|
30
|
-
2.
|
|
31
|
-
3. For
|
|
32
|
-
4.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
1
|
+
---
|
|
2
|
+
name: hero-coding
|
|
3
|
+
description: Use to implement an approved hero-planning plan, a small bounded change, or exact user-approved corrections from a prior hero-reviewing pass
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Hero Coding
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
hero-coding is the implementation-only stage. It turns an approved plan, a small bounded request, or exact user-approved corrections from a prior independent review into production changes while accounting for every requirement, business rule, edge case, interface, and implementation step. It answers: "What was implemented, what remains blocked, and where did the implementation deviate from the approved scope?"
|
|
11
|
+
|
|
12
|
+
<HARD-BOUNDARY>
|
|
13
|
+
This stage implements only. It does not author or run tests, run verification commands, review its own output, evaluate or select review feedback, deploy, release, or perform git delivery actions. It may implement exact correction IDs only after `hero-reviewing` confirmed them and the user explicitly approved them. All assurance and delivery activities remain independent later sessions.
|
|
14
|
+
</HARD-BOUNDARY>
|
|
15
|
+
|
|
16
|
+
## When to Use
|
|
17
|
+
|
|
18
|
+
Use this skill when:
|
|
19
|
+
- `hero-planning` produced an approved plan and the user explicitly started implementation.
|
|
20
|
+
- A Tiny/Fast change is sufficiently bounded that a plan artifact would add no useful clarity.
|
|
21
|
+
- `hero-reviewing` produced confirmed correction IDs and the user explicitly approved the exact IDs to implement.
|
|
22
|
+
|
|
23
|
+
Do not silently choose a plan or correction set. Prefer `PLAN_PATH=<approved-plan-path>` for non-trivial planned work. For review remediation, require a review handoff/report plus `APPROVED_CORRECTIONS=<exact IDs>`. If multiple plausible sources exist, or approval is not explicit, ask which contract is approved.
|
|
24
|
+
|
|
25
|
+
## Inputs
|
|
26
|
+
|
|
27
|
+
Read implementation context before editing:
|
|
28
|
+
|
|
29
|
+
1. `PLAN_PATH`, when supplied. Read the complete plan, not selected excerpts.
|
|
30
|
+
2. Otherwise, the user's explicit bounded request and acceptance criteria.
|
|
31
|
+
3. For review remediation, the captured `hero-reviewing` result or report and `APPROVED_CORRECTIONS=<exact IDs>`.
|
|
32
|
+
4. The current codebase state relevant to the requested implementation.
|
|
33
|
+
|
|
34
|
+
A review correction is eligible only when:
|
|
35
|
+
- A prior independent `hero-reviewing` pass classified the item `confirmed`.
|
|
36
|
+
- The user explicitly approved that exact `RV-*` or `FB-*` ID.
|
|
37
|
+
- The handoff identifies the reviewed target, required outcome, constraints, and excluded items.
|
|
38
|
+
- The current implementation has not drifted so far that the correction is unsafe or ambiguous.
|
|
39
|
+
|
|
40
|
+
Do not reassess findings, choose additional items, infer approval from severity, or implement rejected, unclear, out-of-scope, or unapproved feedback. If target drift changes the meaning of a correction, stop and request clarification or another review.
|
|
41
|
+
|
|
42
|
+
For a current `hero-planning` plan, extract and reconcile:
|
|
43
|
+
- Requirement IDs from the requirement ledger.
|
|
44
|
+
- `## Change Map` entries.
|
|
45
|
+
- `## Task Dependencies`.
|
|
46
|
+
- Every `### Task N:` section.
|
|
47
|
+
- Each task's `Requirements`, `Depends on`, `Outcome`, `Files / areas`, `Implementation steps`, `Business rules and edge cases`, `Interfaces produced or changed`, and `Completion state`.
|
|
48
|
+
- The `## Requirements Coverage` mapping.
|
|
49
|
+
|
|
50
|
+
For a legacy plan without requirement IDs, derive a session-only checklist from its tasks and acceptance criteria. Do not rewrite or upgrade the approved plan automatically.
|
|
51
|
+
|
|
52
|
+
For a review correction handoff, map each approved correction ID to one bounded task and requirement entry. Preserve its required outcome and constraints verbatim; do not merge in unapproved reviewer suggestions or reinterpret the finding as broader refactoring work.
|
|
53
|
+
|
|
54
|
+
## Implementation Ledger
|
|
55
|
+
|
|
56
|
+
Maintain two linked views throughout the session:
|
|
57
|
+
|
|
58
|
+
### Task state
|
|
59
|
+
|
|
60
|
+
Use `pending`, `in progress`, `implemented`, or `blocked` for every planned task.
|
|
61
|
+
|
|
62
|
+
A task becomes `implemented` only when:
|
|
63
|
+
- Every listed implementation step has a corresponding change.
|
|
64
|
+
- Its business rules and edge cases are represented in the implementation.
|
|
65
|
+
- Its interfaces and completion state now exist as specified.
|
|
66
|
+
- Any approved deviation is recorded explicitly.
|
|
67
|
+
|
|
68
|
+
Respect `Depends on`. Do not start a dependent task before its prerequisite implementation state exists.
|
|
69
|
+
|
|
70
|
+
### Requirement state
|
|
71
|
+
|
|
72
|
+
For every requirement, record:
|
|
73
|
+
- Owning task or tasks.
|
|
74
|
+
- `pending`, `in progress`, `implemented`, or `blocked`.
|
|
75
|
+
- Changed files, symbols, interfaces, or configuration areas.
|
|
76
|
+
- Any approved deviation or unresolved blocker.
|
|
77
|
+
|
|
78
|
+
A touched file is not proof that a requirement is implemented. A requirement is implemented only when all of its owning tasks and business rules are accounted for.
|
|
79
|
+
|
|
80
|
+
Use the session task list for execution progress. Keep the approved plan immutable; its checkboxes describe scope and are not a mutable execution log.
|
|
81
|
+
|
|
82
|
+
## Process
|
|
83
|
+
|
|
84
|
+
1. Read and inventory the complete plan, bounded request, or approved correction handoff.
|
|
85
|
+
2. For correction work, validate the prior assessment, exact approved IDs, reviewed target identity, required outcomes, and constraints without re-reviewing their technical merit.
|
|
86
|
+
3. Build the task and requirement ledgers before editing.
|
|
87
|
+
4. Confirm dependencies and start the first unblocked implementation task or correction ID.
|
|
88
|
+
5. Implement one coherent task at a time. Keep only one writing agent active in a shared worktree; parallel agents may perform read-only exploration when useful.
|
|
89
|
+
6. After each task, reconcile every implementation step, business rule, edge case, interface, requirement, or approved correction it owns. Mark incomplete items `blocked` or `pending`, never optimistically complete.
|
|
90
|
+
7. Stop and ask the user when:
|
|
91
|
+
- A requirement, correction outcome, or business rule is ambiguous.
|
|
92
|
+
- Safe implementation requires behavior outside the approved scope.
|
|
93
|
+
- The plan or correction handoff conflicts with the current codebase.
|
|
94
|
+
- Target drift changes the meaning of an approved correction.
|
|
95
|
+
- An external dependency or prerequisite is missing.
|
|
96
|
+
8. Finish with a concise implementation summary and an explicit handoff to independent testing/review sessions.
|
|
97
|
+
|
|
98
|
+
This reconciliation checks whether the requested implementation work was performed. It is not a correctness review and must not be presented as one.
|
|
99
|
+
|
|
100
|
+
## Implementation-Only Boundary
|
|
101
|
+
|
|
102
|
+
During this stage, do not:
|
|
103
|
+
- Create, edit, or run unit, integration, snapshot, end-to-end, or reproduction tests.
|
|
104
|
+
- Run build, lint, typecheck, test, coverage, smoke-test, or other verification commands.
|
|
105
|
+
- Perform self-review, dispatch a code reviewer, evaluate feedback, or implement any review item that lacks both a prior `confirmed` classification and explicit user approval of its exact ID.
|
|
106
|
+
- Deploy, release, merge, commit, push, or open a pull/merge request.
|
|
107
|
+
- Invoke a generic skill whose mandatory lifecycle performs any excluded activity above.
|
|
108
|
+
|
|
109
|
+
If an unexpected defect cannot be resolved safely from the approved requirements and code context, record it as a blocker and stop. Do not create a temporary test or broaden the session into debugging/verification work.
|
|
110
|
+
|
|
111
|
+
## Report Convention (on request)
|
|
112
|
+
|
|
113
|
+
hero-coding does not write a report file automatically. If the user asks for a written report, invoke `hero-report`; it writes `docs/coding-reports/YYYY-MM-DD-<slug>.md` using this contract.
|
|
114
|
+
|
|
115
|
+
Report should cover:
|
|
116
|
+
- Plan path, bounded request, or review correction source used.
|
|
117
|
+
- Exact approved correction IDs, when applicable.
|
|
118
|
+
- Requirement states and their owning tasks.
|
|
119
|
+
- Task states, including blockers and explicit deferrals.
|
|
120
|
+
- Changed files, symbols, interfaces, schemas, configuration keys, and behavior.
|
|
121
|
+
- Approved deviations and why they were necessary.
|
|
122
|
+
- Confirmation that testing, verification, and independent review were not performed in this stage; for correction work, this means no independent re-review occurred after the fix.
|
|
123
|
+
|
|
124
|
+
Report style:
|
|
125
|
+
- Keep it tight: no narrative scaffolding or self-congratulatory claims.
|
|
126
|
+
- Preserve exact file paths, symbol names, API names, configuration keys, errors, and requirement/task IDs.
|
|
127
|
+
- Use concise bullets for task state, requirement coverage, changes, deviations, and blockers.
|
|
128
|
+
- Do not add commands or test evidence that this stage did not collect.
|
|
129
|
+
|
|
130
|
+
## Definition of Done
|
|
131
|
+
|
|
132
|
+
- Every planned task, requirement, or approved correction ID is `implemented`, `blocked`, or explicitly deferred with the user's approval.
|
|
133
|
+
- Dependencies, business rules, edge cases, interfaces, correction constraints, and completion states are accounted for.
|
|
134
|
+
- No unapproved scope expansion or review item is hidden inside the implementation.
|
|
135
|
+
- The chat summary states what changed and what later testing or independent re-review still needs to establish.
|
|
136
|
+
- If a report was requested, it was written separately via `hero-report`.
|
|
137
|
+
|
|
138
|
+
## ACTIVE_STATE.md Update
|
|
139
|
+
|
|
140
|
+
Use `docs/ACTIVE_STATE.md` only as a durable index when a tracked work item needs a current implementation task, status, or blocker recorded for handoff. Do not copy the implementation ledger into it, and do not treat an ACTIVE_STATE update as correctness evidence.
|
|
141
|
+
|
|
142
|
+
## Related Skills
|
|
143
|
+
|
|
144
|
+
- `hero-node` specializes this same implementation-only contract for Node.js JavaScript/TypeScript; it adds explicit coding conventions, not a new stage.
|
|
145
|
+
- Reads the approved implementation contract from `hero-planning`, or exact user-approved correction IDs from a prior `hero-reviewing` handoff.
|
|
146
|
+
- Never decides whether review feedback is valid; `hero-reviewing` owns that assessment.
|
|
147
|
+
- Hands the resulting implementation to separately invoked `hero-unit-test`, `hero-reviewing`, and, when appropriate, `hero-security` or `hero-strict` sessions.
|
|
148
|
+
- Uses `hero-report` only when the user asks for a durable coding report.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: hero-gitflow
|
|
3
|
+
description: Use when the user explicitly requests Git branch creation or delivery operations — checks protected branches, preserves .gitignore, and follows ticket-based branch and commit conventions without automating the next step
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Hero Gitflow
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
A standalone, human-led Git workflow. Use it only for a Git action the user has specifically requested; installing this skill does not authorize branch creation, commit, push, merge, revert, or rebase. Completing one action never authorizes another. It does not run automatically after `hero-coding`, testing, or review, and it does not replace the repository's Git hooks.
|
|
11
|
+
|
|
12
|
+
## When to Use
|
|
13
|
+
|
|
14
|
+
Use when the user asks to create a branch, commit changes, push a branch, merge, revert, or rebase. For a read-only review of a teammate's committed MR, use `hero-mr-review` instead. If the request only asks for implementation, testing, or review, do not perform Git delivery.
|
|
15
|
+
|
|
16
|
+
## Inputs
|
|
17
|
+
|
|
18
|
+
- The exact Git action requested; for push/merge/rebase/revert, the user must name that action specifically. Do not treat "finish", "ship", or approval of a previous step as permission for a different action.
|
|
19
|
+
- For a new branch: its type (`feature`, `fix`, or `hotfix`), a short description, any ticket code supplied by the user, and the intended base if more than one eligible base exists. Never invent a ticket code.
|
|
20
|
+
- For merge/rebase/push: the source and destination refs or remote. Ask when the destination cannot be established safely.
|
|
21
|
+
- For a commit: which changes are in scope. Ask before including unrelated changes.
|
|
22
|
+
|
|
23
|
+
## Process
|
|
24
|
+
|
|
25
|
+
1. **Read-only preflight.** Check `git status --short`, `git branch --show-current`, the relevant source/destination refs, and `git diff --cached --name-only` before changing Git state. Check both staged and unstaged changes, including `.gitignore`; inspection is allowed, modification is not. Confirm the requested operation and where its result will land. If the working tree is dirty and a checkout or worktree operation may carry or disturb local changes (especially `.gitignore`), stop and ask rather than moving, stashing, or cleaning them.
|
|
26
|
+
2. **Enforce protected destinations.** `develop`, `release/*`, `main`, and `master` are protected branches. Never commit while on them, or push, merge, rebase, or revert *into* them, even if requested. This applies to local and remote destinations (including refspecs). Explain the block and ask for a permitted destination; do not silently switch branches. Creating a new branch *from* an eligible protected base is allowed only when branch creation was requested.
|
|
27
|
+
3. **Create a branch only on request.** `feature/*` and `fix/*` must start from `develop` or `release/*`; `hotfix/*` must start from `main` or `master`. If the required base is absent or multiple bases are plausible, ask instead of guessing or fetching/switching implicitly. Keep a supplied ticket code and a short kebab-case description in the name, e.g. `feature/BU-1740-short-description` or `fix/CI-1545-short-description`. Without a ticket, use `feature/short-description` or `fix/short-description`; do not fabricate one. Check the proposed branch name and base before creating it.
|
|
28
|
+
4. **Commit only on an eligible branch and on request.** Never touch `.gitignore`: do not edit, stage, unstage, restore, stash, clean, or include it in a commit, even when it has local unstaged changes. If it is already staged, stop and ask the user to handle it; do not alter the index entry yourself. Stage only explicitly approved paths (never `git add .`, `git add -A`, or `git commit -a`). Inspect `git diff --cached --name-only` and `git diff --cached` before committing; stop if `.gitignore` or changes outside the approved scope are staged. Write an English message with a short descriptive title, prefixed by the ticket code when supplied, followed by detailed bullet points. Example:
|
|
29
|
+
|
|
30
|
+
```text
|
|
31
|
+
BU-1740: Add account search filters
|
|
32
|
+
|
|
33
|
+
- Add filters for account status and owner.
|
|
34
|
+
- Keep existing search results unchanged when no filter is selected.
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Do not add an agent/actor signature, `Signed-off-by`, `Co-Authored-By`, or generated-by trailer, and do not set an agent identity as the author. Use the human-configured Git identity; if it is missing or points to an agent, pause for the user to configure it. Do not bypass hooks.
|
|
38
|
+
5. **Other operations require their own explicit request.** Push only to a permitted destination; inspect the remote and refspec first. Merge, rebase, or revert only onto a permitted branch and only for the exact refs/commits the user requested. Never chain these operations after a commit or branch creation. Do not force-push or use destructive reset/cleanup as a workaround. If a conflict involves incompatible logic between branches and the right behavior cannot be determined from the requirements, stop, describe the alternatives, and ask the user before resolving it. Preserve unresolved work without guessing.
|
|
39
|
+
6. **Report the result.** State the action actually taken, source/destination or commit identifier when available, any untouched `.gitignore` changes, and any blocked or pending action. Never imply that a commit was pushed or merged when it was not.
|
|
40
|
+
|
|
41
|
+
## Output Style
|
|
42
|
+
|
|
43
|
+
- Lead with the action and result, then the branch/commit evidence and any next decision.
|
|
44
|
+
- Preserve exact branch names, ticket codes, file paths, commands, and error strings.
|
|
45
|
+
- Explain protected-branch blocks and ambiguous conflicts clearly; do not present a guess as a resolution.
|
|
46
|
+
|
|
47
|
+
## Definition of Done
|
|
48
|
+
|
|
49
|
+
- The action was specifically requested and passed the preflight and protected-destination checks.
|
|
50
|
+
- `.gitignore` was not modified, staged, unstaged, restored, or committed by this workflow; no unrelated changes were included.
|
|
51
|
+
- Any commit uses the English title-and-bullets format, with the supplied ticket prefix if present and no agent/actor signature.
|
|
52
|
+
- Logical conflicts that cannot be decided from the requirements were left for the user to decide.
|
|
53
|
+
- The actual outcome and remaining manual decisions were reported without implying a later Git action happened.
|
|
54
|
+
|
|
55
|
+
## ACTIVE_STATE.md Update
|
|
56
|
+
|
|
57
|
+
Do not create or rewrite workflow artifacts just to record a Git action. If an existing Active Features row needs its branch reference or status updated and the user requested that state update, follow the `docs/ACTIVE_STATE.md` convention without changing unrelated rows.
|
|
58
|
+
|
|
59
|
+
## Related Skills
|
|
60
|
+
|
|
61
|
+
`using-hero` routes to this skill for a user-requested Git action. `hero-coding`, `hero-unit-test`, and review skills keep their separate boundaries and do not invoke Git delivery automatically. Generic vendored skills such as `using-git-worktrees`, `brainstorming`, or `subagent-driven-development` cannot override these Git constraints or authorize a commit. `git-guard` blocks only a narrower set of commands; its silence is not permission to violate this skill.
|
|
@@ -7,7 +7,7 @@ description: Use when reviewing a teammate's merge request or commit before it m
|
|
|
7
7
|
|
|
8
8
|
## Overview
|
|
9
9
|
|
|
10
|
-
hero-mr-review is a standalone review skill for
|
|
10
|
+
hero-mr-review is a standalone review skill for a teammate's committed merge request/ref. It is not part of the `hero-planning → hero-coding → hero-reviewing/hero-unit-test` flow and does not wrap `hero-reviewing`. Choose between them by source of truth: `hero-reviewing` assesses an implementation against a Hero plan or explicit acceptance criteria and may target local or committed code; hero-mr-review assesses a committed MR range against its stated MR intent, repository conventions, impact, and potential bugs. Invoke it directly when a teammate's MR needs review before merge.
|
|
11
11
|
|
|
12
12
|
**Core principle:** review the diff, not the description. Every finding needs file:line evidence from the actual change — not a restatement of the commit message or an assumption about what the code "probably" does.
|
|
13
13
|
|
|
@@ -17,7 +17,7 @@ Use this skill when:
|
|
|
17
17
|
- A teammate has pushed commits and opened (or is about to open) a merge/pull request, and you need to review it before it merges.
|
|
18
18
|
- The user gives a commit SHA, tag, or branch name and asks for a review of "that MR" or "that commit."
|
|
19
19
|
|
|
20
|
-
Not for
|
|
20
|
+
Not for a plan-backed implementation assessment, even when that implementation is already committed — use `hero-reviewing` when the Hero plan or explicit acceptance criteria are the source of truth. This skill is committed-range-only and does not review local working-tree state.
|
|
21
21
|
|
|
22
22
|
## Inputs
|
|
23
23
|
|
|
@@ -92,6 +92,6 @@ Only if the MR corresponds to a row already tracked in `docs/ACTIVE_STATE.md`'s
|
|
|
92
92
|
|
|
93
93
|
## Related Skills
|
|
94
94
|
|
|
95
|
-
- Independent of the `hero-planning`/`hero-coding`/`hero-reviewing`/`hero-unit-test`
|
|
95
|
+
- Independent of the `hero-planning`/`hero-coding`/`hero-reviewing`/`hero-unit-test` flow. Use `hero-reviewing` instead whenever a Hero plan or explicit acceptance criteria define correctness, regardless of whether the target is local code or a commit/ref.
|
|
96
96
|
- Recommend a separate `hero-security` pass if the MR touches a sensitive surface (auth, secrets, external input, payments, AI/LLM behavior) instead of trying to cover security depth here.
|
|
97
97
|
- Recommend `hero-strict` if the MR is high-risk (architecture, shared/core modules, data model) and needs a fuller verification pass beyond this review.
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: hero-node
|
|
3
|
+
description: Use for implementation-only Node.js JavaScript or TypeScript service, CLI, worker, or library changes under an approved plan, bounded request, or exact user-approved review corrections
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Hero Node
|
|
7
|
+
|
|
8
|
+
## Scope and Mandatory Parent
|
|
9
|
+
|
|
10
|
+
hero-node specializes `hero-coding` within the same coding stage; it is not a new stage. Choose it instead of generic `hero-coding` for Node.js services, CLIs, workers, and libraries. The user does not need to invoke both. A frontend project does not qualify merely because it uses Node-based package tooling.
|
|
11
|
+
|
|
12
|
+
**Before any production edit, read the complete actual sibling [`../hero-coding/SKILL.md`](../hero-coding/SKILL.md), resolved from this skill's installed directory.** Do not substitute a remembered contract, repository template, or metadata declaration for that read. If the sibling is missing or unreadable, stop and report the missing prerequisite; do not reconstruct it.
|
|
13
|
+
|
|
14
|
+
Inherit the entire parent contract by reference, including approvals, inputs, scope, ledgers, dependencies, blockers, implementation-only boundaries, completion criteria, durable state, handoff, and reporting. The rules below add Node-specific implementation conventions; they do not weaken the parent.
|
|
15
|
+
|
|
16
|
+
<HARD-BOUNDARY>
|
|
17
|
+
Implement only an approved plan explicitly started by the user, a sufficiently bounded request, or exact correction IDs confirmed by prior independent `hero-reviewing` and explicitly approved by the user. Do not choose feedback or expand scope. No test authoring/running, verification commands, self-review, review delegation, deployment, release, or Git delivery actions. Assurance and delivery belong to separate later sessions.
|
|
18
|
+
</HARD-BOUNDARY>
|
|
19
|
+
|
|
20
|
+
Maintain the parent's linked task/requirement ledger, respect dependencies, and keep the approved plan immutable. Record deviations and blockers; stop for ambiguity, missing prerequisites, target drift, or unsafe scope expansion. Reconcile implementation coverage, not correctness. Finish with the parent handoff to independent testing and review.
|
|
21
|
+
|
|
22
|
+
## MUST: Bounded Changes
|
|
23
|
+
|
|
24
|
+
Apply these conventions to new code and portions genuinely necessary for the approved change. Do not mechanically convert untouched code to these conventions.
|
|
25
|
+
|
|
26
|
+
- Preserve the existing framework, module system, supported runtime, and project architecture.
|
|
27
|
+
- Do not add unrelated refactors, configuration changes, formatting churn, dependencies, or migrations. Do not convert JavaScript to TypeScript just to satisfy this skill.
|
|
28
|
+
- If requirements, framework constraints, or required behavior conflict with a rule here, stop and escalate with the concrete conflict. Do not silently exempt the framework or change semantics.
|
|
29
|
+
|
|
30
|
+
## MUST: Explicit Conditions and Conversions
|
|
31
|
+
|
|
32
|
+
- Compare boolean values explicitly with `=== true` or `=== false`, including predicate results in branches, guards, loops, and ternaries.
|
|
33
|
+
- Do not use unary `!` or `!!`. Strict inequality `!==` remains valid; it is not unary negation.
|
|
34
|
+
- Check the actual business condition rather than truthiness. Distinguish `undefined`, `null`, an empty string, an empty collection, zero, and `false` where the contract distinguishes them.
|
|
35
|
+
- Do not invent rejection rules: an empty string or zero may be valid. Check only what the approved requirements demand.
|
|
36
|
+
- Use strict equality/inequality (`===`, `!==`), not coercive equality (`==`, `!=`).
|
|
37
|
+
- Convert types explicitly, then validate the result against the required domain. Conversion alone is not validation; `Number("")` becoming zero does not establish valid input.
|
|
38
|
+
- Preserve nullable and nonboolean semantics. Never mechanically replace `!value` with `value === false`: the original also matches other falsy values. Establish the required cases first; stop if they are ambiguous.
|
|
39
|
+
|
|
40
|
+
Avoid:
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
if (!isAuthorized) return;
|
|
44
|
+
if (items.some(isExpired)) reject();
|
|
45
|
+
const enabled = !!input;
|
|
46
|
+
if (!quantity) reject();
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Use explicit conditions when these rules are required:
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
if (isAuthorized === false) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
if (items.some(isExpired) === true) {
|
|
56
|
+
reject();
|
|
57
|
+
}
|
|
58
|
+
if (quantity === undefined) {
|
|
59
|
+
throw new Error("Quantity is required");
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
For an optional boolean whose contract says only explicit `true` enables work, preserve all disabled cases:
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
if (enabled === undefined || enabled === null || enabled === false) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
startWork();
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
This example assumes `enabled` is already narrowed to `boolean | null | undefined`; unknown external input needs validation first.
|
|
73
|
+
|
|
74
|
+
## MUST: Readable Data and Control Flow
|
|
75
|
+
|
|
76
|
+
- Write ordinary, explicit statements. Avoid clever shorthand, coercion tricks, compressed chains, and short-circuit side effects such as `ready && publish()`.
|
|
77
|
+
- Map data field by field. Do not use bulk copying/mapping to hide which fields cross a boundary; explicit per-field assignments inside a collection's `.map()` are fine.
|
|
78
|
+
- Do not use object, array, or call spread when a clearer explicit alternative exists. Do not replace spread with `Object.assign`, reflective key loops, or another implicit bulk-copy workaround. See the narrow compatibility exception below.
|
|
79
|
+
- A ternary may have only one simple condition and two simple value branches. No nesting, compound conditions, calls with side effects, or assignment effects. Use `if`/`else` otherwise.
|
|
80
|
+
- Respect the existing formatter and surrounding style. Do not impose arbitrary line wrapping, one-line compression, or file-wide reformatting.
|
|
81
|
+
|
|
82
|
+
Avoid:
|
|
83
|
+
|
|
84
|
+
```ts
|
|
85
|
+
ready && publish();
|
|
86
|
+
const label = ready && permitted ? "run" : failed ? "retry" : "wait";
|
|
87
|
+
const dto = { ...input };
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Prefer:
|
|
91
|
+
|
|
92
|
+
```ts
|
|
93
|
+
if (ready === true) {
|
|
94
|
+
publish();
|
|
95
|
+
}
|
|
96
|
+
const label = ready === true ? "run" : "wait";
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## MUST: Owned Models and Boundary Validation
|
|
100
|
+
|
|
101
|
+
Do not use `any` or arbitrary dynamic properties anywhere in new or necessarily changed TypeScript code. Use `unknown` with narrowing for untrusted values; the allowed internal and library shapes below are not an escape hatch for untyped data.
|
|
102
|
+
|
|
103
|
+
For project-owned TypeScript domain entities and DTOs:
|
|
104
|
+
|
|
105
|
+
- Use classes with explicitly declared fields and complete constructor assignments. Map each field intentionally; do not use constructor parameter properties.
|
|
106
|
+
- Do not use `any`, arbitrary dynamic properties, non-null assertions, definite-assignment assertions, or casts pretending to initialize or validate data.
|
|
107
|
+
- Treat external JSON as untrusted runtime data. A class constructor or TypeScript annotation does not validate it. Validate/narrow input before constructing a model, or implement the required runtime guards explicitly in the constructor.
|
|
108
|
+
- Preserve the approved validation and serialization contracts. Do not assume a class instance is interchangeable with the framework's required wire representation.
|
|
109
|
+
|
|
110
|
+
Avoid:
|
|
111
|
+
|
|
112
|
+
```ts
|
|
113
|
+
class JobDto {
|
|
114
|
+
id!: string;
|
|
115
|
+
constructor(input: any) {
|
|
116
|
+
Object.assign(this, input);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Use explicit fields and constructor mapping:
|
|
122
|
+
|
|
123
|
+
```ts
|
|
124
|
+
class JobDto {
|
|
125
|
+
readonly id: string;
|
|
126
|
+
readonly enabled: boolean;
|
|
127
|
+
|
|
128
|
+
constructor(id: string, enabled: boolean) {
|
|
129
|
+
this.id = id;
|
|
130
|
+
this.enabled = enabled;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function parseJob(input: unknown): JobDto {
|
|
135
|
+
if (typeof input !== "object" || input === null) {
|
|
136
|
+
throw new Error("Job must be an object");
|
|
137
|
+
}
|
|
138
|
+
if (("id" in input) === false || typeof input.id !== "string") {
|
|
139
|
+
throw new Error("Job id must be a string");
|
|
140
|
+
}
|
|
141
|
+
if (("enabled" in input) === false || typeof input.enabled !== "boolean") {
|
|
142
|
+
throw new Error("Job enabled must be a boolean");
|
|
143
|
+
}
|
|
144
|
+
return new JobDto(input.id, input.enabled);
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
This example requires only string/boolean fields; it does not invent nonempty-ID rules. Add other domain validation only when the approved contract requires it. The runtime checks, not the class declaration, establish the external input's shape.
|
|
149
|
+
|
|
150
|
+
In JavaScript, use equivalent explicit class fields, constructor assignments, mapping, and runtime guards. Do not claim TypeScript's static guarantees or force a language migration. Stay within the project's supported JavaScript syntax; escalate an incompatibility rather than silently weakening the rule.
|
|
151
|
+
|
|
152
|
+
## PREFER: Cohesion and Safe Early Returns
|
|
153
|
+
|
|
154
|
+
- Prefer guard clauses and early returns over unnecessary nesting, but preserve cleanup, transaction outcomes, locks, streams, and resource ownership. Keep required `finally`/disposal paths intact; use structured branching when an early return would bypass required work.
|
|
155
|
+
- Keep a cohesive use case readable together. Extract files/functions for meaningful responsibilities, boundaries, or reuse, not an automatic one-function-per-file policy.
|
|
156
|
+
- Avoid the opposite extreme of a giant service/module holding unrelated use cases. Make only the separation necessary for the approved change.
|
|
157
|
+
- Prefer clear intermediate names and direct control flow over terse expressions. Readability is not a reason to change unrelated behavior.
|
|
158
|
+
|
|
159
|
+
## Allowed Shapes and Narrow Exceptions
|
|
160
|
+
|
|
161
|
+
These allowances do not waive explicit mapping, runtime validation, or scope limits:
|
|
162
|
+
|
|
163
|
+
- `unknown` is appropriate for untrusted input when it is validated and narrowed before use.
|
|
164
|
+
- Use library-provided option types for library configuration; do not wrap every options object or temporary value in a domain class.
|
|
165
|
+
- Named internal `type`/`interface` declarations are appropriate for internal structures that are not project-owned domain entities or DTOs.
|
|
166
|
+
- Typed dictionaries are appropriate when dynamic keys are a genuine domain requirement. Declare the key/value contract and validate external entries; do not disguise arbitrary model properties as a dictionary.
|
|
167
|
+
- Spread is allowed only when genuinely unavoidable for a required API compatibility contract and no explicit alternative preserves that contract. Explain the exact API constraint and why explicit alternatives fail, and record the exception in the implementation handoff. Convenience, terseness, and existing style are not exceptions. If necessity is unclear, stop and ask.
|
|
168
|
+
|
|
169
|
+
There is no blanket framework exception to the class or other MUST rules. If a framework requires an incompatible representation or a convention would alter required behavior, stop and request an explicit resolution rather than silently bypassing it.
|
|
170
|
+
|
|
171
|
+
## Handoff and Report Convention
|
|
172
|
+
|
|
173
|
+
Inherit the parent's report style and the project's Response Style, preserving exact file paths, commands, API names, and errors.
|
|
174
|
+
|
|
175
|
+
Use the parent's completion and handoff contract, including changed areas, task/requirement states, exact approved correction IDs when relevant, blockers, and approved deviations. State that testing, verification, and independent review were not performed in this stage; identify what later sessions must establish without claiming correctness evidence.
|
|
176
|
+
|
|
177
|
+
Do not create a report file automatically. When the user requests a written report, invoke `hero-report` with source stage `hero-coding` and the parent's coding-report contract (`docs/coding-reports/YYYY-MM-DD-<slug>.md`). Identify `hero-node` as the specialization in the content if useful. Do not create a new report category, directory, or workflow stage.
|