‹ 首页

intraweb-framework

@delphicleancode · 收录于 1 周前

Guides and standards for using the Intraweb stateful web framework in Delphi projects.

适合你,如果正在用Intraweb框架构建Delphi Web项目

/ 下载安装
intraweb-framework.skill双击,或拖进 Claude 桌面版 / Cowork,即完成安装↓ .skill↓ .zip
用别的 agent?下载 .zip 解压,把文件夹放进它的技能目录
Claude Code~/.claude/skills/(项目级 .claude/skills/)
Codex CLI~/.codex/skills/
Cursor自动读取上面两处目录
其他工具见其文档的「skills」目录;两个下载是同一份文件,只是名字不同
/ 通过 npx 安装 校验哈希
npx oh-my-skill add delphicleancode/delphi-spec-kit/intraweb-framework
/ 通过 bash 安装
curl -fsSL https://oh-my-skill.com/install.sh | bash -s -- delphicleancode/delphi-spec-kit/intraweb-framework
/ 已经装过?验证本机副本,不用重装
npx oh-my-skill verify delphicleancode/delphi-spec-kit/intraweb-framework
安装目标可用 --agent / --scope 或 --to 明确指定;省略时只会在唯一已存在的 agent 目录上自动选择,零命中或多命中会停止并提示。content_hash 缺失或不一致均拒装。
43GitHub stars
~708上下文体积 · 单文件
镜像托管

怎么用

技能原文 SKILL.md作者撰写 · MIT · 9f7fc31

Intraweb Framework - Spec-Kit

Intraweb is a VCL-for-the-Web framework that allows you to create stateful business web applications in a semantic way similar to creating Desktop applications. When dealing with Intraweb in Copilot or your project, consider the following best practices to ensure maintainability and scalability.

1. Sessions (UserSession) and Global Variables

Golden Rule: Do not use classic unit var global variables or Singleton instances for user data, since Intraweb applications run in a Multithread environment with concurrent sessions (each user has their own).

  • To maintain user-specific data, strictly use the UserSessionUnit.pas unit (ServerController.UserSession Instance).
//❌ BAD: Incorrect Usage (Global scope variable serves all sessions, Multithreading problem)
var
  LCustomerId: Integer;

//✅ GOOD: Correct Usage (Safe properties of the current context)
UserSession.CustomerId := 10;
2. ServerController and Configuration

The global system parameters, database connection pool and initializations that do not depend on the user must be resolved in the ServerController (IWServerController.pas) object. Avoid injecting heavy dependencies and direct database scopes in TIWAppForm.

3. Non-Blocking User Interfaces (Asynchronous Callbacks)

In the web context, you should not use blocking code to "wait" for the user, such as ShowMessage, InputBox, or classic VCL ModalResults calls that rely on code locking on the same line.

  • Use the OnAsyncClick property for DOM updates without full-screen postback.
  • In Intraweb version 15 or newer, explore the capabilities of WebApplication.ShowMessage combined with Ajax calls and safe web interface interrupts.
//❌ BAD: Blocking the thread on the Intraweb
procedure TIWForm1.iwBtnSaveClick(Sender: TObject);
begin
  if Application.MessageBox('Deseja salvar?', 'Confirme', MB_YESNO) = IDYES then
    //Rescue code
end;

//✅ GOOD: Using Ajax Async from Intraweb
procedure TIWForm1.iwBtnSaveAsyncClick(Sender: TObject; EventParams: TStringList);
begin
  WebApplication.ShowMessage('Registro Salvo via Callback Assíncrono!', smAlert);
end;
4. Separation of Rules and UI

It is easy to build monstrous projects on the Intraweb by grouping the entire system rule behind the click (ex: num iwBtnProcessarAsyncClick). Follow the SRP (Single Responsibility Principle) principles:

  • The form maps to the Controller request and re-renders components. The rules remain in the Application/Services layer.
  • An Application/Service or Repository layer that is used in the Intraweb cannot couple or know the IWApplication unit (do not use WebApplication.ShowMessage among persistence Services).
5. Naming of Visual Components (Intraweb Prefixes)

Use iw concatenated with the native typologies:

  • TIWButton -> iwBtnSave
  • TIWEdit -> iwEdtName
  • TIWLabel -> iwLblTitle
  • TIWComboBox -> iwCmbStatus
  • TIWGrid -> iwGrdItems
  • TIWRegion -> iwRegContainer
6. Dynamic HTML and Custom CSS

Despite being VCL-like, the massive stylizations in the components create large DOMS in the interface. Prefer to define external CSS files using ExtraHeader injection in the form and apply the Css property to the tags of the T visual components TIW* instead of manually painting the color of buttons and fonts via the Object Inspector.

按 MIT 许可原样转载,未经改动 · 在 GitHub 查看 →

评论

登录即可评论;带「已验证安装」的,是发布者名下有本店的安装或持有记录。