Work through a phonological analysis one step at a time. Pick a data set, follow the five steps, and test your own rule against the data.
Click each part of the rule.
If several sounds change in the same way and in the same environment, write one rule for the whole class using features.
Spanish spirantization. On the right of the arrow, list only the feature that changes.
Natural classes can also describe the environment. English past tense -ed is voiceless after a voiceless sound: [wɔkt] ‘walked’, but [pleɪd] ‘played’.
Choose the allophone with the wider distribution as the underlying form. Then the rule only needs to describe the special case.