Install
openclaw skills install token-saver-for-programmerLosslessly minify code, compress logs, clean configs and optimize prompts. Reduce token usage 40%~60% without losing logic.
openclaw skills install token-saver-for-programmerA professional AI helper for developers to cut token consumption efficiently.
Send code, logs, configs or prompts directly. The skill will activate automatically.
/token-saver-for-programmer [your content]
Best for: Cursor / Claude Code / Copilot / Gemini CLI — all AI coding tools.
This skill automatically compresses and rewrites code, logs, configs and prompts. It may omit subtle details or change conditional expressions in edge cases. Always compare and review the optimized output before applying it to projects, debugging or formal prompts. Do not assume the transformation is strictly lossless.
# User login interface
# Author: xxx
# Date: 2026-05-08
def user_login(username, password):
# Check username
if username == None or username.strip() == "":
return {"code": 400, "msg": "Username cannot be empty"}
# Check password
if password == None or password.strip() == "":
return {"code": 400, "msg": "Password cannot be empty"}
# Query user info
user_info = db.query_user(username)
if not user_info:
return {"code": 404, "msg": "User not found"}
# Check password
if user_info["pwd"] != password:
return {"code": 401, "msg": "Wrong password"}
# Generate token
token = generate_token(user_info["id"])
return {"code": 200, "data": token, "msg": "Login success"}
def user_login(username, password):
if not username or username.strip() == "":
return {"code":400,"msg":"Username cannot be empty"}
if not password or password.strip() == "":
return {"code":400,"msg":"Password cannot be empty"}
user_info = db.query_user(username)
if not user_info:
return {"code":404,"msg":"User not found"}
if user_info["pwd"] != password:
return {"code":401,"msg":"Wrong password"}
token = generate_token(user_info["id"])
return {"code":200,"data":token,"msg":"Login success"}
2026-05-08 10:20:35.123 INFO [main] StartupInfo - Service starting...
2026-05-08 10:20:36.456 INFO [main] ConfigLoader - Loading config application.yml
2026-05-08 10:20:38.789 ERROR [http-nio-8080-exec-3] com.service.UserService - Business exception
java.lang.NullPointerException: Cannot invoke method getUserId() on null object
at com.service.UserService.login(UserService.java:45)
at com.controller.UserController.login(UserController.java:22)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Error: NullPointerException
Message: Cannot invoke method getUserId() on null object
Key code lines:
com.service.UserService.login(UserService.java:45)
com.controller.UserController.login(UserController.java:22)
I am writing an API with Python. It works fine locally, but shows CORS error after deploying to the server. I have already modified the configuration file and added CORS annotations, but it still does not work. Please help me analyze possible causes and solutions.
Python API works locally but reports CORS on server. Config modified & CORS annotations added, still not working. Need causes and fix solutions.