lark-cli
Lark CLI (larksuite/cli)
Overview
Use this skill to help the user work through a local lark-cli installation from inside NextClaw.
This skill is intentionally decoupled:
- The skill owns explanation, onboarding, readiness checks, workflow choice, risk handling, and permission clarity.
- The
lark-clibinary owns actual execution against the Lark/Feishu Open Platform APIs.
From the user’s point of view, the experience should feel complete:
- install the CLI (and optionally upstream skill assets when needed),
- configure app credentials and complete OAuth,
- verify readiness with observable commands,
- then run the real task.
Do not pretend the environment is ready when it is not. Treat browser completion, terminal success text, and real readiness as three separate things. Only observable CLI checks count as success.
Install Boundary: Upstream CLI vs NextClaw Skill
Always distinguish these three things before taking action:
@larksuite/cli/lark-clibinary install:npm install -g @larksuite/cli- NextClaw runtime skill install:
the selectable skill must exist at
<workspace>/skills/lark-cli/SKILL.md - This repo's source skill:
skills/lark-cli/SKILL.mdinside the NextClaw repository
NextClaw loads skills from the workspace skills/ directory, not from npm global Agent Skill locations.
Default NextClaw workspace:
~/.nextclaw/workspace
So the default installed skill path is:
~/.nextclaw/workspace/skills/lark-cli/SKILL.md
If the user wants the skill installed into a specific project or workspace, install it with an explicit workdir:
nextclaw skills install lark-cli --workdir <workspace>
Do not treat this upstream command as a NextClaw skill install:
npx skills add larksuite/cli -y -g
That upstream command installs upstream Agent Skill assets globally. It does not put the skill into NextClaw's <workspace>/skills/ directory, so it does not make the skill selectable inside NextClaw by itself.
Deterministic Integration Recipe
When the user says "help me connect Feishu/Lark in NextClaw" or "make this skill actually work", follow this exact order and do not skip steps.
Step 0: Verify the NextClaw side first
Check the real NextClaw workspace path before touching lark-cli.
- Default workspace:
~/.nextclaw/workspace - Expected installed skill file:
<workspace>/skills/lark-cli/SKILL.md
If the user says they already installed the skill, verify that file exists. If it does not exist, install it with:
nextclaw skills install lark-cli --workdir <workspace>
Do not start debugging Feishu OAuth before this NextClaw-side path is confirmed.
Step 1: Verify the upstream CLI binary
Run:
command -v lark-cli
If it fails, check common Node bin locations before claiming the CLI is missing:
~/.nvm/versions/node/*/bin/opt/homebrew/bin/usr/local/bin
If lark-cli exists in one of those directories but is not on PATH, use a one-off PATH prefix for the current command session, for example:
PATH=$HOME/.nvm/versions/node/v22.16.0/bin:$PATH lark-cli --help
Only if the binary truly does not exist should you install it:
npm install -g @larksuite/cli
Step 2: Check current readiness before starting new flows
Run these first:
lark-cli config show
lark-cli auth status
lark-cli doctor
Interpret them in this order:
config showsays "Not configured yet" ordoctorshowsconfig_file=fail-> configuration is missing; go to Step 3auth statusshowsidentity: "bot"and "No user logged in" -> config exists but user login is missing; go to Step 4auth statusshowsidentity: "user"anddoctoris all pass -> environment is ready; go to Step 5
Do not start config init or auth login blindly before checking current state.
Step 3: Configure the app exactly once
Use the browser-based config flow:
lark-cli config init --new
For agent-style execution:
- run it once,
- capture the printed browser URL,
- send that URL to the user,
- keep the same process alive until it exits,
- then verify with
config showanddoctor.
Success means all of these are true:
- the original
config init --newprocess exits with code0 lark-cli config showdisplays a concreteappIdlark-cli doctorreportsconfig_file=passlark-cli doctorreportsapp_resolved=pass
Do not rerun config init --new just because the terminal is still waiting.
Do not treat "the user opened the page" as success.
Step 4: Log in as a user exactly once
Prefer the two-stage device flow:
lark-cli auth login --recommend --no-wait --json
This returns:
verification_urldevice_code
Then immediately start the single polling process:
lark-cli auth login --device-code <DEVICE_CODE>
Agent behavior must be:
- show
verification_urlto the user - start exactly one
--device-codepolling process - wait for that same process to finish
- then verify with
auth statusanddoctor
Success means all of these are true:
- the
--device-codeprocess exits with code0 lark-cli auth statusshowsidentity: "user"lark-cli auth statusincludes user info such asuserName/userOpenIdlark-cli doctorreportstoken_exists=passlark-cli doctorreportstoken_local=pass- ideally
lark-cli doctorreportstoken_verified=pass
If identity is still bot, the login is not done.
Do not launch multiple concurrent auth login sessions.
Step 5: Run one real read-only smoke command
After login succeeds, run at least one real API-backed read command before claiming the environment is usable.
Safe default:
lark-cli contact +get-user --format json
Success means:
- command exits
0 - output contains
"ok": true - output contains
"identity": "user" - output includes a real
open_idor user object
Only after this smoke step should the agent proceed to task-specific operations such as task/calendar/docs/mail/im/base actions.
One-Pass Checklist For Agents
Use this checklist literally:
- Confirm
<workspace>/skills/lark-cli/SKILL.mdexists. - Confirm
command -v lark-cliworks. - If not, repair PATH or install
@larksuite/cli. - Run
lark-cli config show. - Run
lark-cli auth status. - Run
lark-cli doctor. - If config missing, run one
lark-cli config init --newflow and wait. - If config exists but identity is
bot, run oneauth login --recommend --no-wait --jsonflow and one--device-codepolling process. - Verify
identity: "user"withauth status. - Verify token checks with
doctor. - Run
lark-cli contact +get-user --format json. - Only then execute the user’s actual Feishu/Lark task.
Do Not Do These Things
- Do not confuse "skill installed into NextClaw workspace" with "
lark-clibinary installed globally". - Do not use
npx skills add larksuite/cli -y -gas a NextClaw skill install step. - Do not start a second
config init --newwhile the first one is still waiting. - Do not start repeated
auth logincommands when one--device-codepolling process is already active. - Do not declare success from browser completion alone.
- Do not declare success from token existence alone if no read command has been tested.
- Do not skip
auth statusanddoctor.
What This Skill Covers
- Installation paths documented upstream (for example global npm install of
@larksuite/cli). - One-time app credential setup:
lark-cli config init(orlark-cli config init --newwhen a browser-based setup URL must be handed to the user). - Authentication:
lark-cli auth login(including--recommendwhen appropriate),lark-cli auth status, and scope-aware flows described in upstream docs. - Command discovery via
lark-cli --helpandlark-cli <service> --help. - Shortcuts (commands prefixed with
+), curated API commands, and rawlark-cli apicalls only as supported by the installed CLI version. - Security expectations: acting within granted OAuth scopes, dry-run where available, and explicit confirmation before high-impact writes.
What This Skill Does Not Cover
- Inventing subcommands, shortcuts, or API paths that do not appear in the installed CLI help or upstream documentation.
- Claiming tenant permissions, plan limits, or compliance posture the user’s app or admin policies do not allow.
- Silently bypassing missing app configuration or failed login.
- Silently triggering messaging sends, file uploads, deletions, permission changes, or other high-impact actions without explicit user confirmation when the situation calls for it.
- Treating Lark/Feishu platform behavior or third-party CLI output as native NextClaw behavior.
First-Use Workflow
When the user asks for a lark-cli-powered task, follow this order.
Before taking action, classify the environment into exactly one state and move only to the next state:
- CLI missing
- configured = no
- config in progress
- configured = yes, logged in = no
- login in progress
- ready
Do not start a second config or login flow while one is already in progress. Finish, verify, then continue.
1. Classify the task
Classify the task into one of these:
- read-only (list, view, search, export,
auth status, schema introspection), - write or side-effect (send messages, create/update/delete resources, share, permission changes),
- long-running or interactive (OAuth URL, device code, background polling).
If the task does not fit what the CLI exposes, say so clearly.
2. Check whether the CLI exists
Run:
command -v lark-cli
If missing, explain that the CLI must be installed locally first. Prefer the upstream-recommended global install:
npm install -g @larksuite/cli
After installation, continue with configuration and auth instead of jumping straight into the user task.
This step installs the upstream lark-cli binary only. It does not install the NextClaw lark-cli skill into the workspace.
3. Optional upstream skill bundle
Upstream documents installing additional Agent Skill files globally:
npx skills add larksuite/cli -y -g
Treat this as optional unless the user is following upstream tutorials that assume those files exist, or the CLI reports missing skill assets. Do not present it as a NextClaw marketplace replacement; it is an upstream packaging choice.
If the user's goal is "make lark-cli selectable in NextClaw", use nextclaw skills install lark-cli and verify <workspace>/skills/lark-cli/SKILL.md exists.
4. Configure app credentials
Guide the user through credential setup:
lark-cli config init
For agent-style flows where the process prints a URL and expects browser completion, use the non-interactive variant described upstream, for example:
lark-cli config init --new
For agent-style flows:
- run
lark-cli config init --newin the background, - extract the printed browser URL and send it to the user,
- wait for the process to exit before treating configuration as finished.
Config success gate:
- the process exits with code
0, and lark-cli config showshows a concreteappId, andlark-cli doctorshowsconfig_file=passandapp_resolved=pass.
If the browser page is opened but the command is still waiting, configuration is not finished yet.
If config init --new succeeds once, do not immediately rerun it unless config show or doctor proves config is still missing or broken.
5. Log in
Prefer the non-looping agent pattern:
lark-cli auth login --recommend --no-wait --json
Then use the returned device_code to resume polling:
lark-cli auth login --device-code <DEVICE_CODE>
This keeps the flow explicit:
- first command returns the verification URL immediately,
- second command is the single polling process,
- and the agent can avoid repeatedly spawning fresh login sessions.
Login success gate:
- the polling command exits with code
0, and lark-cli auth statusshowsidentity: "user", andlark-cli doctorreportstoken_exists=pass,token_local=pass, and ideallytoken_verified=pass.
If login prints success text but auth status still shows identity: "bot", treat that as not ready. Do not continue to real user-scoped operations.
If a device-code session is already pending, do not restart auth login --recommend; continue or expire that session first.
6. Readiness check
Run:
lark-cli auth status
If this does not show a healthy authenticated state with the scopes needed for the task, do not proceed to the real operation yet. Diagnose config and login first.
Optional deeper checks include lark-cli auth check for a specific scope when the user’s task depends on one.
Readiness means all of these are true:
- config exists,
- current identity is the one required by the task,
- required scopes are present,
- and a lightweight read command for that domain succeeds when feasible.
Examples:
- Before task operations:
lark-cli auth statusandlark-cli auth check --scope "task:task:write" - Before message send: inspect help and do
--dry-runfirst if available - Before broad automation: prefer one narrow read command in the same domain
Observable Success Rules
Use these rules to avoid fake success and retry loops:
config init --newis successful only after the process exits andconfig showordoctorconfirms config is resolved.auth loginis successful only afterauth statussaysidentity: "user".- A write operation is successful only after the CLI returns a stable identifier or the resource can be fetched again.
- Do not treat “user opened the browser page” as success.
- Do not treat “command is still waiting” as a cue to start the same flow again.
- If a command returns a concrete resource id or guid, store and reuse that id for verification instead of relying on fuzzy search.
Safe Execution Rules
- Prefer read-only commands and schema inspection (
lark-cli schema,--dry-run) before mutating operations. - For sends, deletes, permission changes, org-wide visibility, or bulk updates, ask for explicit confirmation unless the user already gave a clear, scoped instruction covering that exact action.
- Prefer narrow domain flags (for example domain-limited login) when the user’s goal is limited to one surface.
- Use
--format jsonorndjsonwhen structured inspection reduces mistakes; usetableorprettywhen the user needs human-readable output. - If the user asks to relax security settings or bypass upstream defaults, refuse silently automating that path; surface upstream risk language and require explicit informed consent in the product channel, not inside the agent’s hidden defaults.
Task-specific rule:
task +get-my-tasksmeans “tasks assigned to me”, not “every task I created”.- A task created without
--assigneemay be retrievable bytask tasks getbut not appear in+get-my-tasks. - For task creation verification, prefer this sequence:
lark-cli task +create ... --format json
lark-cli task tasks get --params '{"task_guid":"<GUID>"}' --format json
- If the user wants the task to appear under “my tasks”, assign it explicitly to the current user with
--assignee <open_id>.
Privacy, Trust, And Compliance
This CLI can act on behalf of a logged-in user or bot identity within OAuth scopes. Surface that:
- Data may include messages, files, mail, calendar, contacts, and other tenant content.
- Mis-scoped automation can leak sensitive information or send messages to the wrong audiences.
- Upstream documentation includes security warnings; do not downplay them.
When the user is unsure, default to smaller scope, fewer recipients, and read-only verification first.
Troubleshooting
lark-cli not found
- Explain that Node/npm global install may be missing or not on
PATH. - Re-check with
command -v lark-cliafter install.
Skill installed to the wrong place
- If the user installed an upstream skill globally but NextClaw still cannot select it, verify the real NextClaw workspace path first.
- The success check is the file
<workspace>/skills/lark-cli/SKILL.md. - If the user is working in a project-specific workspace, reinstall with:
nextclaw skills install lark-cli --workdir <workspace>
- Do not claim success just because
npx skills add larksuite/cli -y -gfinished.
Config or auth errors
- Do not blindly rerun both config and login.
- First ask which state failed:
doctorsays config missing or unresolvedauth statussays bot only / not logged inauth statussays user but scope is insufficient- domain read/write command itself failed
- Re-run only the failed stage.
- Use
lark-cli auth statusandlark-cli auth scopesto compare granted scopes with the command’s needs. - If using agent mode, prefer
auth login --no-wait --jsonplusauth login --device-code ...over repeatedly launching fresh blocking login commands.
Repeated waiting or apparent loop
- If a
config init --neworauth login --device-codeprocess is already active, keep that single session as the source of truth. - If the user says they completed the browser step, poll the existing process and then verify with
config show,doctor, orauth status. - Only declare timeout or failure after the current session exits or the device code expires.
- Never stack multiple concurrent login attempts just because the terminal is still waiting.
Command not recognized
- Inspect
lark-cli --helpandlark-cli <service> --helpfor the installed version. - Do not guess shortcut names; confirm from help output.
Rate limits, permission denied, or tenant policy errors
- Treat these as platform or admin policy constraints, not as something to bypass inside NextClaw.
Success Criteria
The skill is working correctly when:
- the user understands that execution is performed by local
lark-cliagainst Lark/Feishu APIs under their app and tokens, - missing install, config, or login is identified before side effects,
lark-cli auth statusreflects readiness before high-trust tasks when feasible,- config success and login success are judged by observable CLI state rather than browser completion alone,
- the agent follows a single in-flight config/login session instead of spawning repeated retries,
- task or resource writes are verified by concrete ids or follow-up reads,
- destructive or broadcast actions wait for explicit confirmation when required,
- and the real task runs only after the environment is truly ready.
More from peiiii/nextclaw
ui-ux-pro-max
Use when the user wants professional UI/UX design guidance, design-system generation, UX review, or stack-specific frontend guidance through a bundled local UI/UX Pro Max dataset and Python search runtime.
2impeccable
Use when the user wants distinctive, production-grade frontend design, anti-generic AI aesthetics, UX critique, technical UI audits, or final polish through bundled Impeccable references and an optional upstream detector CLI.
2opencli
Use when the user wants to use websites, browser login sessions, Electron apps, or external CLIs through a local OpenCLI setup, especially when setup guidance, readiness checks, and safe task execution are needed.
1find-skills
Use when the user wants to discover, evaluate, and install external agent skills from the open skills ecosystem, especially through the Vercel Skills CLI.
1superpowers
Use when the user wants a disciplined software development workflow with design-first planning, implementation plans, TDD, systematic debugging, code review, or verification-before-completion, adapted from obra/superpowers.
1bb-browser
Use when the user wants browser-backed web data access, authenticated fetches, website adapters, or safe browser automation through a local bb-browser installation.
1