# Method: FPF Spec to Executable Skills
This document defines the methodology for taking the First Principles Framework (FPF) Specification and systematically executing it to produce working Agent Skills.
## 1. The Core Loop ("The Whole Run")
The "Whole Run" is the process of converting abstract Spec Patterns into concrete, executable Skills.
**Flow:**
`FPF Spec Patterns` -> **[Extraction]** -> `Skill Inventory (The Tracker)` -> **[Execution]** -> `Executable Skills`
---
## 2. The 6-Stage Generation Lifecycle
### Stage 1: Extraction (Analysis)
**Goal**: Identify skill candidates from FPF Specifications.
- **Input**: FPF Spec (e.g., A.15.1, F.18).
- **Action**:
1. Scan Spec for **invariants** and **actions** (e.g., "Must create a 4D anchor", "Must mint a name").
2. Map actions to a **Skill Family** (e.g., Telemetry, Planning, Naming).
3. Define a preliminary **Skill Name** (`<domain>/<name>`).
- **Output**: A list of candidate skills.
### Stage 2: Inventory (Tracking)
**Goal**: Register the skill in the central tracker.
- **Tracker Artifact**: `contexts/Skills/design/SKILL_INVENTORY.md`
- **Action**:
1. Open `SKILL_INVENTORY.md`.
2. Add a new row: `| Family | Pattern Ref | <domain>/<name> | [ ] | Description |`.
3. Mark Status as `[ ]` (Pending).
- **Output**: Updated Inventory.
### Stage 3: Scaffolding (Skeleton)
**Goal**: Create the physical directory structure.
- **Tool**: `tools/cli/src/cli.ts`
- **Action**:
1. Run the scaffolding command:
```bash
npx tsx tools/cli/src/cli.ts new <domain>/<name>
```
2. Verify directory creation at `contexts/Skills/src/<domain>/<name>/`.
- **Output**:
- `SKILL.md` (Template)
- `src/index.ts` (Empty entry point)
### Stage 4: Definition (Kernel)
**Goal**: Define the Skill's "Brain" (Instructions and Boundary).
- **File**: `contexts/Skills/src/<domain>/<name>/SKILL.md`
- **Action**:
1. **Frontmatter**:
- `name`: Set to `fpf-skill:<domain>-<name>` (e.g., `fpf-skill:design-mint-name`).
- `allowed_tools`: List necessary tools (or `[]` if pure logic).
2. **Context**: Briefly explain *why* this skill exists (reference FPF Pattern).
3. **Instructions**: Write the step-by-step algorithmic prompt for the Agent.
- Use **Headings** for steps.
- Use **Bold** for critical constraints.
- **Output**: A fully defined `SKILL.md`.
### Stage 5: Implementation (Logic)
**Goal**: Implement any code dependencies (if tool usage is required).
- **File**: `contexts/Skills/src/<domain>/<name>/src/index.ts`
- **Action**:
- Write TypeScript functions if the skill needs to perform complex I/O or calculations not suitable for pure LLM instructions.
- **Output**: Compilable source code.
### Stage 6: Verification (Quality Control)
**Goal**: Ensure the skill is valid and follows FPF standards.
- **Tool**: `tools/cli/src/cli.ts`
- **Action**:
1. Run inspection:
```bash
npx tsx tools/cli/src/cli.ts inspect <domain>/<name>
```
2. Verify:
- JSON Frontmatter validity.
- Required sections (Context, Instructions).
3. Update Inventory: Mark as `[x]` in `SKILL_INVENTORY.md`.
- **Output**: A verified, ready-to-dispatch skill.
---
## 3. How to Start ("Where we take FPF Spec")
1. **Review the `experiment.md` (or Master Spec)**: Look for "FPF-Spec (8)" citations.
2. **Add to Inventory**: For every citation (e.g., "Using A.15.3"), add a corresponding Skill to `skill_inventory.md`.
3. **Execute**: Pick the first `[ ]` item and run Stages 3-6.
## Summary
By maintaining `SKILL_INVENTORY.md`, you always know **what is left**. By following the 6 Stages, you ensure every generic Spec requirement becomes a concrete **Skill**.