agentleFS
davidmatousekdavidmatousek/tachi/.claude/skills/aod-stack/SKILL.md

aod-stack

Skill95 starsChanged 36 days agoApache-2.0View on GitHub

Manage stack packs — activate, remove, list, and scaffold technology-specific conventions for AI coding agents. Use when developers want to select a stack, set up conventions, or manage pack lifecycle.

The file

Show its rules and text

We split this skill into the rules it gives an agent

55 rules. About 0 are common, 19 are distinctive, and 36 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈19

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 36

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Check that stacks/{pack-name}/ exists as a directory.

    line 32
  2. Very specific:

    Check that stacks/{pack-name}/STACK.md exists and is non-empty.

    line 33
  3. Distinctive:

    If the directory or STACK.md does not exist, display the error:

    line 34
  4. Very specific:

    Read .aod/stack-active.json if it exists.

    line 47
  5. Very specific:

    If another pack is active (the pack field differs from {pack-name}):

    line 48
  6. Distinctive:

    If the user declines, stop.

    line 51
  7. Very specific:

    If the user confirms, execute full deactivation: a.

    line 52
  8. Very specific:

    If the same pack is already active (pack field equals {pack-name}):

    line 55
  9. Distinctive:

    If the user confirms, proceed (this refreshes rules from the pack source).

    line 59
  10. Distinctive:

    Before proceeding, check for inconsistencies:

    line 63
  11. Very specific:

    If .aod/stack-active.json exists but is not valid JSON:

    line 65
  12. Very specific:

    Delete all files in .claude/rules/stack/.

    line 68
  13. Very specific:

    If .aod/stack-active.json exists but references a pack directory that does not exist under stacks/:

    line 72
  14. Very specific:

    If .claude/rules/stack/ contains files but .aod/stack-active.json does not exist:

    line 80
  15. Very specific:

    Ensure the directory .claude/rules/stack/ exists (create it if missing).

    line 89
  16. Very specific:

    If either directory is empty or does not contain .md files, note this in the activation summary but do not treat it as an error.

    line 95
  17. Very specific:

    Create the file .claude/rules/stack/persona-loader.md with the following content (substitute {pack-name} with the actual pack name):

    line 100
  18. Very specific:

    Write the file .aod/stack-active.json with this exact structure:

    line 138
  19. Very specific:

    Use the current UTC time for activated_at (e.g., 2026-02-27T14:30:00Z).

    line 148
  20. Distinctive:

    After writing all files, check the context budget:

    line 152
  21. Distinctive:

    Consider splitting into STACK.md and STACK-EXTENDED.md."

    line 163
  22. Very specific:

    If .aod/stack-active.json is not valid JSON:

    line 204
  23. Very specific:

    If .aod/stack-active.json does not exist AND .claude/rules/stack/ is empty (or does not exist):

    line 231
  24. Very specific:

    Read .aod/stack-active.json to get the active pack name.

    line 235
  25. Very specific:

    Delete all files in .claude/rules/stack/ (including persona-loader.md).

    line 239
  26. Very specific:

    If the directory .claude/rules/stack/ is now empty, leave it (do not delete the directory itself).

    line 240
  27. Very specific:

    Delete the file .aod/stack-active.json.

    line 245
  28. Distinctive:

    Create the project structure from the active pack's scaffold templates.

    line 264
  29. Very specific:

    Read .aod/stack-active.json.

    line 268
  30. Very specific:

    Read the pack field to determine the active pack name.

    line 275
  31. Very specific:

    Check if stacks/{pack-name}/scaffold/ exists and contains files (not just .gitkeep).

    line 279
  32. Distinctive:

    If the scaffold directory does not exist or is empty, display:

    line 281
  33. Distinctive:

    If the target file exists, mark it as a conflict.

    line 297
  34. Distinctive:

    If no conflicts exist, skip to Step 4.

    line 298
  35. Distinctive:

    If conflicts exist, display the conflict list and prompt per-file:

    line 299
  36. Distinctive:

    abort: Stop scaffolding entirely.

    line 311
  37. Very specific:

    After scaffold files are copied, automatically resolve template placeholders in docs/ files.

    line 323
  38. Very specific:

    Scope boundary: Do NOT modify files outside the docs/ directory

    line 332
  39. Distinctive:

    Idempotent: If a file contains no placeholders (already resolved), it remains unchanged

    line 333
  40. Distinctive:

    If zero placeholders found, display: "Placeholder resolution: no placeholders found in docs/ files"

    line 342
  41. Distinctive:

    If no files were skipped, omit the "Skipped" section.

    line 361
  42. Very specific:

    Look for directories under stacks/ that contain a STACK.md file.

    line 371
  43. Very specific:

    If the stacks/ directory does not exist, display:

    line 372
  44. Very specific:

    If stacks/ exists but no subdirectory contains a STACK.md, display:

    line 380
  45. Very specific:

    If .aod/stack-active.json exists, read its pack field.

    line 394
  46. Very specific:

    If the file references a pack that does not exist under stacks/, display a warning: "WARNING: Active pack {pack-name} no longer exists in …

    line 395
  47. Very specific:

    If .claude/rules/stack/ has files but .aod/stack-active.json does not exist, display a warning: "WARNING: Orphaned rules found in …

    line 398
  48. Very specific:

    Read the STACK.md file.

    line 407
  49. Distinctive:

    If these fields cannot be found, use the first non-heading, non-empty paragraph after the title as the description.

    line 413
  50. Distinctive:

    Leave one blank line between pack entries.

    line 437
  51. Very specific:

    If no pack is active, omit the * prefix and (active) suffix from all entries.

    line 439
  52. Very specific:

    When use encounters a STACK.md that is empty:

    line 457
  53. Very specific:

    Do NOT modify any files in .claude/agents/ — persona supplements are additive context, not replacements.

    line 495
  54. Distinctive:

    Do NOT register stack-specific skills (FR-002 skill registration is deferred).

    line 496
  55. Distinctive:

    Only ONE pack can be active at a time.

    line 498

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Stack Pack Management Skill

Activate, list, and manage stack packs that encode technology-specific conventions, security patterns, and agent persona supplements into AOD.

Subcommands

CommandPurpose
/aod.stack use {pack-name}Activate a stack pack
/aod.stack listShow available packs and active status
/aod.stack removeDeactivate the active pack
/aod.stack scaffoldScaffold project structure from the active pack

/aod.stack use {pack-name}

Activate a stack pack by copying its rules, generating a persona loader, and persisting activation state.

Step 1: Validate the pack exists

  1. Check that stacks/{pack-name}/ exists as a directory.
  2. Check that stacks/{pack-name}/STACK.md exists and is non-empty.
  3. If the directory or STACK.md does not exist, display the error:
    Pack not found: {pack-name}
    
    Available packs:
      - {list each directory under stacks/ that contains a STACK.md}
    
    Use: /aod.stack use {pack-name}
    Then stop.

Step 2: Handle already-active pack

  1. Read .aod/stack-active.json if it exists.
  2. If another pack is active (the pack field differs from {pack-name}):
    • Prompt the user: "Pack {current-pack} is currently active. Switch to {pack-name}? This will deactivate {current-pack} first. (y/n)"
    • If the user declines, stop.
    • If the user confirms, execute full deactivation: a. Delete all files in .claude/rules/stack/. b. Delete .aod/stack-active.json.
  3. If the same pack is already active (pack field equals {pack-name}):
    • Prompt: "Pack {pack-name} is already active. Re-activate to update rules and persona loader? (y/n)"
    • If the user declines, stop.
    • If the user confirms, proceed (this refreshes rules from the pack source).

Step 3: Detect and resolve inconsistent state

Before proceeding, check for inconsistencies:

  • If .aod/stack-active.json exists but is not valid JSON:
    • Warn: "Inconsistent state: .aod/stack-active.json is corrupted. Cleaning up stale state."
    • Delete all files in .claude/rules/stack/.
    • Delete .aod/stack-active.json.
    • Then continue with activation.
  • If .aod/stack-active.json exists but references a pack directory that does not exist under stacks/:
    • Warn: "Inconsistent state: .aod/stack-active.json references pack {missing-pack} which no longer exists. Cleaning up stale state."
    • Delete all files in .claude/rules/stack/.
    • Delete .aod/stack-active.json.
    • Then continue with activation.
  • If .claude/rules/stack/ contains files but .aod/stack-active.json does not exist:
    • Warn: "Inconsistent state: .claude/rules/stack/ has files but no activation state. Cleaning up orphaned rules."
    • Delete all files in .claude/rules/stack/.
    • Then continue with activation.

Step 4: Copy stack rules and agent supplements

  1. Ensure the directory .claude/rules/stack/ exists (create it if missing).
  2. Copy every .md file from stacks/{pack-name}/rules/ to .claude/rules/stack/.
  3. Copy every .md file from stacks/{pack-name}/agents/ to .claude/rules/stack/, prefixing each filename with agent- to avoid collisions (e.g., tester.md → agent-tester.md).
  4. If either directory is empty or does not contain .md files, note this in the activation summary but do not treat it as an error.

Step 5: Generate persona-loader.md

Create the file .claude/rules/stack/persona-loader.md with the following content (substitute {pack-name} with the actual pack name):

# Stack Pack Persona Loader

When you are a **specialized** or **hybrid** agent, read your persona supplement
from the active stack pack before executing any task.

## Active Pack: {pack-name}

## Agent Tier Classification

**Core agents** (product-manager, architect, team-lead, orchestrator,
web-researcher): You are stack-agnostic. Do NOT read persona supplements.
Ignore this file entirely.

**Specialized agents** (frontend-developer, senior-backend-engineer,
security-analyst, tester, code-reviewer, devops): Read your persona
supplement from `stacks/{pack-name}/agents/{your-agent-name}.md` as
supplementary context before executing any task.

**Hybrid agents** (ux-ui-designer, debugger): Read your persona supplement
from `stacks/{pack-name}/agents/{your-agent-name}.md` for stack-specific
tooling context before executing any task.

## Instructions

1. Determine your agent name (e.g., `frontend-developer`).
2. Check if `stacks/{pack-name}/agents/{your-agent-name}.md` exists.
3. If it exists, read it and apply its conventions, anti-patterns, and
   guardrails to all outputs in this session.
4. If it does not exist, proceed with your core expertise only.
5. Do NOT modify your core behavior — persona supplements are additive context.

Step 6: Write activation state

Write the file .aod/stack-active.json with this exact structure:

{
  "pack": "{pack-name}",
  "activated_at": "{current ISO 8601 timestamp}",
  "version": "1.0"
}

Use the current UTC time for activated_at (e.g., 2026-02-27T14:30:00Z).

Step 7: Validate context budget

After writing all files, check the context budget:

  1. Count the number of lines in stacks/{pack-name}/STACK.md.
  2. Count the number of persona supplement files in stacks/{pack-name}/agents/ and the line count of each.
  3. Count the total lines across all files copied to .claude/rules/stack/ (including the generated persona-loader.md).
  4. Compute total pack overhead = STACK.md lines + max persona supplement lines
    • total rules lines.
  5. Warn if any threshold is exceeded:
    • STACK.md > 500 lines: "WARNING: STACK.md is {N} lines (limit: 500). Consider splitting into STACK.md and STACK-EXTENDED.md."
    • Any persona file > 100 lines: "WARNING: {filename} is {N} lines (limit: 100). Brevity forces precision."
    • Total pack overhead > 800 lines: "WARNING: Total pack context is {N} lines (limit: 800). Agent performance may degrade."

Step 8: Display activation summary

Display the following output, filling in actual values:

Stack pack activated: {pack-name}

Rules loaded:
  - .claude/rules/stack/{rule1}.md
  - .claude/rules/stack/{rule2}.md
  - .claude/rules/stack/persona-loader.md

Agent supplements available for:
  - {comma-separated list of .md filenames in stacks/{pack-name}/agents/,
    without the .md extension}

Context budget:
  - STACK.md: {N} lines (limit: 500)
  - Persona supplements: {count} files (<=100 lines each)
  - Stack rules: {N} lines (limit: 200)
  - Total pack overhead: {N} lines (limit: 800)

Run /aod.stack scaffold to create the project structure.

/aod.stack remove

Deactivate the currently active pack, removing all stack-specific rules and state.

Step 1: Detect and resolve inconsistent state

Before proceeding, check for inconsistencies:

  • If .aod/stack-active.json is not valid JSON:
    • Warn: "Inconsistent state: .aod/stack-active.json is corrupted. Cleaning up all stack state."
    • Delete all files in .claude/rules/stack/.
    • Delete .aod/stack-active.json.
    • Display: "Stack state cleaned. No pack is active."
    • Then stop.
  • If .aod/stack-active.json exists but references a pack directory that does not exist under stacks/:
    • Warn: "Inconsistent state: .aod/stack-active.json references pack {missing-pack} which no longer exists. Cleaning up stale state."
    • Delete all files in .claude/rules/stack/.
    • Delete .aod/stack-active.json.
    • Display: "Stale state cleaned. No pack is active."
    • Then stop.
  • If .claude/rules/stack/ contains files but .aod/stack-active.json does not exist:
    • Warn: "Inconsistent state: .claude/rules/stack/ has files but no activation state. Cleaning up orphaned rules."
    • Delete all files in .claude/rules/stack/.
    • Display: "Orphaned rules cleaned. No pack is active."
    • Then stop.

Step 2: Check for active pack

  1. If .aod/stack-active.json does not exist AND .claude/rules/stack/ is empty (or does not exist):
    • Display: "No stack pack is currently active."
    • Then stop.
  2. Read .aod/stack-active.json to get the active pack name.

Step 3: Remove stack rules

  1. Delete all files in .claude/rules/stack/ (including persona-loader.md).
  2. If the directory .claude/rules/stack/ is now empty, leave it (do not delete the directory itself).

Step 4: Delete activation state

Delete the file .aod/stack-active.json.

Step 5: Display deactivation summary

Stack pack removed: {pack-name}

Cleaned:
  - .claude/rules/stack/ (emptied)
  - .aod/stack-active.json (deleted)

Implementation agents reverted to generic behavior.
Previously scaffolded project files remain untouched.

/aod.stack scaffold

Create the project structure from the active pack's scaffold templates.

Step 1: Check for active pack

  1. Read .aod/stack-active.json. If it does not exist, display:
    No stack pack is active.
    
    Activate a pack first: /aod.stack use {pack-name}
    Then stop.
  2. Read the pack field to determine the active pack name.

Step 2: Scan scaffold templates

  1. Check if stacks/{pack-name}/scaffold/ exists and contains files (not just .gitkeep).
  2. If the scaffold directory does not exist or is empty, display:
    No scaffold templates found for pack: {pack-name}
    
    The pack does not include project scaffolding.
    Then stop.
  3. Build a list of all files in stacks/{pack-name}/scaffold/ (recursively), preserving their relative paths from scaffold/.

Step 3: Detect conflicts

For each scaffold file, check if the target path already exists at the project root:

  1. Compute the target path: project root + relative path from scaffold/.
  2. If the target file exists, mark it as a conflict.
  3. If no conflicts exist, skip to Step 4.
  4. If conflicts exist, display the conflict list and prompt per-file:
    Scaffold conflicts detected:
    
      - {file1} (exists)
      - {file2} (exists)
    
    For each conflict:
    For each conflicting file, prompt: "Overwrite {file}? (y/n/abort)"
    • y: Overwrite the file with the scaffold version.
    • n: Skip the file (keep existing).
    • abort: Stop scaffolding entirely. Files already copied remain.

Step 4: Copy scaffold files

  1. For each non-conflicting file (and each conflict the user chose to overwrite): a. Ensure the parent directory exists (create if missing). b. Copy the file from stacks/{pack-name}/scaffold/{path} to the project root at {path}.
  2. Skip .gitkeep files — they are directory placeholders, not scaffold content.

Step 5: Placeholder Resolution

After scaffold files are copied, automatically resolve template placeholders in docs/ files.

  1. Baseline grep (per KB #22): Run grep -r '{{PROJECT_NAME}}\|{{CURRENT_DATE}}' docs/ to map all placeholder occurrences before replacement. Record the count for the summary.
  2. Source project name: a. Read .aod/memory/constitution.md and extract the project name from its heading or body b. If not found or file does not exist: fallback to git repo basename via basename $(git rev-parse --show-toplevel)
  3. Replace placeholders in docs/ files only:
    • Replace all {{PROJECT_NAME}} occurrences with the resolved project name
    • Replace all {{CURRENT_DATE}} occurrences with the current date in YYYY-MM-DD format
    • Scope boundary: Do NOT modify files outside the docs/ directory
  4. Idempotent: If a file contains no placeholders (already resolved), it remains unchanged
  5. Display summary:
    Placeholder resolution:
      Files modified: {count}
      Placeholders resolved: {total_count}
        - {{PROJECT_NAME}}: {count} → {resolved_name}
        - {{CURRENT_DATE}}: {count} → {resolved_date}
    If zero placeholders found, display: "Placeholder resolution: no placeholders found in docs/ files"

Step 6: Display scaffold summary

Project scaffolded from: {pack-name}

Created:
  - {file1}
  - {file2}
  - ...

Skipped (already exists):
  - {conflict1}
  - ...

Next: Install dependencies and start your development server.

If no files were skipped, omit the "Skipped" section.


/aod.stack list

Display all available stack packs with descriptions and active status.

Step 1: Scan for available packs

  1. Look for directories under stacks/ that contain a STACK.md file.
  2. If the stacks/ directory does not exist, display:
    No stack packs found.
    
    Create stacks/{pack-name}/STACK.md to get started.
    See specs/058-prd-058-stack/contracts/stack-md-format.md for the format spec.
    Then stop.
  3. If stacks/ exists but no subdirectory contains a STACK.md, display:
    No stack packs found.
    
    Pack directories exist but none contain a STACK.md convention contract:
      - {list directories without STACK.md}
    
    Create a STACK.md in a pack directory to register it.
    See specs/058-prd-058-stack/contracts/stack-md-format.md for the format spec.
    Then stop.

Step 2: Read active pack state

  1. If .aod/stack-active.json exists, read its pack field.
  2. If the file references a pack that does not exist under stacks/, display a warning: "WARNING: Active pack {pack-name} no longer exists in stacks/. Run /aod.stack remove to clean up stale state."
  3. If .claude/rules/stack/ has files but .aod/stack-active.json does not exist, display a warning: "WARNING: Orphaned rules found in .claude/rules/stack/ with no activation state. Run /aod.stack remove to clean up."

Step 3: Extract pack descriptions

For each pack directory containing a STACK.md:

  1. Read the STACK.md file.
  2. Find the first # heading (the pack title line, e.g., # Next.js Supabase Stack).
  3. Extract the Stack field value from the Summary section (the line starting with **Stack**:) to use as the technology tagline.
  4. Extract the Use Case field value from the Summary section (the line starting with **Use Case**:) to use as the description.
  5. If these fields cannot be found, use the first non-heading, non-empty paragraph after the title as the description.

Step 4: Display formatted list

Display the list using this format:

Available Stack Packs:

  * {active-pack-dir-name} (active)
    {Stack field value — e.g., Next.js . TypeScript . Supabase . Prisma . Vercel}
    {Use Case field value — e.g., Full-stack web applications with auth, database, and deployment}

    {other-pack-dir-name}
    {Stack field value}
    {Use Case field value}

Use: /aod.stack use {pack-name}

Rules:

  • Prefix the active pack with * and append (active).
  • Indent non-active packs at the same level but without the * prefix.
  • Leave one blank line between pack entries.
  • Sort packs alphabetically by directory name.
  • If no pack is active, omit the * prefix and (active) suffix from all entries.

Error Handling (all subcommands)

Inconsistent state detection

Apply these checks at the start of use, list, remove, and scaffold:

ConditionAction
.aod/stack-active.json exists but its pack field references a directory not in stacks/Warn user, suggest /aod.stack remove
.claude/rules/stack/ has .md files but .aod/stack-active.json does not existWarn user about orphaned rules, suggest /aod.stack remove
.aod/stack-active.json is not valid JSONWarn user, suggest deleting the file manually and re-activating

Pack validation errors

When use encounters a STACK.md that is empty:

Invalid pack: stacks/{pack-name}/STACK.md is empty.

A valid STACK.md requires at minimum a Summary section.
See specs/058-prd-058-stack/contracts/stack-md-format.md for the format spec.

Agent Tier Reference

Used by the persona-loader.md and context budget calculations.

TierAgentsPack Behavior
Coreproduct-manager, architect, team-lead, orchestrator, web-researcherNever modified by packs
Specializedfrontend-developer, senior-backend-engineer, security-analyst, tester, code-reviewer, devopsPersona supplements loaded
Hybridux-ui-designer, debuggerUniversal methodology + stack tooling supplement

File Paths Reference

FilePurposeCommitted
stacks/{pack}/STACK.mdConvention contractYes
stacks/{pack}/agents/*.mdPersona supplementsYes
stacks/{pack}/rules/*.mdSource rulesYes
stacks/{pack}/scaffold/**Project template filesYes
.claude/rules/stack/*.mdRuntime rules (copied on activation)No (gitignored)
.claude/rules/stack/persona-loader.mdGenerated persona loading instructionsNo (gitignored)
.aod/stack-active.jsonActivation stateNo (gitignored)

Constraints

  • Do NOT modify any files in .claude/agents/ — persona supplements are additive context, not replacements.
  • Do NOT register stack-specific skills (FR-002 skill registration is deferred).
  • Core agent files are NEVER modified by pack activation.
  • Only ONE pack can be active at a time.
  • Pack removal does NOT affect scaffolded project files — removal only cleans agent context, not user code.
  • Governance behavior (Triad reviews, lifecycle stages, sign-offs) is identical with or without an active pack.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.