agentleFS
ivanestarivanestar/eitr/.agents/skills/ast-template-engineer/SKILL.md

ast-template-engineer

Skill4 starsChanged 2 months agoApache-2.0View on GitHub

Protocol for safely modifying TypeScript AST templates, enforcing compilation checks and a strict two-strike fallback rule. Trigger on requests like "edit the template", "modify packages/engine/src/plan/templates", "update the AST generator".

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    After modifying > 0 lines in an AST template file, you MUST verify its syntax before proposing the change to the user or making a commit.

    line 19
  2. Distinctive:

    If the exit code is > 0, you MUST NOT proceed.

    line 22
  3. Distinctive:

    If your compilation check fails >= 2 times consecutively on the same file, you MUST abort the modification.

    line 26
  4. Very specific:

    DO NOT: use the multi_replace_file_content tool for template refactors if the string spans > 50 lines.

    line 32
  5. Very specific:

    DO NOT: remove existing ${} interpolation variables unless explicitly requested by the user.

    line 33

≈ “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

AST Template Engineer Skill

Purpose

This skill dictates how AI agents must modify TypeScript template literals (AST generators) inside the EITR engine. It guarantees that generated code templates remain syntactically valid TypeScript and prevents broken string interpolations.

Trigger this skill automatically whenever you modify > 0 files matching the path packages/engine/src/**/templates/*.ts.

Rules & Constraints

1. Mandatory Compilation Check

After modifying > 0 lines in an AST template file, you MUST verify its syntax before proposing the change to the user or making a commit.

  • Execute exactly: npm run typecheck (or npx tsc --noEmit <path-to-file>).
  • If the exit code is > 0, you MUST NOT proceed. You must read the error output and attempt a fix.

2. The Fallback Rule (Two-Strike Limit)

  • If your compilation check fails >= 2 times consecutively on the same file, you MUST abort the modification.
  • Execute exactly: git checkout -- <file> to revert the file to its last committed state.
  • Output exactly: "ABORT: Reverting due to unresolvable AST compilation error."

3. Boundary Constraints & Safety

  • DO NOT use the multi_replace_file_content tool for template refactors if the string spans > 50 lines. If modifying >50 lines, rewrite the specific AST node entirely.
  • DO NOT remove existing ${} interpolation variables unless explicitly requested by the user.

Examples

Good Example

1. Modified `packages/engine/src/plan/templates/playwright.ts`.
2. Executed `npm run typecheck`.
3. Received exit code 1 (Missing backtick on line 45).
4. Fixed the missing backtick.
5. Re-ran `npm run typecheck`. Received exit code 0.

Bad Example

1. I updated the template string for the Java generator.
2. The code looks correct to me, so I will commit it now.
   _(Violation: Did not run `npm run typecheck`. Relied on visual inspection instead of a deterministic compiler check.)_

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.