Skip to content

feat(claude): /feature-spec slash command — structured handoff that feeds the encoding loop#115

Merged
emeraldleaf merged 2 commits into
mainfrom
chore/feature-spec-slash-command
Jun 5, 2026
Merged

feat(claude): /feature-spec slash command — structured handoff that feeds the encoding loop#115
emeraldleaf merged 2 commits into
mainfrom
chore/feature-spec-slash-command

Conversation

@emeraldleaf
Copy link
Copy Markdown
Owner

@emeraldleaf emeraldleaf commented Jun 5, 2026

Summary

Adds `/feature-spec` slash command. Closes the spec-capture gap in the encoding loop without adopting Spec Kit's per-feature ceremony.

When invoked with a feature description, the command:

  1. Asks 2–4 targeted clarifying questions (service, endpoint shape, domain changes, external integrations)
  2. Drafts a structured spec with Goal / Acceptance / Affects / Constraints from CLAUDE.md — the constraints section auto-references the rules that apply (IDOR predicate, outbox atomicity, optimistic concurrency, required tests, etc.) with links to the canonical CLAUDE.md sections
  3. Significance-checks whether the change deserves an ADR-style doc under `docs/decisions/`
  4. Outputs a GitHub issue body (ready to `gh issue create`) + optional ADR draft + concrete `/new-feature-slice` scaffolding suggestions
  5. Closes with a verbatim "encode lessons after shipping" prompt that keeps the spec → code → encoding loop closed

Three-layer persistence model

Layer Artifact Persistence
Spec GitHub issue + PR description Ephemeral — archives when feature ships; the code is the artifact
Implementation lessons CLAUDE.md / `.coderabbit.yaml` / architecture-reviewer agent / skills / docs+diagrams (the 5 surfaces) Durable — applied every session
Architectural decisions `docs/decisions/YYYY-MM-DD-.md` ADR (or `docs/project-decisions.md` entry) Durable + browseable — survives for "why did we choose X six months ago?" questions

Why not Spec Kit

Same reasoning as the prior CLAUDE.md edits: per-feature spec ceremony is too heavy when the canon already covers "how to build it correctly" for most features. This command produces just the handoff document — not a plan, not tasks, not regenerable source-of-truth.

For multi-stakeholder greenfield work, Spec Kit still earns its keep. This command is for the case where the bottleneck is "structured handoff between intent and implementation," not "figuring out what to build."

The command itself participates in the encoding loop

The "Constraints from CLAUDE.md" section is a paraphrase site. When CLAUDE.md changes, the constraints list may need updating. Marked with the `See CLAUDE.md.` cross-reference convention so:

  • `/check-rules` audits alignment between this file and CLAUDE.md
  • The `check-claude-md-refs.sh` PostToolUse hook surfaces this file in its worklist when CLAUDE.md is edited

This means the command itself gets continuously improved — same as every other paraphrase site.

What this is NOT

  • Not Spec Kit (no plan, no task list)
  • Not implementation planning (that's `/new-feature-slice` + writing code)
  • Not an auto-encoder (proposes; user decides)

Verification

  • File created at `.claude/commands/feature-spec.md` (registered as the `/feature-spec` skill)
  • Includes the `See CLAUDE.md.` marker for cross-reference audit discovery
  • Single-file addition — no other surfaces touched in this PR

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Added a comprehensive feature-spec command guide that defines a structured workflow for drafting ephemeral feature handoffs: clarifying questions, required sections (Goal, Acceptance criteria, Affects, and constraint references), significance checks for ADR drafting, required outputs (issue body, optional ADR draft, post-approval scaffolding suggestions), style constraints, explicit “not” boundaries, and example invocations.

…handoff

Closes the spec-capture gap in the encoding loop. Draws a tight handoff
document — goal + acceptance + affected surfaces + auto-referenced
CLAUDE.md constraints + scaffolding suggestions — then prompts the user
to encode lessons after implementation. The spec itself is ephemeral
(ships as a GitHub issue + PR description); the lessons + significant
decisions are durable across the five encoding surfaces.

Why this exists (the gap it closes):

Spec Kit's /specify produces a per-feature spec as the source of truth
that code is derived from. NextAurora's loop deliberately doesn't do
that (most features are pattern-conforming and a per-feature spec would
re-state what CLAUDE.md already covers). But the loop did have a real
gap: no structured way to capture "what this new feature is" at the
handoff between intent and implementation. /feature-spec fills that
without adopting Spec Kit's whole methodology.

Three-layer persistence model:

1. SPEC (ephemeral) - the command's output. Ships as GitHub issue body +
   PR description. Archives when the feature ships. Once shipped, the
   code is the artifact.
2. IMPLEMENTATION LESSONS (durable) - rules/patterns surfaced while
   building. Encoded across the five surfaces (CLAUDE.md, .coderabbit.yaml,
   architecture-reviewer agent, skills, docs+diagrams). This is what
   the existing Continuous Rule Encoding loop already handles.
3. ARCHITECTURAL DECISIONS (durable, browseable) - for significant features
   (new bounded context, new transport, new tenancy model), an ADR-style
   doc under docs/decisions/ or addition to docs/project-decisions.md.

The command:
- Asks 2-4 clarifying questions to lock in scope (service, endpoint shape,
  domain changes, external integrations)
- Drafts the structured spec (Goal, Acceptance, Affects, Constraints from
  CLAUDE.md - auto-inferred and linked)
- Significance-checks for ADR-worthiness
- Outputs a GitHub issue body + optional ADR draft + /new-feature-slice
  scaffolding suggestions
- Closes with a verbatim "encode lessons after shipping" prompt to keep
  the spec → code → encoding loop closed

The command file itself is a paraphrase site (Constraints from CLAUDE.md
section lists rules with their canonical references). Marked with the
`See CLAUDE.md.` cross-reference convention so /check-rules audits the
alignment and the PostToolUse hook surfaces it when CLAUDE.md changes.

What this is NOT:
- Not Spec Kit. Doesn't produce a plan or task list.
- Not implementation planning - that's /new-feature-slice + writing code.
- Not an auto-encoder - it proposes; the user decides.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 5, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: dd988feb-29f3-4f02-890d-55ec559962a2

📥 Commits

Reviewing files that changed from the base of the PR and between e8ba5aa and cd6f2d7.

📒 Files selected for processing (1)
  • .claude/commands/feature-spec.md

Walkthrough

Adds a command guide at .claude/commands/feature-spec.md defining input, spec sections, constraint linking, ADR significance checks, outputs (issue body and optional ADR), closing-loop prompt, style notes, and example invocations.

Changes

Feature-spec command guide

Layer / File(s) Summary
Command definition and spec workflow
.claude/commands/feature-spec.md
Introduces the spec→code→encode framing, defines the $ARGUMENTS input contract, clarifying-questions step, and required spec sections (Goal, Acceptance criteria, Affects) with auto-linked constraints from CLAUDE.md.
ADR decision logic, outputs, and usage guidance
.claude/commands/feature-spec.md
Adds ADR-significance criteria and sibling-ADR drafting instructions, specifies outputs (GitHub issue body formatted for project issue form, optional ADR draft, scaffolding suggestions), closing-loop prompt to capture lessons learned, style notes, “what this command is NOT,” and example invocations.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding a new /feature-spec slash command with structured handoff capability that integrates into the encoding loop.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/feature-spec-slash-command

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.claude/commands/feature-spec.md:
- Line 120: The relative link "../.github/ISSUE_TEMPLATE/work-item.yml" in
.claude/commands/feature-spec.md is incorrect and resolves to .claude/.github;
update that link to "../../.github/ISSUE_TEMPLATE/work-item.yml" so it points to
the repository root template. Locate the markdown line containing the exact
string "../.github/ISSUE_TEMPLATE/work-item.yml" and replace it with
"../../.github/ISSUE_TEMPLATE/work-item.yml".
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: f5320e62-437b-4a76-87cb-3d2949c87a2e

📥 Commits

Reviewing files that changed from the base of the PR and between c9480e5 and e8ba5aa.

📒 Files selected for processing (1)
  • .claude/commands/feature-spec.md

Comment thread .claude/commands/feature-spec.md Outdated
CI broken-link audit caught: ../.github/ISSUE_TEMPLATE/work-item.yml from
.claude/commands/feature-spec.md resolves to .claude/.github/... which
doesn't exist. Needs ../../ to walk out of both commands/ and .claude/.

The guard caught this on its first run against the new file, exactly
as designed (catching relative-path drift in markdown is the whole point
of the broken-link audit added in #112).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@emeraldleaf emeraldleaf merged commit 4bdc409 into main Jun 5, 2026
7 checks passed
@emeraldleaf emeraldleaf deleted the chore/feature-spec-slash-command branch June 5, 2026 14:17
emeraldleaf added a commit that referenced this pull request Jun 5, 2026
#116)

Three doc sites had drift from the recent encoding-loop work:

README.md (line 18 "Two AI reviewers" callout)
- Old: lists only .claude/skills/ as what Claude Code reads
- New: lists the full .claude/ folder (agents, skills, slash commands,
  hook scripts, hook + permission wiring) — the meta-layer that gets
  ported between projects
- ADDED a new "Continuous Rule Encoding" callout right after, introducing
  the loop + 3-tier enforcement spectrum + lean-CLAUDE.md discipline
  (~300 lines, CI soft cap 400, hard fail 500) + the 5 encoding surfaces
  + cross-links to /feature-spec, /article-audit, /check-rules,
  /new-feature-slice, /sync-status. Points at docs/dev-loop.md for full
  mechanics and docs/dev-loop-scaffolding.svg for the scaffolding diagram.

docs/dev-loop.md (Slash commands table)
- Was missing /feature-spec (just landed in #115) and /article-audit
  (landed earlier this week)
- Added both with their actual one-line descriptions

docs/dev-loop.svg (rendered diagram people see on GitHub)
- Stage 1 "PostToolUse" hooks list: added check-file-moves.sh (the hook
  added in #114 for git-mv/git-rm detection)
- Stage 1 "Slash commands" list: added /feature-spec and /article-audit
  alongside the existing 3; shifted Agents/Skills/Secondary-reviewer
  positions down by 54px to make room
- Encoding loop "Encode in:" footer: was 4 surfaces (CLAUDE.md +
  .coderabbit.yaml + arch-reviewer Pattern Checklist + skill), now 5
  surfaces (added "docs + paired diagrams" as surface 5, shortened
  labels to fit). Title now reads "Encode in 1+ of 5 surfaces" to
  clarify the surface count

What this is NOT:
- Not a full dev-loop.svg regeneration — the SVG also has other minor
  staleness (CLAUDE.md size annotation "25 KB" is outdated since the
  trim; integration tests list only shows Catalog + Order while CI now
  runs 4 slices). Targeted surgery here, not a rewrite.

Verification:
- broken-link guard: exit 0 on the changed markdown files
- All cross-references resolve

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant