agentleFS
aaziraniaazirani/flutter_agentify/.agents/skills/approval-and-safety/SKILL.md

approval-and-safety

Skill0 starsChanged 4 days agoMITView on GitHub

Which actions ask the person first, how the UI, the assistant and the CLI differ, which actions the assistant must never see, and what the assistant hears after a rejection. Use when writing an action that deletes, changes much at once, or touches secrets.

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 0 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Don't load this for how to write an action in general.

    line 8
  2. Very specific:

    Don't add a "are you sure?" step in the chat.

    line 29
  3. Very specific:

    Keep the confirm dialog in the screen (_confirmDelete in lib/presentation/home/home_screen.dart).

    line 31
  4. Very specific:

    Test it like test/actions/delete_item_test.dart: requiresApproval, refused without approval, works with approved: true, works for the UI, …

    line 34

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

Approval and safety

Don't load this for how to write an action in general; see actions.

Rule

  • needsApproval returns true for deletes, bulk changes and anything irreversible (DeleteItem and DeleteItems in lib/domain/actions/items_actions.dart).
  • Anything destructive also sets bool get allowAlways => false, so the card offers no "Always allow" and every call asks again.
  • Give such an action an approvalSummary(input): one line the person reads on the card, such as the title of the item a delete removes (DeleteItem.approvalSummary; DeleteItems lists the first five titles).
  • update_item clearing a description is allowed without approval: it is one field of one item, and the receipt and the returned item show the change.
  • The UI is never paused by approval, so a screen keeps its own confirm dialog.
  • The action CLI needs --approved for such actions.
  • An action touching secrets or the model setup is UI-only: bool get agentTool => false (SetApiKey, SetAssistantProvider and ResetApprovals in lib/domain/actions/settings_actions.dart).

Enforced by the registry's approval gate, tested in test/actions/delete_item_test.dart (a call without approval fails with approval_required and changes nothing). The agentTool flag has no test of its own, and no check decides which actions deserve approval.

Why

The registry lets Caller.ui through run (the person pressed the button; call with JSON input refuses it) but refuses Caller.assistant and Caller.cli unless approved. For the assistant, the run pauses and the app shows an approval card. A hidden action cannot be called by a confused or misled model, so keys never pass through the chat.

How

  • Make needsApproval(input) depend on the input when only some calls are risky; return true when unsure.
  • Don't add a "are you sure?" step in the chat. The system prompt in assets/assistant/instructions.md tells the assistant to call delete_item right away and let the card ask.
<!-- @example:begin -->
  • Keep the confirm dialog in the screen (_confirmDelete in lib/presentation/home/home_screen.dart). It is the UI's own safeguard.
<!-- @example:end --><!-- @empty: - Keep the confirm dialog in the screen (see `_confirmDelete` in .agents/example/lib/presentation/home/home_screen.dart). It is the UI's own safeguard. -->
  • Test it like test/actions/delete_item_test.dart: requiresApproval, refused without approval, works with approved: true, works for the UI, the summary and allowAlways.
  • With the CLI: dart run tool/action.dart <action_name> '<json>' --approved.

After a rejection. The model gets {"error":"declined","message":"The user declined this action."}, and the core rules tell it to stop or change its plan, not repeat the call. Nothing runs and no receipt is written. Your instructions should say what to tell the person ("leave the item and say so"). Approving with "always" is stored in ApprovalPrefs; the app persists it in lib/data/repositories/prefs_approval_prefs.dart. Settings has "Ask again before every action", which runs the UI-only reset_approvals and clears them all.

Anti-patterns

  • A delete or bulk action without needsApproval, or with allowAlways left true.
  • Removing the UI's confirm dialog because "the registry asks".
  • Giving the assistant an action that takes or returns a key.
  • Asking for approval in the chat text instead of calling the action.
  • Retrying a declined call.

Verification

  • flutter test test/actions/<action_name>_test.dart, and the same shape for each new risky action.
  • The parity test requires that test file to exist.
  • tool/check.sh ends with All checks passed.
  • Further reading: dart run flutter_agentify_core:docs --query "needs approval".

Related skills

  • actions — the flags and the rest of the action contract.
  • app-context — what the model is shown, which must hold no secrets.
  • adding-a-feature — where approval fits in the checklist.
  • secrets — why keys never reach the model.
  • edit-boundaries — what a coding agent may change without asking.

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.