Token导航 LogoToken导航TokenDH.com
研究检索操作浏览器github未标认证来源可访问许可证需确认审计通过

debugging-streamlit调试流线型

Agent Skill

debugging-streamlit 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

5,983

周安装

257

GitHub Stars

44,375

下载量

2,097
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:debugging-streamlit(调试流线型)
来源仓库:https://github.com/streamlit/streamlit
仓库路径:skills/debugging-streamlit
安装命令:
npx skills add https://github.com/streamlit/streamlit --skill debugging-streamlit
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/streamlit/streamlit --skill debugging-streamlit

简介

该技能指导 Streamlit 应用的双端热重载开发与调试流程。

  • 适用于需要同时观察前端交互与后端逻辑的仪表板开发场景。
  • 通过 GitHub 仓库安装,需区分应用脚本变更与库代码更新的不同处理方式。
  • 建议避免固定 VITE_PORT 端口号,防止多实例运行时冲突。
  • debugging-streamlit 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Debugging Streamlit Apps

Quick Start

make debug my_app.py

This starts both backend (Streamlit/Python) and frontend (Vite/React) with hot-reload. The app URL is printed on startup (default http://localhost:3001; 3000 is reserved for manual make frontend-dev; it may use 3002+ if other debug sessions are running). Avoid pinning VITE_PORT unless you have a specific hard requirement (last resort).

Hot-reload behavior:

  • Frontend: Changes to frontend/ code are applied within seconds.
  • Backend: Only changes to the app script trigger a rerun. Changes to the Streamlit library itself (lib/streamlit/) require restarting make debug.

Log Files

Each make debug run writes logs to a per-session directory under work-tmp/debug/ and updates work-tmp/debug/latest/ to point at the most recent session. Because latest/* is a symlink, it can move if multiple debug sessions are starting/stopping concurrently—prefer using the session directory path printed by make debug when you need stable log references. You can find the exact session directory in the make debug startup output under the Log files section.

FileContent
work-tmp/debug/latest/backend.logPython print() statements, Streamlit logs, errors
work-tmp/debug/latest/frontend.logBrowser console.log(), React errors, Vite output

Logs are cleared at the start of each session and persist after exit for post-mortem analysis.

Log size warning: Logs can grow large during extended debugging sessions. Instead of reading entire log files, use rg to search for specific patterns:

# Search for specific debug messages
rg "DEBUG:" work-tmp/debug/latest/backend.log

# Search for errors (case-insensitive)
rg -i "error|exception|traceback" work-tmp/debug/latest/backend.log

# Search with context (3 lines before/after)
rg -C 3 "my_function" work-tmp/debug/latest/backend.log

# Search frontend logs for specific component
rg "MyComponent" work-tmp/debug/latest/frontend.log

Use this directory for all debugging artifacts (scripts, screenshots, etc.) to keep them organized.

Adding Debug Output

Backend (Python):

print(f"DEBUG: session_state = {st.session_state}")

Frontend (TypeScript/React):

console.log("DEBUG: props =", props)

Frontend console.log() output appears in work-tmp/debug/latest/frontend.log (or the current session's frontend.log file).

Workflow

  1. Create or use a test script in work-tmp/debug/ (e.g., work-tmp/debug/test_feature.py)
  2. Run make debug work-tmp/debug/test_feature.py
  3. Verify startup: Check work-tmp/debug/latest/backend.log for Error/Exception and work-tmp/debug/latest/frontend.log for console errors to ensure both servers started correctly
  4. Access the printed App URL in your browser (default http://localhost:3001, but it may be 3002+)
  5. Verify script execution: Check work-tmp/debug/latest/backend.log again for any errors after the first app access
  6. Monitor logs by inspecting work-tmp/debug/latest/backend.log and work-tmp/debug/latest/frontend.log
  7. Edit code - changes apply automatically via hot-reload
  8. Check logs for debug output

Quick error check:

# Backend errors
rg -i "error|exception" work-tmp/debug/latest/backend.log

# Frontend console errors
rg -i "error" work-tmp/debug/latest/frontend.log

Temporary Playwright Scripts for Screenshots & Testing

For advanced debugging with screenshots or automated UI interaction.

Quick: Playwright CLI

For simple screenshots and interactions, use @playwright/cli (available in frontend devDependencies):

cd frontend
STREAMLIT_APP_URL=http://localhost:3001
yarn playwright-cli open "$STREAMLIT_APP_URL"
yarn playwright-cli screenshot --filename ../work-tmp/debug/screenshot.png --full-page
yarn playwright-cli close

See https://github.com/microsoft/playwright-cli for more commands (snapshot, click, fill, etc.).

Custom Scripts

For complex interactions, create temporary Playwright scripts in work-tmp/debug/:

# work-tmp/debug/debug_screenshot.py
"""Temporary Playwright script for debugging - run against make debug."""
import os
from playwright.sync_api import sync_playwright, expect

from e2e_playwright.shared.app_utils import get_text_input, click_button
from e2e_playwright.conftest import wait_for_app_loaded, wait_for_app_run

def main():
    app_url = os.environ.get("STREAMLIT_APP_URL", "http://localhost:3001")
    with sync_playwright() as p:
        browser = p.chromium.launch(headless=True)
        page = browser.new_page(viewport={"width": 1280, "height": 720})

        # Connect to app started with `make debug`
        page.goto(app_url)
        wait_for_app_loaded(page)

        # Interact with the app
        text_input = get_text_input(page, "Name")
        text_input.fill("Test User")
        click_button(page, "Submit")
        wait_for_app_run(page)

        # Verify and screenshot
        expect(page.get_by_text("Hello, Test User")).to_be_visible()
        page.screenshot(path="work-tmp/debug/debug_screenshot.png", full_page=True)
        print("Screenshot saved to work-tmp/debug/debug_screenshot.png")

        browser.close()

if __name__ == "__main__":
    main()

Running Temporary Scripts

Ensure make debug <app.py> is running first (start it in a background task if needed). If your make debug session is using a non-default port, set STREAMLIT_APP_URL accordingly, then run the Playwright script:

STREAMLIT_APP_URL=http://localhost:3001 \
PYTHONPATH=. uv run python work-tmp/debug/debug_screenshot.py

This uses the uv-managed environment with all dependencies (playwright, etc.) and makes e2e_playwright importable without path manipulation.

Available Utilities from e2e_playwright

Element Locators & Interactions (e2e_playwright.shared.app_utils): Provides helpers like get_text_input(), get_button(), click_button(), get_checkbox(), etc.

Synchronization (e2e_playwright.conftest):

  • wait_for_app_loaded(page) - wait for initial load
  • wait_for_app_run(page) - wait for script execution after interaction
  • wait_until(page, fn, timeout) - poll until condition is true

Playwright API Reference: https://playwright.dev/python/docs/api/class-playwright

Screenshot Best Practices

# Full page screenshot
page.screenshot(path="work-tmp/debug/full.png", full_page=True)

# Element screenshot
element = page.get_by_test_id("stDataFrame")
element.screenshot(path="work-tmp/debug/dataframe.png")

Troubleshooting

Port already in use / multiple sessions:

  • make debug will automatically pick a free frontend port (typically in the 3001-3100 range) so multiple debug sessions can run simultaneously.
  • Frontend port 3000 is reserved for manual make frontend-dev sessions.
  • If you have a hard requirement for a specific frontend port, you can pin it with VITE_PORT=3002 make debug <app.py> (last resort).

Hot-reload not working:

  • Backend: Only the app script is watched. Changes to lib/streamlit/ require restarting make debug.
  • Frontend: Check work-tmp/debug/latest/frontend.log for Vite errors. TypeScript errors can break HMR.

Playwright script fails to connect:

  • Verify make debug is running and healthy
  • Check the printed App URL is accessible in the browser
  • Ensure wait_for_app_loaded(page) is called after page.goto()

Cleanup

After debugging is complete, remove temporary scripts and screenshots from work-tmp/debug/.

Related Skills

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

34.42%
按下载量换算722

Claude

29.41%
按下载量换算617

Cursor

19.84%
按下载量换算416

Gemini CLI

10.77%
按下载量换算226

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills