plugins/code-simplifier/skills/code-simplifier/SKILL.md
Simplifies and refines code for clarity, consistency, and maintainability while preserving all functionality. Focuses on recently modified code unless instructed otherwise.
npx skillsauth add mattermost/mattermost-ai-marketplace code-simplifierInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Expert code simplification focused on clarity, consistency, and maintainability while preserving exact functionality. Prioritizes readable, explicit code over overly compact solutions.
Never change what the code does — only how it does it. All original features, outputs, and behaviors must remain intact.
Follow established coding standards from the project's CLAUDE.md or equivalent, including:
function keyword over arrow functions)Avoid:
When invoked (either explicitly or proactively after code changes):
make check-style-fix or equivalent) to verify standards complianceBefore:
func process(items []Item) error {
if len(items) > 0 {
for _, item := range items {
if item.IsValid() {
if err := item.Save(); err != nil {
return err
}
}
}
}
return nil
}
After:
func process(items []Item) error {
for _, item := range items {
if !item.IsValid() {
continue
}
if err := item.Save(); err != nil {
return err
}
}
return nil
}
Before:
const label = status === 'active' ? 'Active' : status === 'pending' ? 'Pending' : status === 'error' ? 'Error' : 'Unknown';
After:
function getStatusLabel(status: string): string {
switch (status) {
case 'active':
return 'Active';
case 'pending':
return 'Pending';
case 'error':
return 'Error';
default:
return 'Unknown';
}
}
Before:
func handleRequest(r *Request) (*Response, error) {
userID := r.GetUserID()
if userID == "" {
return nil, errors.New("missing user ID")
}
channelID := r.GetChannelID()
if channelID == "" {
return nil, errors.New("missing channel ID")
}
teamID := r.GetTeamID()
if teamID == "" {
return nil, errors.New("missing team ID")
}
// ... rest of handler
}
After:
func handleRequest(r *Request) (*Response, error) {
if err := validateRequiredFields(r); err != nil {
return nil, err
}
// ... rest of handler
}
func validateRequiredFields(r *Request) error {
required := map[string]string{
"user ID": r.GetUserID(),
"channel ID": r.GetChannelID(),
"team ID": r.GetTeamID(),
}
for name, value := range required {
if value == "" {
return fmt.Errorf("missing %s", name)
}
}
return nil
}
tools
Analyze a GitHub pull request for risk level and generate concrete QA recommendations. Accepts a PR URL or "owner/repo#number" reference. Uses `gh` CLI to fetch the diff and metadata, computes blast radius, scores six risk dimensions, and returns a structured JSON risk assessment. Use when the user invokes /qa-analysis:qa-analysis with a GitHub PR URL or reference, or asks for a PR risk assessment, QA recommendations, or "what should I test?" for a given pull request.
tools
Add an MCP (Model Context Protocol) server to a Mattermost plugin so the Agents plugin can call its tools. Use when implementing cross-plugin MCP, exposing AI tools from a Mattermost plugin to the Agents plugin, or wiring up the `pluginmcp` helper from mattermost-plugin-agents.
tools
Create a new Mattermost plugin from the starter template in the current directory. Use when creating a new plugin from scratch, scaffolding a Mattermost plugin, or bootstrapping a plugin project.
development
Orchestrates test-driven fixes for Mattermost security tickets (Jira/Atlassian) with a Staff Security Engineer mindset: failing secure-behavior tests first, then implementation, then security review and edge-case loops, then opening a non-draft PR that follows `.github/PULL_REQUEST_TEMPLATE.md` when present, with a vague public description (no exploit detail). Use when the user invokes /security-fix:security-fix with a mattermost.atlassian.net browse URL, MM-* security work, backend permission or authorization bugs, or asks for this security TDD workflow.