入门
如何写好需求
Codexe 需求中应包含哪些内容,并附有插件、模组、数据包、机器人和网站的好坏示例。
更新于
需求是影响结果质量的最大单一因素。AI 只能构建它能推断出来的东西,所以具体的需求胜过冗长的需求。
#应该包含什么
- 平台和版本。 “Paper 1.21.4”、“Fabric 1.20.1 版”、“1.21.1 的数据包”、“discord.py”。
- 行为。 一步一步会发生什么,包括出错时会发生什么。
- 命令和参数。
/home <name>、谁可以运行它们,以及显示的消息。 - 权限。 权限节点名称和默认值。
- 配置。 服主应该能修改哪些内容。
- 存储。 内存、YAML 文件、SQLite 还是 MySQL,以及重启后是否保留。
- 集成。 Vault、PlaceholderAPI、LuckPerms、WorldGuard。请明确写出它们的名字。
- 界面。 聊天消息、GUI(物品栏菜单)、计分板、Boss 栏。
- 边界情况。 离线玩家、物品栏已满、被禁用的世界、重载。
#不好的写法与更好的写法
不好: make a factions plugin
更好:
A Paper 1.21.x factions plugin.
- /f create <name>, /f invite <player>, /f join <name>, /f leave, /f disband (owner only).
- Max 10 members per faction (configurable).
- Chunk claiming with /f claim and /f unclaim; claimed chunks block building by non-members.
- Faction power: +1 per online member, claims limited to power x 2.
- Data saved to SQLite, loaded on startup.
- Vault economy: creating a faction costs 1000 (configurable).
- Permissions: factions.use (default true), factions.admin (op) for /f admin bypass.不好: a mod with new swords
更好:
A Fabric mod for Minecraft 1.20.1.
- Adds three swords: Ember Blade (sets targets on fire for 3s), Frost Edge (Slowness II for 2s), Void Cutter (5% chance to teleport the target 8 blocks).
- Crafting recipes using blaze rods, packed ice and ender pearls with a netherite sword.
- English lang file and item models (textures can be placeholders).
- No client-only code on the server side.不好: custom recipes
更好:
A datapack for Minecraft 1.21.1.
- Shaped recipe: 8 rotten flesh around a leather = 1 leather.
- Shapeless recipe: 9 nether wart = 1 nether wart block, and the reverse.
- A function that runs every tick and gives Speed I to players standing on gold blocks.不好: moderation bot
更好:
A discord.py bot with slash commands.
- /warn <user> <reason>: stores warnings in SQLite, DMs the user.
- /warnings <user>: lists warnings with dates.
- /timeout <user> <minutes> <reason>: applies a Discord timeout; only for members with Moderate Members.
- Logs every action to a channel set with /setlog.
- Token read from an environment variable.#大型项目:分步构建
不要把一份包含五十个功能的规格一次性贴进一个需求里。先从核心部分开始(数据模型、主要命令),让 Codexe 验证,然后在后续消息中逐步添加功能。每一步都更小、更便宜、经过验证,也更容易纠正。
#优化提示词
在创建页面(创建项目),优化提示词按钮会把一个粗略的需求改写得更完整。它固定花费 5,000 个 token。生成之前一定要读一遍优化后的文本:它可能会假设一些你不想要的细节。
#说明你不想要什么
“不要数据库,所有东西都放在 config.yml 里”、“不要使用 NMS”、“不要外部依赖”。这些约束能防止 AI 选择你用不了的方案。