prompt-to-code
English | 中文
An Agent Skill that compiles the rules governing your coding agent — declared
ones (CLAUDE.md, AGENTS.md, style guides) and ones revealed in conversation
history — into deterministic enforcement written into your project's own
toolchain: lint rules, pre-commit entries, slash commands, each
shipped with a native test.
A remembered rule is a suggestion; a compiled check is a wall.
Why
Coding agents don't get better at collaborating over time: a preference stated
in one session is violated in the next. Memory gives the agent access to a
rule, but not compliance with it. Every time you repeat an instruction or
correct the same mistake, you are paying interest on a rule that was never
compiled. prompt-to-code moves rules from fluid prompts into solid code, so a
correction made once never needs to be restated.
How it works
One stateless pipeline. Two intakes, one shared backend. All artifacts land in
your project's native locations, under version control.
INTAKE declared rules (CLAUDE.md/AGENTS.md, default)
revealed rules (conversation history, opt-in — always asks first)
▼
SIGNAL is it a durable rule? (correction > repetition > one-off)
▼
CLASSIFY Tier A: native linter can check it → lint rule
Tier B: a deterministic tool can extract → ast-grep/semgrep/gitleaks/script
Tier C: irreducible judgment → stays a prompt, honestly
▼
COMPILE dedupe against existing config · pick backend on the reliability
ladder (reuse > generate > toolbelt > script) · generate rule + a
native test (≥1 pass, ≥1 fail) · self-test before writing
▼
EMIT write into native locations, wire into real config
(never auto-commits — the working-tree diff is the deliverable)
▼
ENFORCE pre-commit (primary wall — git-native, host-agnostic)
· CI if you already have it · failing checks re-prompt the agent
Key properties
- The skill is a compiler, not a runtime. Everything it writes — rules,
tests, hook wiring, even the engines (as your dev dependencies) — lives in
your project and survives uninstalling the skill. That is the acid test.
- Zero state. No registry, no config, no
.prompt-to-code/ directory.
The truth is the generated code and its git history. Re-runs stay safe via
semantic dedup against your current config.
- Honest about limits. Judgment rules ("keep functions cohesive") are
never faked as brittle regex proxies — they stay prompts.
- Every check ships with a native test (≥1 pass, ≥1 fail), placed with
your other tests. It validates the rule at generation time and detects
environment drift (linter upgrades, rule renames) forever after.
- Guardrails are code, not model discipline.
emit.py deterministically
refuses writes outside the project root, silent overwrites, and any content
matching a secret pattern. Conversation text is redacted at the intake
boundary before anything else sees it.
- Asks before the three decisions that are yours: introducing a new tool
dependency, resolving conflicts with human-set config, and appending mined
Tier C rules to CLAUDE.md (append-only, never edits existing lines).
Install
Via marketplace:
/plugin marketplace add nekocode/prompt-to-code-skill
/plugin install prompt-to-code
Local development / dog-fooding (no install needed):
cd /path/to/prompt-to-code-skill
claude --plugin-dir .
Compatibility
| Requirement | Version | Notes |
|---|
python3 | ≥ 3.9 | Standard library only, zero third-party deps. Works with the python3 preinstalled on stock macOS. On < 3.11 (no tomllib), pyproject.toml detection falls back to a header-only scan — same results for stack detection |
git | any modern release | The generated artifacts rely on git for review/rollback; the scripts themselves never touch it |
| Claude Code | any | Plugin format. Other agent hosts can consume the generated enforcement (it's ordinary project code) — only the /prompt-to-code entry point is Claude-Code-specific |
Use
Run the slash command in any project:
/prompt-to-code # default: compile declared rules (CLAUDE.md, AGENTS.md, ...)
/prompt-to-code also enforce "no print in src/" # extra rules for this run
/prompt-to-code history only # scope adjustments
/prompt-to-code warn severity for everything # target constraints
The optional arguments refine a single run — extra rules to compile, scope
("only Python", "skip history"), or target constraints ("as pre-commit only").
Invariants always hold: it never auto-commits, never silently overwrites, asks
before scanning history or adding a tool dependency.