Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions hooks/context.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
You have the SpecForge plugin loaded. SpecForge is a spec-driven development toolkit that turns requirements into sprint-ready work following IEEE 830 / ISO 29148 standards.

## Available Slash Commands

| Command | Usage | Purpose |
|---|---|---|
| `/new-spec` | `/new-spec <type> <name>` | Create a spec from template (object, usecase, screen, businessrule, actor, workflow, nfr, etc.) |
| `/new-epic` | `/new-epic <UC code>` | Generate an epic from a use case |
| `/new-story` | `/new-story <EPIC code> <name>` | Create a user story with spec traceability |
| `/new-sprint` | `/new-sprint <number> <REL code>` | Create a sprint plan from ready stories |
| `/meeting-note` | `/meeting-note <subject>` | Capture meeting notes with UR extraction |
| `/check-traceability` | `/check-traceability [scope]` | Scan for orphans and coverage gaps |
| `/phase-delta` | `/phase-delta <spec code>` | Create a Phase 2+ delta for an approved spec |
| `/change-request` | `/change-request <title>` | Log a formal change request |
| `/impact-analysis` | `/impact-analysis <CR code>` | Run blast-radius analysis on a CR |
| `/apply-change` | `/apply-change <CR code>` | Execute an approved change request |

## Auto-Triggering Skills

These activate automatically based on what you are doing — you do not need to invoke them manually:

- **spec-writer** — activates when writing or editing any specification document
- **requirement-decomposer** — activates when decomposing specs into epics, stories, or sprints
- **traceability-checker** — activates when verifying cross-references or coverage

## Available Agents

Invoke these for complex multi-step tasks:

- **spec-reviewer** — IEEE 830 / ISO 29148 quality review with scored report
- **decomposition-agent** — auto-decompose a use case into an epic + user stories
- **traceability-agent** — build or validate the full Requirements Traceability Matrix
- **change-impact-agent** — autonomous blast-radius analysis for a change request

## Key Rules (Always Follow)

1. **Never edit Approved specs directly** — always use `/phase-delta <spec code>` to create a Phase 2 delta. Every change must trace to a CR code.
2. **Naming conventions** — O<NN>_, UC<NNNN>_, S<NNNN>_, BR<NNNN>_, ACT<NNNN>_, WF<NNNN>_, ST<NNNN>_, PM<NNNN>_, NFR<NNNN>_, EPIC-NNNN_, US-NNNN_, SPR-NNNN_
3. **Spec output directory** — write all generated spec artifacts to `docs/`
4. **Templates** — always copy from `templates/` when creating new specs; never create from scratch
5. **Traceability** — every user story must trace back to at least one SRS artifact (UC, Object, Screen, BR, etc.)
19 changes: 18 additions & 1 deletion hooks/hooks.json
Original file line number Diff line number Diff line change
@@ -1 +1,18 @@
{}
{
"description": "SpecForge BA workflow hooks: injects plugin context at session start.",
"hooks": {
"SessionStart": [
{
"matcher": "startup|clear|compact",
"hooks": [
{
"type": "command",
"command": "bash \"${CLAUDE_PLUGIN_ROOT}/hooks/scripts/session-start.sh\"",
"async": false,
"timeout": 10
}
]
}
]
}
}
26 changes: 26 additions & 0 deletions hooks/scripts/session-start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
# SpecForge SessionStart hook
# Injects SpecForge plugin context into every new Claude Code session so that
# Claude is always aware of available commands, agents, skills, and key rules.
# Pattern adapted from obra/superpowers session-start hook.

set -euo pipefail

PLUGIN_ROOT="${CLAUDE_PLUGIN_ROOT:-$(cd "$(dirname "$0")/../.." && pwd)}"
CONTEXT_FILE="${PLUGIN_ROOT}/hooks/context.md"

if [ ! -f "$CONTEXT_FILE" ]; then
exit 0
fi

# Read and JSON-escape the context content (no subshells, pure bash)
content=$(<"$CONTEXT_FILE")
content="${content//\\/\\\\}"
content="${content//\"/\\\"}"
content="${content//$'\n'/\\n}"
content="${content//$'\r'/}"
content="${content//$'\t'/\\t}"

payload="{\"hookSpecificOutput\":{\"hookEventName\":\"SessionStart\",\"additionalContext\":\"${content}\"}}"

printf '%s' "$payload"
Loading