SuperAPI AI Directory

spec-context

Coding & development

View repository

Updated 10-16 01:27

About this skill

Spec context location (FEATURE_DIR)

Overview

Read/write requirements/*.md must first determine {FEATURE_DIR}. Anchored onthe current Git branch name, guessing paths is prohibited.

If the repository contains .gitmodules,spec-context the submodule status snapshot should also be additionally exposed, for the implementation phase to verify branch consistency, detached HEAD, and a dirty working tree; however, thiswill notchange the resolution rules of FEATURE_DIR .

At the start, announce:"I am using the spec-context skill to locate the current Spec Pack (FEATURE_DIR)."

When to use

  • Will read/write {FEATURE_DIR}/requirements/*.md
  • Unsure of the current spec pack or encountering branch/directory/.aisdlc -related context errors

Procedure: reuse existing results, otherwise run the script

Prefer reuse: if this session has already successfully echoed FEATURE_DIR=..., and that directory exists and contains requirements/, then directly reuse and echo FEATURE_DIR=... (reuse)。

Otherwise: concatenate the absolute script path under <本SKILL.md目录>/scripts/ and execute it, reading the FEATURE_DIR=<path> line from the output.

For implementation-phase callers (such as spec-plan、spec-execute), if the script also outputs SUBMODULE_SET_JSON=... or an equivalent field, it should also be retained and passed to subsequent steps for use.

PowerShell

powershell -NoProfile -ExecutionPolicy Bypass -File "<本SKILL.md目录>/scripts/spec-common.ps1" -SkillName "<caller-skill-name>"

Bash

"<本SKILL.md目录>/scripts/spec-common.sh" "<caller-skill-name>"

-SkillName / first argument: replace with the name of the currently executing skill (such as spec-plan)。 <本SKILL.md目录>: replace with the absolute path of the directory containing this SKILL.md .

Hard rules

  • Read/write requirements/*.md must first echo FEATURE_DIR=...(choose one: reuse or script)
  • If the script fails, stop immediately and do not continue writing files
  • All subsequent paths must be prefixed with the FEATURE_DIR value
  • If the repository contains .gitmodules, the implementation phase must not bypass the script to "guess" the submodule path or branch state

Common errors and Red Flags

  • Did not pass -SkillName or copied the <caller-skill-name> literal verbatim
  • Non-spec branch (branch name does not conform to {num}-{short-name})
  • Hand-writing the .aisdlc/specs/... path; continuing to generate after context failure
  • Treating the submodule branch as a new Spec identity, attempting to derive it independently with FEATURE_DIR