SuperAPI AI Directory

spec-context

Coding & development

View repository

Updated 10-16 08:49

About this skill

Spec Context Location (FEATURE_DIR)

Overview

Read/write requirements/*.md Before this, you must first determine {FEATURE_DIR}. Usecurrent Git branch nameas the anchor; guessing paths is prohibited.

Branch Format:

  • Spec branch:{num}-{short-name}(e.g. 001-user-auth)→ FEATURE_DIR=.aidlc/specs/<分支名>。
  • task branch(collaboration):{num}-{short-name}/T1-task-slug(e.g. 001-user-auth/T1-api)→ FEATURE_DIR still points to the same Spec Pack(001-user-auth directory),does notpoint to the task subdirectory. Script output will include TASK_WORK_BRANCH、TASK_DIR、TASK_PACK_DIR(if the Task Pack already exists).

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

Announce at the start:"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/.aidlc -related context errors

Approach: 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 reuse it directly and echo FEATURE_DIR=... (reuse)。

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

For implementation-phase callers (e.g. 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 parameter: replace with the name of the currently executing skill (e.g. spec-plan)。 <本SKILL.md目录>: replace with the absolute path of the directory containing this SKILL.md .

Hard Rules

  • Before reading/writing requirements/*.md , you must first echo FEATURE_DIR=...(either reuse or script)
  • If the script fails, stop immediately and do not continue writing files
  • All subsequent paths must be prefixed with the value of FEATURE_DIR value is a prefix
  • If the repository has .gitmodules, the implementation phase must not bypass the script to "guess" submodule paths or branch status

Common Mistakes and Red Flags

  • Did not pass -SkillName or copied the <caller-skill-name> literal
  • Non-spec / non-task branch (neither conforms to {num}-{short-name}, nor conforms to {num}-{short-name}/T1-slug)
  • Manually writing the .aidlc/specs/... path; continuing to generate after context failure
  • Treating the submodule branch as a new Spec identity, attempting to derive it separately from FEATURE_DIR