Cette page est affichée en anglais. Une traduction française est en cours.
CLI ToolsMay 12, 2026·2 min de lecture

code2prompt — Turn Repos into LLM-Ready Prompts

code2prompt ingests a codebase and outputs structured, token-aware prompts, helping you move from ad-hoc copy/paste to repeatable context engineering.

Prêt pour agents

Cet actif peut être lu et installé directement par les agents

TokRepo expose la commande CLI, le metadata JSON, le plan d'installation et le contenu raw pour aider les agents à juger l'adaptation, le risque et les prochaines actions.

Native · 94/100Policy : autoriser
Cible
Claude Code, Codex, Cursor
Type
Cli
Installation
Single
Confiance
Confiance : Established
Point d'entrée
code2prompt
Commande CLI d'installation
npx tokrepo install a87d4ee7-8374-4e00-a757-2422c617bc43 --target codex
Introduction

code2prompt ingests a codebase and outputs structured, token-aware prompts, helping you move from ad-hoc copy/paste to repeatable context engineering.

  • Best for: developers building agent workflows who need consistent, sharable repo context
  • Works with: any Git repo; outputs text you can paste into ChatGPT/Claude/Cursor/Codex
  • Setup time: 5–15 minutes

Practical Notes

  • Quant: run on 2 repos and compare output size (chars/tokens) before/after adding ignore rules.
  • Quant: keep a baseline prompt snapshot and diff it weekly to spot context drift.

Pattern: context as an artifact

Treat the generated prompt like a build artifact:

  • Check it into a scratch folder (or attach to PRs) when you need reproducibility.
  • Add ignore rules aggressively to keep noise down.
  • Prefer smaller, task-scoped prompts over one giant dump.

Agent workflow tip

Use code2prompt as a pre-step before:

  • running an agent to refactor,
  • generating docs,
  • or doing security review of changes.

If you record the prompt file, you can replay the same context across models and compare results.

FAQ

Q: Is this only a CLI? A: No. The repo describes a wider ecosystem, but the CLI alone is already useful for most workflows.

Q: How do I reduce prompt size? A: Add ignores and scope to a subdirectory; prioritize only the files needed for the task.

Q: Can I use it for reviews? A: Yes—generate a snapshot prompt and attach it to a PR so reviewers/agents share the same context.

🙏

Source et remerciements

Source: https://github.com/mufeedvh/code2prompt > License: MIT > GitHub stars: 7,342 · forks: 422

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires