src/skills/x-add-story-to-feature/SKILL.md
Adds a newly discovered story to an already-refined feature; validates and proposes feature/implementation-map updates.
npx skillsauth add edercnj/claude-environment x-add-story-to-featureInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Add a newly discovered (post-refinement) story to an existing, already-refined feature. This skill:
x-internal-create-story-from-feature (when --from-feature is provided) or the inline generic story-creation procedure (generic fallback — ver references/full-protocol.md).IMPLEMENTATION-MAP.md.Prerequisite: The feature must have
refinementVerdict.status == "approved". This skill enforces the post-refinement discovery flow.
x-refine-feature firstx-create-feature Stage 3| Parameter | Required | Description |
| :--- | :--- | :--- |
| --feature-id <NNNN> | Yes | Target feature identifier (4 digits) |
| --story-title <title> | Yes | Short descriptive title for the new story |
| --from-feature <path> | No | Feature markdown to derive the story from (with RNF inheritance) |
| --dry-run | No | Run impact analysis and story generation without writing files |
| Code | Name | Condition |
|------|------|-----------|
| 0 | SUCCESS | Story added and feature/map updated |
| 1 | FEATURE_NOT_FOUND | Feature markdown not found |
| 2 | FEATURE_NOT_REFINED | Feature does not have refinementVerdict.status == "approved" |
| 3 | STORY_CREATE_FAILED | x-internal-create-story-from-feature or the inline generic story-creation procedure failed |
| 4 | COMMIT_FAILED | x-commit-planning returned non-zero |
feature-NNNN-*/feature-NNNN.md glob (→ FEATURE_NOT_FOUND on miss).feature-NNNN-*/execution-state.json. Check refinementVerdict.status == "approved" (→ FEATURE_NOT_REFINED if not).story-NNNN-*.md files).If --from-feature <path> provided:
Skill(skill: "x-internal-create-story-from-feature",
args: "--from-feature {featurePath} --feature-id <NNNN> --no-commit")
Otherwise, run the inline generic story-creation procedure with the feature as both spec and feature source, in --no-commit mode (this skill owns the commit in Phase 5):
Execute o procedimento §Story Creation Procedure (âncoras CS1–CS5 + preludes/epilogue) em
references/full-protocol.md, equivalente a{featurePath} {featurePath} --feature-id <NNNN> --story-title <title> --no-commit. Em--no-commit, as âncoras CS-P2/CS-P4/CS-P5 (branch-ensure/commit/push) são no-ops. O procedimento preserva as chamadas aninhadas a skills KEEP inalteradas:x-internal-select-knowledge(seleção dinâmica de knowledge--kind domain --stage story, ver CS-Prerequisites),x-commit-planning(CS-P4) ex-push-branch(CS-P5).
On failure within the procedure (quality gate exhausted, template/spec/feature missing) → exit STORY_CREATE_FAILED.
Read the generated story and the current feature markdown. Analyze whether the new story:
Present a structured summary of proposed updates:
📋 Impact Analysis — New story: <story-title>
Story file: story-NNNN-YYYY.md ✅ created
Proposed feature updates:
§ 5 (Scope): [UPDATE required | no change] — <reason>
§ 6 (Story Index): [UPDATE required] — add row: | story-NNNN-YYYY | <title> | Phase N |
§ 7 (Dependencies): [UPDATE required | no change] — <dependency relationships>
§ 8 (Quality Gates): [UPDATE required | no change] — <new DoR/DoD criteria if any>
Proposed IMPLEMENTATION-MAP updates:
[UPDATE required | no change] — <brief description of phase/critical path changes>
Present via AskUserQuestion with 3 choices:
A: Apply all proposed changes (Recommended)B: Review changes individuallyC: Skip feature/map updates (story file only)Based on operator choice:
Option A (Apply all):
IMPLEMENTATION-MAP.md: add new story to phase layout and dependenciesOption B (Individual review):
Option C (Skip):
"Feature markdown and IMPLEMENTATION-MAP not updated. Manual review recommended."Skill(skill: "x-commit-planning",
args: "--scope chore --feature-id <NNNN> --paths <story-path>[,<feature-path>][,<map-path>] --subject \"add story: <title>\"")
On COMMIT_FAILED (exit 4): abort.
x-add-story-to-feature completed
Feature: .aikittools/features/feature-NNNN-.../feature-NNNN.md
Story: .aikittools/features/feature-NNNN-.../story-NNNN-YYYY.md
Map: <updated | not updated>
Changes applied: <list of updated sections | none>
Next step: /x-refine-story story-NNNN-YYYY
FEATURE_NOT_REFINED if feature does not have an approved verdict.x-internal-create-story-from-feature (preferred, Feature-derived) or runs the inline generic story-creation procedure (generic fallback; protocolo CS1–CS5 em references/full-protocol.md).x-internal-select-knowledge (dynamic domain knowledge selector), x-commit-planning (CS-P4) and x-push-branch (CS-P5) unchanged — these were NOT inlined.x-refine-feature again.x-refine-story: After adding the story, the operator should run /x-refine-story story-NNNN-YYYY separately to complete the refinement cycle.Introduced to address the discovery gap created when
x-create-story(direct user invocation) was made internal. Provides a structured, impact-aware mechanism for post-refinement story additions that preserves feature consistency.O protocolo completo do gerador genérico de story (CS1–CS5, preludes/epilogue P1/P2/P4/P5, quality gate, Jira flow, contratos de dados, Gherkin TPP) vive em
references/full-protocol.md§Story Creation Procedure; o corpo desta skill permanece enxuto.
Minimum viable contract above. The full generic story-creation procedure inlined from x-internal-create-story (section-by-section story template, Gherkin TPP ordering, data contract precision rules, Mermaid diagram templates, quality gate scoring dimensions, Jira cascaded vs standalone flow, sizing heuristics, common mistakes, and the preserved nested KEEP-skill calls x-internal-select-knowledge / x-commit-planning / x-push-branch) lives in references/full-protocol.md per ADR-0012 (skill body slim-by-default).
development
Documentation freshness gate: validates 6 dimensions (readme, api, adr, etc.) per PR.
testing
Conditional dep-policy gate: CVEs, licenses, versions, freshness; SARIF + report.
documentation
Incrementally updates the service or system architecture document; never regenerative.
development
Scans code and git history for leaked credentials, API keys, and tokens; SARIF output.