xiaohongshu
xiaohongshu
charmcraft
Expert assistant for developing Juju charms using charmcraft. Use when initializing charm projects, building charms, managing charm libraries, publishing to Charmhub, running tests, or working with charmcraft.yaml configuration. Keywords include charmcraft, Juju, charm development, Charmhub publi...
Full skill instructions
Expert guidance for developing, building, testing, and publishing Juju charms using charmcraft.
# Initialize new charm with profile
charmcraft init --profile=kubernetes # K8s charm (default)
charmcraft init --profile=machine # Machine charm
charmcraft init --profile=django-framework # Django app
charmcraft init --profile=fastapi-framework # FastAPI app
charmcraft init --profile=flask-framework # Flask app
# With custom name and author
charmcraft init --name=my-charm --author="Your Name"
# List/expand extensions
charmcraft list-extensions
charmcraft expand-extensions
After init:
charmcraft.yaml (metadata, bases, relations, config)README.md (becomes Charmhub documentation)src/charm.py (using Ops framework)tests/unit/ and tests/integration/For detailed charmcraft.yaml configuration, see references/charmcraft-yaml-reference.md
# Build charm
charmcraft pack # Main command
charmcraft pack -o ./build/ # Custom output directory
charmcraft pack --bases-index=0 # Specific base (if multiple defined)
# Analyse charm (always run before uploading!)
charmcraft analyse ./my-charm_ubuntu-22.04-amd64.charm
charmcraft analyse --format=json ./my-charm.charm
# Clean build artifacts
charmcraft clean
# Remote build (for multi-architecture)
charmcraft remote-build
Build lifecycle: pack handles everything automatically. Only use individual steps (pull, build, stage, prime) for debugging.
Always run charmcraft analyse before uploading to catch:
# Run tests
charmcraft test # Integration tests
charmcraft test --shell # Debug environment
charmcraft test --debug # Shell on failure
# Local quality checks
tox -e format # Format with ruff
tox -e lint # Lint with ruff + pyright
tox -e unit # Unit tests (ops.testing)
tox -e integration # Integration tests
# Account setup
charmcraft login
charmcraft whoami
charmcraft register my-charm # Register name first
# Upload and release
charmcraft upload ./my-charm.charm --release=edge
charmcraft status my-charm # Check status
charmcraft revisions my-charm # List revisions
# Release specific revision
charmcraft release my-charm --revision=5 --channel=stable
# Promote between channels
charmcraft promote my-charm --from=beta --to=stable
# Close channel
charmcraft close my-charm edge
Channel structure: [track/]risk[/branch]
edge → beta → candidate → stablestable, edge, 2.0/candidate, beta/hotfix-123Always: Upload to edge first, test thoroughly, then promote through channels.
# Manage resources (images, binaries)
charmcraft resources my-charm
charmcraft upload-resource my-charm my-resource --filepath=./file.tar.gz
charmcraft resource-revisions my-charm my-resource
# Release with specific resources
charmcraft release my-charm --revision=5 --channel=stable --resource=my-resource:3
# Using libraries (define in charmcraft.yaml first)
charmcraft fetch-libs # Fetch defined libraries
charmcraft list-lib postgresql # List available libs
# Publishing libraries
charmcraft create-lib my-charm my_library
charmcraft publish-lib charms.my_charm.v0.my_library
In charmcraft.yaml:
charm-libs:
- lib: postgresql.postgres_client
version: "0" # Major version (auto-updates minor)
- lib: mysql.client
version: "0.57" # Pinned version
Library versioning:
v0, v1 = breaking changes (API changes)lib/charms/{charm_name}/v{X}/{lib_name}.pyCore configuration defining:
name, title, summary, description)bases)parts)provides, requires, peers - always use optional: true for requires!)config)actions)resources)See references/charmcraft-yaml-reference.md for complete specification.
Main charm implementation:
CharmBase)tox -e lint and tox -e format frequentlycharmcraft analyse on every buildcharmcraft pack then juju deploy ./my-charm.charmKeep updated:
README.md - Main docs (appears on Charmhub)CONTRIBUTING.md - Development workflowCHANGELOG.md - User-facing changesSECURITY.md - Security reportingTUTORIAL.md - Basic usage guideCommit: charmcraft.yaml, all source, uv.lock, pyproject.toml, tests, docs
Ignore: *.charm, __pycache__/, .tox/, venv/, .claude/settings.local.json
bases:
- build-on:
- name: ubuntu
channel: "22.04"
run-on:
- name: ubuntu
channel: "22.04"
- build-on:
- name: ubuntu
channel: "24.04"
run-on:
- name: ubuntu
channel: "24.04"
Pack for specific base: charmcraft pack --bases-index=0
# In charmcraft.yaml
requires:
database:
interface: postgresql_client
optional: true # ALWAYS include the `optional` field, rather than relying on the default. Use `optional: false` if the charm works without the relation
charm-libs:
- lib: data_platform_libs.data_interfaces
version: "0"
# In src/charm.py
from charms.data_platform_libs.v0.data_interfaces import DatabaseRequires
class MyCharm(CharmBase):
def __init__(self, *args):
super().__init__(*args)
self.database = DatabaseRequires(self, "database", "myapp")
self.framework.observe(
self.database.on.database_created,
self._on_database_created
)
Build fails:
charmcraft.yaml syntaxsrc/charm.py, uv.lock)charmcraft -v pack for verbose outputUpload fails:
charmcraft logincharmcraft register my-charmcharmcraft analyse ./my-charm.charmLibrary errors:
charmcraft fetch-libscharmcraft.yamlRuntime issues:
juju debug-logcharmcraft resources my-charmFor comprehensive troubleshooting, see references/troubleshooting.md
# Setup
charmcraft init --profile=kubernetes
charmcraft login
# Development cycle
charmcraft pack
charmcraft analyse ./my-charm.charm
tox -e lint
tox -e unit
# Publishing
charmcraft upload ./my-charm.charm --release=edge
charmcraft status my-charm
charmcraft promote my-charm --from=edge --to=beta
# Libraries
charmcraft fetch-libs
charmcraft publish-lib charms.my_charm.v0.my_library
# Testing with Juju
juju deploy ./my-charm.charm
juju status
juju debug-log
When you need detailed information:
scripts/quick-start.sh helperKey reminders:
charmcraft analyse before uploadingedge before promoting to stableoptional: true for all requires relationsuv.lock in version controlxiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience