Stack Pack Contract
Purpose #
Quick-reference excerpt of the StackPack interface, the manifest, the contribution rules, and per-method conformance. Authoritative: .docs/docs/specs/stack-pack-contract.md.
The interface #
import type {
StackPackManifest, DetectContext, DetectionResult,
ProjectContext, SkillTemplate, ValidationCommand, ArchitecturePatternHint,
} from '@aidokit/core';
export interface StackPack {
readonly manifest: StackPackManifest;
detect(ctx: DetectContext): Promise<DetectionResult>;
suggestSkills(ctx: ProjectContext): SkillTemplate[];
suggestMCPs(ctx: ProjectContext): string[];
suggestValidationCommands(ctx: ProjectContext): ValidationCommand[];
defaultArchitecturePattern?(ctx: ProjectContext): ArchitecturePatternHint;
}
Stateless const objects. Stack packs MUST NOT emit files directly — they contribute data; the adapter emits (ADR-0006 §2).
The manifest #
export interface StackPackManifest {
name: string; // kebab-case
displayName: string;
languages: string[]; // ['typescript', 'javascript']
specVersion: '2.0';
sdkVersion: string;
conformance: 'minimum' | 'standard' | 'strict';
packVersion: string;
maintainer: { name: string; url?: string; email?: string };
detectionSignals: { files?: string[]; manifestDeps?: string[]; configFiles?: string[] };
composesWith?: string[]; // e.g. ['react', 'next-js', 'vue']
}
At-rest form is stack-pack.md with YAML frontmatter.
Method specifications #
| Method | Purpose | Conformance MIN / STD / STR |
|---|---|---|
detect |
Return DetectionResult with categorical confidence |
MUST / MUST / MUST |
suggestSkills |
Stack-specific SkillTemplate[] |
MUST / MUST / MUST |
suggestMCPs |
Catalog ids (strings) only — no inline MCPs | MAY / MUST / MUST |
suggestValidationCommands |
ValidationCommand[] for lint, typecheck, test, etc. |
MAY / MUST / MUST |
defaultArchitecturePattern |
Optional; Strict only | MAY / MAY / SHOULD |
Full per-method MUST/SHOULD/MAY in .docs/docs/specs/stack-pack-contract.md §8.
Supporting types (one-liners) #
DetectContext—{ projectRoot, fileExists, readFile, readManifest, glob, manifestHasDep, os }. No shell, no network.DetectionResult—{ matched, confidence: 'high' | 'medium' | 'low' | 'none', extras?, reason? }.SkillTemplate— same shape as in adapter contract; for packs:source: 'stack-pack',sourcePackIdset,required: falseunless the stack cannot function without it.ValidationCommand—{ id, label, command, kind: 'lint' | 'typecheck' | 'test' | 'format-check' | 'build' | 'other', ciSafe, speed: 'fast' | 'medium' | 'slow' }.ArchitecturePatternHint—{ pattern, rationale, suggestedLayout: string[], strength: 'opinionated' | 'default' }.
Cardinal rules (from ADR-0006) #
- No file emission. Packs return data; adapters emit.
- No shell, no network.
DetectContextis the only filesystem surface. - Reference catalog MCP ids only. No inline MCP definitions.
- No security-sensitive MCP suggestions. Per mcp-catalog §10.3.
<REVIEW REQUIRED>markers for opinionated skill content so users know what to confirm.- Determinism. Same context + same filesystem = same output.
Composability #
Multiple packs can match. The CLI:
- Shows matches at
mediumconfidence or higher. - Default-selects
highmatches. - Allows user override.
Conflicts (e.g. two packs proposing different id: 'test' commands) are surfaced to the user; the highest-confidence pack's suggestion wins by default. See .docs/docs/specs/stack-pack-contract.md §10.3.
Worked example #
The node-ts pack is the canonical example. Skim:
packages/stack-pack-node-ts/src/index.ts— the const-object patternpackages/stack-pack-node-ts/src/detect.ts—tsconfig.json+typescriptdep combinationpackages/stack-pack-node-ts/src/skills.ts— five<REVIEW REQUIRED>-marked skillspackages/stack-pack-node-ts/src/validation.ts— package-manager detection from lockfile
Full reference: .docs/docs/specs/stack-pack-contract.md §16.